Lines Matching refs:ctx
104 static void rm68200_dcs_write_buf(struct rm68200 *ctx, const void *data, in rm68200_dcs_write_buf() argument
107 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in rm68200_dcs_write_buf()
112 dev_err_ratelimited(ctx->dev, "MIPI DSI DCS write buffer failed: %d\n", err); in rm68200_dcs_write_buf()
115 static void rm68200_dcs_write_cmd(struct rm68200 *ctx, u8 cmd, u8 value) in rm68200_dcs_write_cmd() argument
117 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in rm68200_dcs_write_cmd()
122 dev_err_ratelimited(ctx->dev, "MIPI DSI DCS write failed: %d\n", err); in rm68200_dcs_write_cmd()
125 #define dcs_write_seq(ctx, seq...) \ argument
129 rm68200_dcs_write_buf(ctx, d, ARRAY_SIZE(d)); \
136 #define dcs_write_cmd_seq(ctx, cmd, seq...) \ argument
142 rm68200_dcs_write_cmd(ctx, cmd + i, d[i]); \
145 static void rm68200_init_sequence(struct rm68200 *ctx) in rm68200_init_sequence() argument
148 dcs_write_seq(ctx, MCS_CMD_MODE_SW, MCS_CMD2_P0); in rm68200_init_sequence()
149 dcs_write_cmd_seq(ctx, MCS_EXT_PWR_IC, 0xC0, 0x53, 0x00); in rm68200_init_sequence()
150 dcs_write_seq(ctx, MCS_BT2CTR, 0xE5); in rm68200_init_sequence()
151 dcs_write_seq(ctx, MCS_SETAVDD, 0x0A); in rm68200_init_sequence()
152 dcs_write_seq(ctx, MCS_SETAVEE, 0x0A); in rm68200_init_sequence()
153 dcs_write_seq(ctx, MCS_SGOPCTR, 0x52); in rm68200_init_sequence()
154 dcs_write_seq(ctx, MCS_BT3CTR, 0x53); in rm68200_init_sequence()
155 dcs_write_seq(ctx, MCS_BT4CTR, 0x5A); in rm68200_init_sequence()
156 dcs_write_seq(ctx, MCS_INVCTR, 0x00); in rm68200_init_sequence()
157 dcs_write_seq(ctx, MCS_STBCTR, 0x0A); in rm68200_init_sequence()
158 dcs_write_seq(ctx, MCS_SDCTR, 0x06); in rm68200_init_sequence()
159 dcs_write_seq(ctx, MCS_VCMCTR, 0x56); in rm68200_init_sequence()
160 dcs_write_seq(ctx, MCS_SETVGN, 0xA0, 0x00); in rm68200_init_sequence()
161 dcs_write_seq(ctx, MCS_SETVGP, 0xA0, 0x00); in rm68200_init_sequence()
162 dcs_write_seq(ctx, MCS_SW_CTRL, 0x11); /* 2 data lanes, see doc */ in rm68200_init_sequence()
164 dcs_write_seq(ctx, MCS_CMD_MODE_SW, MCS_CMD2_P2); in rm68200_init_sequence()
165 dcs_write_seq(ctx, GOA_VSTV1, 0x05); in rm68200_init_sequence()
166 dcs_write_seq(ctx, 0x02, 0x0B); in rm68200_init_sequence()
167 dcs_write_seq(ctx, 0x03, 0x0F); in rm68200_init_sequence()
168 dcs_write_seq(ctx, 0x04, 0x7D, 0x00, 0x50); in rm68200_init_sequence()
169 dcs_write_cmd_seq(ctx, GOA_VSTV2, 0x05, 0x16, 0x0D, 0x11, 0x7D, 0x00, in rm68200_init_sequence()
171 dcs_write_cmd_seq(ctx, GOA_VCLK1, 0x07, 0x08, 0x01, 0x02, 0x00, 0x7D, in rm68200_init_sequence()
173 dcs_write_cmd_seq(ctx, GOA_VCLK2, 0x03, 0x04, 0x05, 0x06, 0x00, 0x7D, in rm68200_init_sequence()
175 dcs_write_seq(ctx, GOA_VCLK_OPT1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, in rm68200_init_sequence()
177 dcs_write_cmd_seq(ctx, GOA_BICLK1, 0x07, 0x08); in rm68200_init_sequence()
178 dcs_write_seq(ctx, 0x2D, 0x01); in rm68200_init_sequence()
179 dcs_write_seq(ctx, 0x2F, 0x02, 0x00, 0x40, 0x05, 0x08, 0x54, 0x7D, in rm68200_init_sequence()
181 dcs_write_cmd_seq(ctx, GOA_BICLK2, 0x03, 0x04, 0x05, 0x06, 0x00); in rm68200_init_sequence()
182 dcs_write_seq(ctx, 0x3D, 0x40); in rm68200_init_sequence()
183 dcs_write_seq(ctx, 0x3F, 0x05, 0x08, 0x54, 0x7D, 0x00); in rm68200_init_sequence()
184 dcs_write_seq(ctx, GOA_BICLK3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, in rm68200_init_sequence()
186 dcs_write_seq(ctx, GOA_BICLK4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, in rm68200_init_sequence()
188 dcs_write_seq(ctx, 0x58, 0x00, 0x00, 0x00); in rm68200_init_sequence()
189 dcs_write_seq(ctx, GOA_BICLK_OPT1, 0x00, 0x00, 0x00, 0x00, 0x00); in rm68200_init_sequence()
190 dcs_write_seq(ctx, GOA_BICLK_OPT2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, in rm68200_init_sequence()
192 dcs_write_seq(ctx, MCS_GOA_GPO1, 0x00, 0x00, 0x00, 0x00); in rm68200_init_sequence()
193 dcs_write_seq(ctx, MCS_GOA_GPO2, 0x00, 0x20, 0x00); in rm68200_init_sequence()
194 dcs_write_seq(ctx, MCS_GOA_EQ, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, in rm68200_init_sequence()
196 dcs_write_seq(ctx, MCS_GOA_CLK_GALLON, 0x00, 0x00); in rm68200_init_sequence()
197 dcs_write_cmd_seq(ctx, MCS_GOA_FS_SEL0, 0xBF, 0x02, 0x06, 0x14, 0x10, in rm68200_init_sequence()
199 dcs_write_cmd_seq(ctx, MCS_GOA_FS_SEL1, 0x3F, 0x3F, 0x3F, 0x3F, 0x0C, in rm68200_init_sequence()
201 dcs_write_cmd_seq(ctx, MCS_GOA_FS_SEL2, 0x04, 0x3F, 0x3F, 0x3F, 0x3F, in rm68200_init_sequence()
203 dcs_write_cmd_seq(ctx, MCS_GOA_FS_SEL3, 0x0B, 0x0D, 0x3F, 0x3F, 0x3F, in rm68200_init_sequence()
205 dcs_write_cmd_seq(ctx, 0xA2, 0x3F, 0x09, 0x13, 0x17, 0x11, 0x15); in rm68200_init_sequence()
206 dcs_write_cmd_seq(ctx, 0xA9, 0x07, 0x03, 0x3F); in rm68200_init_sequence()
207 dcs_write_cmd_seq(ctx, MCS_GOA_BS_SEL0, 0x3F, 0x05, 0x01, 0x17, 0x13, in rm68200_init_sequence()
209 dcs_write_cmd_seq(ctx, MCS_GOA_BS_SEL1, 0x3F, 0x3F, 0x3F, 0x3F, 0x0B, in rm68200_init_sequence()
211 dcs_write_cmd_seq(ctx, MCS_GOA_BS_SEL2, 0x03, 0x3F, 0x3F, 0x3F, 0x3F, in rm68200_init_sequence()
213 dcs_write_cmd_seq(ctx, MCS_GOA_BS_SEL3, 0x0C, 0x0A, 0x3F, 0x3F, 0x3F, in rm68200_init_sequence()
215 dcs_write_cmd_seq(ctx, MCS_GOA_BS_SEL4, 0x12, 0x16, 0x00, 0x04, 0x3F); in rm68200_init_sequence()
216 dcs_write_seq(ctx, 0xDC, 0x02); in rm68200_init_sequence()
217 dcs_write_seq(ctx, 0xDE, 0x12); in rm68200_init_sequence()
219 dcs_write_seq(ctx, MCS_CMD_MODE_SW, 0x0E); /* No documentation */ in rm68200_init_sequence()
220 dcs_write_seq(ctx, 0x01, 0x75); in rm68200_init_sequence()
222 dcs_write_seq(ctx, MCS_CMD_MODE_SW, MCS_CMD2_P3); in rm68200_init_sequence()
223 dcs_write_cmd_seq(ctx, MCS_GAMMA_VP, 0x00, 0x0C, 0x12, 0x0E, 0x06, in rm68200_init_sequence()
226 dcs_write_cmd_seq(ctx, MCS_GAMMA_VN, 0x00, 0x0C, 0x12, 0x0E, 0x06, in rm68200_init_sequence()
231 dcs_write_seq(ctx, MCS_CMD_MODE_SW, MCS_CMD1_UCS); in rm68200_init_sequence()
236 struct rm68200 *ctx = panel_to_rm68200(panel); in rm68200_disable() local
238 if (!ctx->enabled) in rm68200_disable()
241 ctx->enabled = false; in rm68200_disable()
248 struct rm68200 *ctx = panel_to_rm68200(panel); in rm68200_unprepare() local
249 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in rm68200_unprepare()
252 if (!ctx->prepared) in rm68200_unprepare()
265 if (ctx->reset_gpio) { in rm68200_unprepare()
266 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in rm68200_unprepare()
270 regulator_disable(ctx->supply); in rm68200_unprepare()
272 ctx->prepared = false; in rm68200_unprepare()
279 struct rm68200 *ctx = panel_to_rm68200(panel); in rm68200_prepare() local
280 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in rm68200_prepare()
283 if (ctx->prepared) in rm68200_prepare()
286 ret = regulator_enable(ctx->supply); in rm68200_prepare()
288 dev_err(ctx->dev, "failed to enable supply: %d\n", ret); in rm68200_prepare()
292 if (ctx->reset_gpio) { in rm68200_prepare()
293 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in rm68200_prepare()
295 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in rm68200_prepare()
299 rm68200_init_sequence(ctx); in rm68200_prepare()
313 ctx->prepared = true; in rm68200_prepare()
320 struct rm68200 *ctx = panel_to_rm68200(panel); in rm68200_enable() local
322 if (ctx->enabled) in rm68200_enable()
325 ctx->enabled = true; in rm68200_enable()
365 struct rm68200 *ctx; in rm68200_probe() local
368 ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); in rm68200_probe()
369 if (!ctx) in rm68200_probe()
372 ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); in rm68200_probe()
373 if (IS_ERR(ctx->reset_gpio)) { in rm68200_probe()
374 ret = PTR_ERR(ctx->reset_gpio); in rm68200_probe()
379 ctx->supply = devm_regulator_get(dev, "power"); in rm68200_probe()
380 if (IS_ERR(ctx->supply)) { in rm68200_probe()
381 ret = PTR_ERR(ctx->supply); in rm68200_probe()
387 mipi_dsi_set_drvdata(dsi, ctx); in rm68200_probe()
389 ctx->dev = dev; in rm68200_probe()
396 drm_panel_init(&ctx->panel, dev, &rm68200_drm_funcs, in rm68200_probe()
399 ret = drm_panel_of_backlight(&ctx->panel); in rm68200_probe()
403 drm_panel_add(&ctx->panel); in rm68200_probe()
408 drm_panel_remove(&ctx->panel); in rm68200_probe()
417 struct rm68200 *ctx = mipi_dsi_get_drvdata(dsi); in rm68200_remove() local
420 drm_panel_remove(&ctx->panel); in rm68200_remove()