Lines Matching refs:ctx
107 static void rm68200_dcs_write_buf(struct rm68200 *ctx, const void *data, in rm68200_dcs_write_buf() argument
110 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in rm68200_dcs_write_buf()
119 static void rm68200_dcs_write_cmd(struct rm68200 *ctx, u8 cmd, u8 value) in rm68200_dcs_write_cmd() argument
121 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in rm68200_dcs_write_cmd()
129 #define dcs_write_seq(ctx, seq...) \ argument
133 rm68200_dcs_write_buf(ctx, d, ARRAY_SIZE(d)); \
140 #define dcs_write_cmd_seq(ctx, cmd, seq...) \ argument
146 rm68200_dcs_write_cmd(ctx, cmd + i, d[i]); \
149 static void rm68200_init_sequence(struct rm68200 *ctx) in rm68200_init_sequence() argument
152 dcs_write_seq(ctx, MCS_CMD_MODE_SW, MCS_CMD2_P0); in rm68200_init_sequence()
153 dcs_write_cmd_seq(ctx, MCS_EXT_PWR_IC, 0xC0, 0x53, 0x00); in rm68200_init_sequence()
154 dcs_write_seq(ctx, MCS_BT2CTR, 0xE5); in rm68200_init_sequence()
155 dcs_write_seq(ctx, MCS_SETAVDD, 0x0A); in rm68200_init_sequence()
156 dcs_write_seq(ctx, MCS_SETAVEE, 0x0A); in rm68200_init_sequence()
157 dcs_write_seq(ctx, MCS_SGOPCTR, 0x52); in rm68200_init_sequence()
158 dcs_write_seq(ctx, MCS_BT3CTR, 0x53); in rm68200_init_sequence()
159 dcs_write_seq(ctx, MCS_BT4CTR, 0x5A); in rm68200_init_sequence()
160 dcs_write_seq(ctx, MCS_INVCTR, 0x00); in rm68200_init_sequence()
161 dcs_write_seq(ctx, MCS_STBCTR, 0x0A); in rm68200_init_sequence()
162 dcs_write_seq(ctx, MCS_SDCTR, 0x06); in rm68200_init_sequence()
163 dcs_write_seq(ctx, MCS_VCMCTR, 0x56); in rm68200_init_sequence()
164 dcs_write_seq(ctx, MCS_SETVGN, 0xA0, 0x00); in rm68200_init_sequence()
165 dcs_write_seq(ctx, MCS_SETVGP, 0xA0, 0x00); in rm68200_init_sequence()
166 dcs_write_seq(ctx, MCS_SW_CTRL, 0x11); /* 2 data lanes, see doc */ in rm68200_init_sequence()
168 dcs_write_seq(ctx, MCS_CMD_MODE_SW, MCS_CMD2_P2); in rm68200_init_sequence()
169 dcs_write_seq(ctx, GOA_VSTV1, 0x05); in rm68200_init_sequence()
170 dcs_write_seq(ctx, 0x02, 0x0B); in rm68200_init_sequence()
171 dcs_write_seq(ctx, 0x03, 0x0F); in rm68200_init_sequence()
172 dcs_write_seq(ctx, 0x04, 0x7D, 0x00, 0x50); in rm68200_init_sequence()
173 dcs_write_cmd_seq(ctx, GOA_VSTV2, 0x05, 0x16, 0x0D, 0x11, 0x7D, 0x00, in rm68200_init_sequence()
175 dcs_write_cmd_seq(ctx, GOA_VCLK1, 0x07, 0x08, 0x01, 0x02, 0x00, 0x7D, in rm68200_init_sequence()
177 dcs_write_cmd_seq(ctx, GOA_VCLK2, 0x03, 0x04, 0x05, 0x06, 0x00, 0x7D, in rm68200_init_sequence()
179 dcs_write_seq(ctx, GOA_VCLK_OPT1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, in rm68200_init_sequence()
181 dcs_write_cmd_seq(ctx, GOA_BICLK1, 0x07, 0x08); in rm68200_init_sequence()
182 dcs_write_seq(ctx, 0x2D, 0x01); in rm68200_init_sequence()
183 dcs_write_seq(ctx, 0x2F, 0x02, 0x00, 0x40, 0x05, 0x08, 0x54, 0x7D, in rm68200_init_sequence()
185 dcs_write_cmd_seq(ctx, GOA_BICLK2, 0x03, 0x04, 0x05, 0x06, 0x00); in rm68200_init_sequence()
186 dcs_write_seq(ctx, 0x3D, 0x40); in rm68200_init_sequence()
187 dcs_write_seq(ctx, 0x3F, 0x05, 0x08, 0x54, 0x7D, 0x00); in rm68200_init_sequence()
188 dcs_write_seq(ctx, GOA_BICLK3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, in rm68200_init_sequence()
190 dcs_write_seq(ctx, GOA_BICLK4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, in rm68200_init_sequence()
192 dcs_write_seq(ctx, 0x58, 0x00, 0x00, 0x00); in rm68200_init_sequence()
193 dcs_write_seq(ctx, GOA_BICLK_OPT1, 0x00, 0x00, 0x00, 0x00, 0x00); in rm68200_init_sequence()
194 dcs_write_seq(ctx, GOA_BICLK_OPT2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, in rm68200_init_sequence()
196 dcs_write_seq(ctx, MCS_GOA_GPO1, 0x00, 0x00, 0x00, 0x00); in rm68200_init_sequence()
197 dcs_write_seq(ctx, MCS_GOA_GPO2, 0x00, 0x20, 0x00); in rm68200_init_sequence()
198 dcs_write_seq(ctx, MCS_GOA_EQ, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, in rm68200_init_sequence()
200 dcs_write_seq(ctx, MCS_GOA_CLK_GALLON, 0x00, 0x00); in rm68200_init_sequence()
201 dcs_write_cmd_seq(ctx, MCS_GOA_FS_SEL0, 0xBF, 0x02, 0x06, 0x14, 0x10, in rm68200_init_sequence()
203 dcs_write_cmd_seq(ctx, MCS_GOA_FS_SEL1, 0x3F, 0x3F, 0x3F, 0x3F, 0x0C, in rm68200_init_sequence()
205 dcs_write_cmd_seq(ctx, MCS_GOA_FS_SEL2, 0x04, 0x3F, 0x3F, 0x3F, 0x3F, in rm68200_init_sequence()
207 dcs_write_cmd_seq(ctx, MCS_GOA_FS_SEL3, 0x0B, 0x0D, 0x3F, 0x3F, 0x3F, in rm68200_init_sequence()
209 dcs_write_cmd_seq(ctx, 0xA2, 0x3F, 0x09, 0x13, 0x17, 0x11, 0x15); in rm68200_init_sequence()
210 dcs_write_cmd_seq(ctx, 0xA9, 0x07, 0x03, 0x3F); in rm68200_init_sequence()
211 dcs_write_cmd_seq(ctx, MCS_GOA_BS_SEL0, 0x3F, 0x05, 0x01, 0x17, 0x13, in rm68200_init_sequence()
213 dcs_write_cmd_seq(ctx, MCS_GOA_BS_SEL1, 0x3F, 0x3F, 0x3F, 0x3F, 0x0B, in rm68200_init_sequence()
215 dcs_write_cmd_seq(ctx, MCS_GOA_BS_SEL2, 0x03, 0x3F, 0x3F, 0x3F, 0x3F, in rm68200_init_sequence()
217 dcs_write_cmd_seq(ctx, MCS_GOA_BS_SEL3, 0x0C, 0x0A, 0x3F, 0x3F, 0x3F, in rm68200_init_sequence()
219 dcs_write_cmd_seq(ctx, MCS_GOA_BS_SEL4, 0x12, 0x16, 0x00, 0x04, 0x3F); in rm68200_init_sequence()
220 dcs_write_seq(ctx, 0xDC, 0x02); in rm68200_init_sequence()
221 dcs_write_seq(ctx, 0xDE, 0x12); in rm68200_init_sequence()
223 dcs_write_seq(ctx, MCS_CMD_MODE_SW, 0x0E); /* No documentation */ in rm68200_init_sequence()
224 dcs_write_seq(ctx, 0x01, 0x75); in rm68200_init_sequence()
226 dcs_write_seq(ctx, MCS_CMD_MODE_SW, MCS_CMD2_P3); in rm68200_init_sequence()
227 dcs_write_cmd_seq(ctx, MCS_GAMMA_VP, 0x00, 0x0C, 0x12, 0x0E, 0x06, in rm68200_init_sequence()
230 dcs_write_cmd_seq(ctx, MCS_GAMMA_VN, 0x00, 0x0C, 0x12, 0x0E, 0x06, in rm68200_init_sequence()
235 dcs_write_seq(ctx, MCS_CMD_MODE_SW, MCS_CMD1_UCS); in rm68200_init_sequence()
240 struct rm68200 *ctx = panel_to_rm68200(panel); in rm68200_disable() local
242 if (!ctx->enabled) in rm68200_disable()
245 backlight_disable(ctx->backlight); in rm68200_disable()
247 ctx->enabled = false; in rm68200_disable()
254 struct rm68200 *ctx = panel_to_rm68200(panel); in rm68200_unprepare() local
255 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in rm68200_unprepare()
258 if (!ctx->prepared) in rm68200_unprepare()
271 if (ctx->reset_gpio) { in rm68200_unprepare()
272 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in rm68200_unprepare()
276 regulator_disable(ctx->supply); in rm68200_unprepare()
278 ctx->prepared = false; in rm68200_unprepare()
285 struct rm68200 *ctx = panel_to_rm68200(panel); in rm68200_prepare() local
286 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in rm68200_prepare()
289 if (ctx->prepared) in rm68200_prepare()
292 ret = regulator_enable(ctx->supply); in rm68200_prepare()
298 if (ctx->reset_gpio) { in rm68200_prepare()
299 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in rm68200_prepare()
301 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in rm68200_prepare()
305 rm68200_init_sequence(ctx); in rm68200_prepare()
319 ctx->prepared = true; in rm68200_prepare()
326 struct rm68200 *ctx = panel_to_rm68200(panel); in rm68200_enable() local
328 if (ctx->enabled) in rm68200_enable()
331 backlight_enable(ctx->backlight); in rm68200_enable()
333 ctx->enabled = true; in rm68200_enable()
372 struct rm68200 *ctx; in rm68200_probe() local
375 ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); in rm68200_probe()
376 if (!ctx) in rm68200_probe()
379 ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); in rm68200_probe()
380 if (IS_ERR(ctx->reset_gpio)) { in rm68200_probe()
381 ret = PTR_ERR(ctx->reset_gpio); in rm68200_probe()
386 ctx->supply = devm_regulator_get(dev, "power"); in rm68200_probe()
387 if (IS_ERR(ctx->supply)) { in rm68200_probe()
388 ret = PTR_ERR(ctx->supply); in rm68200_probe()
394 ctx->backlight = devm_of_find_backlight(dev); in rm68200_probe()
395 if (IS_ERR(ctx->backlight)) in rm68200_probe()
396 return PTR_ERR(ctx->backlight); in rm68200_probe()
398 mipi_dsi_set_drvdata(dsi, ctx); in rm68200_probe()
400 ctx->dev = dev; in rm68200_probe()
407 drm_panel_init(&ctx->panel); in rm68200_probe()
408 ctx->panel.dev = dev; in rm68200_probe()
409 ctx->panel.funcs = &rm68200_drm_funcs; in rm68200_probe()
411 drm_panel_add(&ctx->panel); in rm68200_probe()
416 drm_panel_remove(&ctx->panel); in rm68200_probe()
425 struct rm68200 *ctx = mipi_dsi_get_drvdata(dsi); in rm68200_remove() local
428 drm_panel_remove(&ctx->panel); in rm68200_remove()