• Home
  • Raw
  • Download

Lines Matching refs:ctx

93 static void otm8009a_dcs_write_buf(struct otm8009a *ctx, const void *data,  in otm8009a_dcs_write_buf()  argument
96 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in otm8009a_dcs_write_buf()
99 dev_warn(ctx->dev, "mipi dsi dcs write buffer failed\n"); in otm8009a_dcs_write_buf()
102 #define dcs_write_seq(ctx, seq...) \ argument
105 otm8009a_dcs_write_buf(ctx, d, ARRAY_SIZE(d)); \
108 #define dcs_write_cmd_at(ctx, cmd, seq...) \ argument
110 dcs_write_seq(ctx, MCS_ADRSFT, (cmd) & 0xFF); \
111 dcs_write_seq(ctx, (cmd) >> 8, seq); \
114 static int otm8009a_init_sequence(struct otm8009a *ctx) in otm8009a_init_sequence() argument
116 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in otm8009a_init_sequence()
120 dcs_write_cmd_at(ctx, MCS_CMD2_ENA1, 0x80, 0x09, 0x01); in otm8009a_init_sequence()
123 dcs_write_cmd_at(ctx, MCS_CMD2_ENA2, 0x80, 0x09); in otm8009a_init_sequence()
125 dcs_write_cmd_at(ctx, MCS_SD_PCH_CTRL, 0x30); in otm8009a_init_sequence()
128 dcs_write_cmd_at(ctx, MCS_NO_DOC1, 0x40); in otm8009a_init_sequence()
131 dcs_write_cmd_at(ctx, MCS_PWR_CTRL4 + 1, 0xA9); in otm8009a_init_sequence()
132 dcs_write_cmd_at(ctx, MCS_PWR_CTRL2 + 1, 0x34); in otm8009a_init_sequence()
133 dcs_write_cmd_at(ctx, MCS_P_DRV_M, 0x50); in otm8009a_init_sequence()
134 dcs_write_cmd_at(ctx, MCS_VCOMDC, 0x4E); in otm8009a_init_sequence()
135 dcs_write_cmd_at(ctx, MCS_OSC_ADJ, 0x66); /* 65Hz */ in otm8009a_init_sequence()
136 dcs_write_cmd_at(ctx, MCS_PWR_CTRL2 + 2, 0x01); in otm8009a_init_sequence()
137 dcs_write_cmd_at(ctx, MCS_PWR_CTRL2 + 5, 0x34); in otm8009a_init_sequence()
138 dcs_write_cmd_at(ctx, MCS_PWR_CTRL2 + 4, 0x33); in otm8009a_init_sequence()
139 dcs_write_cmd_at(ctx, MCS_GVDDSET, 0x79, 0x79); in otm8009a_init_sequence()
140 dcs_write_cmd_at(ctx, MCS_SD_CTRL + 1, 0x1B); in otm8009a_init_sequence()
141 dcs_write_cmd_at(ctx, MCS_PWR_CTRL1 + 2, 0x83); in otm8009a_init_sequence()
142 dcs_write_cmd_at(ctx, MCS_SD_PCH_CTRL + 1, 0x83); in otm8009a_init_sequence()
143 dcs_write_cmd_at(ctx, MCS_RGB_VID_SET, 0x0E); in otm8009a_init_sequence()
144 dcs_write_cmd_at(ctx, MCS_PANSET, 0x00, 0x01); in otm8009a_init_sequence()
146 dcs_write_cmd_at(ctx, MCS_GOAVST, 0x85, 0x01, 0x00, 0x84, 0x01, 0x00); in otm8009a_init_sequence()
147 dcs_write_cmd_at(ctx, MCS_GOACLKA1, 0x18, 0x04, 0x03, 0x39, 0x00, 0x00, in otm8009a_init_sequence()
149 dcs_write_cmd_at(ctx, MCS_GOACLKA3, 0x18, 0x02, 0x03, 0x3B, 0x00, 0x00, in otm8009a_init_sequence()
151 dcs_write_cmd_at(ctx, MCS_GOAECLK, 0x01, 0x01, 0x20, 0x20, 0x00, 0x00, in otm8009a_init_sequence()
154 dcs_write_cmd_at(ctx, MCS_NO_DOC2, 0x00); in otm8009a_init_sequence()
156 dcs_write_cmd_at(ctx, MCS_PANCTRLSET1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); in otm8009a_init_sequence()
157 dcs_write_cmd_at(ctx, MCS_PANCTRLSET2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, in otm8009a_init_sequence()
159 dcs_write_cmd_at(ctx, MCS_PANCTRLSET3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, in otm8009a_init_sequence()
161 dcs_write_cmd_at(ctx, MCS_PANCTRLSET4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); in otm8009a_init_sequence()
162 dcs_write_cmd_at(ctx, MCS_PANCTRLSET5, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, in otm8009a_init_sequence()
164 dcs_write_cmd_at(ctx, MCS_PANCTRLSET6, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, in otm8009a_init_sequence()
166 dcs_write_cmd_at(ctx, MCS_PANCTRLSET7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); in otm8009a_init_sequence()
167 dcs_write_cmd_at(ctx, MCS_PANCTRLSET8, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, in otm8009a_init_sequence()
170 dcs_write_cmd_at(ctx, MCS_PANU2D1, 0x00, 0x26, 0x09, 0x0B, 0x01, 0x25, in otm8009a_init_sequence()
172 dcs_write_cmd_at(ctx, MCS_PANU2D2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, in otm8009a_init_sequence()
174 dcs_write_cmd_at(ctx, MCS_PANU2D3, 0x25, 0x00, 0x00, 0x00, 0x00, 0x00, in otm8009a_init_sequence()
176 dcs_write_cmd_at(ctx, MCS_PAND2U1, 0x00, 0x25, 0x0C, 0x0A, 0x02, 0x26, in otm8009a_init_sequence()
178 dcs_write_cmd_at(ctx, MCS_PAND2U2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, in otm8009a_init_sequence()
180 dcs_write_cmd_at(ctx, MCS_PAND2U3, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00, in otm8009a_init_sequence()
183 dcs_write_cmd_at(ctx, MCS_PWR_CTRL1 + 1, 0x66); in otm8009a_init_sequence()
185 dcs_write_cmd_at(ctx, MCS_NO_DOC3, 0x06); in otm8009a_init_sequence()
187 dcs_write_cmd_at(ctx, MCS_GMCT2_2P, 0x00, 0x09, 0x0F, 0x0E, 0x07, 0x10, in otm8009a_init_sequence()
190 dcs_write_cmd_at(ctx, MCS_GMCT2_2N, 0x00, 0x09, 0x0F, 0x0E, 0x07, 0x10, in otm8009a_init_sequence()
195 dcs_write_cmd_at(ctx, MCS_CMD2_ENA1, 0xFF, 0xFF, 0xFF); in otm8009a_init_sequence()
209 dcs_write_seq(ctx, MIPI_DCS_SET_ADDRESS_MODE, 0x00); in otm8009a_init_sequence()
227 dcs_write_seq(ctx, MIPI_DCS_WRITE_POWER_SAVE, 0x00); in otm8009a_init_sequence()
238 dcs_write_seq(ctx, MIPI_DCS_WRITE_MEMORY_START); in otm8009a_init_sequence()
248 struct otm8009a *ctx = panel_to_otm8009a(panel); in otm8009a_disable() local
249 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in otm8009a_disable()
252 if (!ctx->enabled) in otm8009a_disable()
255 backlight_disable(ctx->bl_dev); in otm8009a_disable()
267 ctx->enabled = false; in otm8009a_disable()
274 struct otm8009a *ctx = panel_to_otm8009a(panel); in otm8009a_unprepare() local
276 if (!ctx->prepared) in otm8009a_unprepare()
279 if (ctx->reset_gpio) { in otm8009a_unprepare()
280 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in otm8009a_unprepare()
284 regulator_disable(ctx->supply); in otm8009a_unprepare()
286 ctx->prepared = false; in otm8009a_unprepare()
293 struct otm8009a *ctx = panel_to_otm8009a(panel); in otm8009a_prepare() local
296 if (ctx->prepared) in otm8009a_prepare()
299 ret = regulator_enable(ctx->supply); in otm8009a_prepare()
305 if (ctx->reset_gpio) { in otm8009a_prepare()
306 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in otm8009a_prepare()
307 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in otm8009a_prepare()
309 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in otm8009a_prepare()
313 ret = otm8009a_init_sequence(ctx); in otm8009a_prepare()
317 ctx->prepared = true; in otm8009a_prepare()
324 struct otm8009a *ctx = panel_to_otm8009a(panel); in otm8009a_enable() local
326 if (ctx->enabled) in otm8009a_enable()
329 backlight_enable(ctx->bl_dev); in otm8009a_enable()
331 ctx->enabled = true; in otm8009a_enable()
374 struct otm8009a *ctx = bl_get_data(bd); in otm8009a_backlight_update_status() local
377 if (!ctx->prepared) { in otm8009a_backlight_update_status()
389 otm8009a_dcs_write_buf(ctx, data, ARRAY_SIZE(data)); in otm8009a_backlight_update_status()
401 otm8009a_dcs_write_buf(ctx, data, ARRAY_SIZE(data)); in otm8009a_backlight_update_status()
413 struct otm8009a *ctx; in otm8009a_probe() local
416 ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); in otm8009a_probe()
417 if (!ctx) in otm8009a_probe()
420 ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); in otm8009a_probe()
421 if (IS_ERR(ctx->reset_gpio)) { in otm8009a_probe()
423 return PTR_ERR(ctx->reset_gpio); in otm8009a_probe()
426 ctx->supply = devm_regulator_get(dev, "power"); in otm8009a_probe()
427 if (IS_ERR(ctx->supply)) { in otm8009a_probe()
428 ret = PTR_ERR(ctx->supply); in otm8009a_probe()
434 mipi_dsi_set_drvdata(dsi, ctx); in otm8009a_probe()
436 ctx->dev = dev; in otm8009a_probe()
443 drm_panel_init(&ctx->panel, dev, &otm8009a_drm_funcs, in otm8009a_probe()
446 ctx->bl_dev = devm_backlight_device_register(dev, dev_name(dev), in otm8009a_probe()
447 dev, ctx, in otm8009a_probe()
450 if (IS_ERR(ctx->bl_dev)) { in otm8009a_probe()
451 ret = PTR_ERR(ctx->bl_dev); in otm8009a_probe()
456 ctx->bl_dev->props.max_brightness = OTM8009A_BACKLIGHT_MAX; in otm8009a_probe()
457 ctx->bl_dev->props.brightness = OTM8009A_BACKLIGHT_DEFAULT; in otm8009a_probe()
458 ctx->bl_dev->props.power = FB_BLANK_POWERDOWN; in otm8009a_probe()
459 ctx->bl_dev->props.type = BACKLIGHT_RAW; in otm8009a_probe()
461 drm_panel_add(&ctx->panel); in otm8009a_probe()
466 drm_panel_remove(&ctx->panel); in otm8009a_probe()
475 struct otm8009a *ctx = mipi_dsi_get_drvdata(dsi); in otm8009a_remove() local
478 drm_panel_remove(&ctx->panel); in otm8009a_remove()