Lines Matching +full:panel +full:- +full:dsi
1 // SPDX-License-Identifier: GPL-2.0
3 * Samsung S6D7AA0 MIPI-DSI TFT LCD controller drm_panel driver.
28 struct drm_panel panel; member
29 struct mipi_dsi_device *dsi; member
52 static inline struct s6d7aa0 *panel_to_s6d7aa0(struct drm_panel *panel) in panel_to_s6d7aa0() argument
54 return container_of(panel, struct s6d7aa0, panel); in panel_to_s6d7aa0()
59 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in s6d7aa0_reset()
61 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in s6d7aa0_reset()
67 struct mipi_dsi_device *dsi = ctx->dsi; in s6d7aa0_lock() local
70 mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0xa5, 0xa5); in s6d7aa0_lock()
71 mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0xa5, 0xa5); in s6d7aa0_lock()
72 if (ctx->desc->use_passwd3) in s6d7aa0_lock()
73 mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0x5a, 0x5a); in s6d7aa0_lock()
75 mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD1, 0x5a, 0x5a); in s6d7aa0_lock()
76 mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD2, 0x5a, 0x5a); in s6d7aa0_lock()
77 if (ctx->desc->use_passwd3) in s6d7aa0_lock()
78 mipi_dsi_dcs_write_seq(dsi, MCS_PASSWD3, 0xa5, 0xa5); in s6d7aa0_lock()
86 struct mipi_dsi_device *dsi = ctx->dsi; in s6d7aa0_on() local
87 struct device *dev = &dsi->dev; in s6d7aa0_on()
90 ret = ctx->desc->init_func(ctx); in s6d7aa0_on()
92 dev_err(dev, "Failed to initialize panel: %d\n", ret); in s6d7aa0_on()
93 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in s6d7aa0_on()
97 ret = mipi_dsi_dcs_set_display_on(dsi); in s6d7aa0_on()
108 struct mipi_dsi_device *dsi = ctx->dsi; in s6d7aa0_off() local
109 struct device *dev = &dsi->dev; in s6d7aa0_off()
112 ret = ctx->desc->off_func(ctx); in s6d7aa0_off()
114 dev_err(dev, "Panel-specific off function failed: %d\n", ret); in s6d7aa0_off()
118 ret = mipi_dsi_dcs_set_display_off(dsi); in s6d7aa0_off()
125 ret = mipi_dsi_dcs_enter_sleep_mode(dsi); in s6d7aa0_off()
135 static int s6d7aa0_prepare(struct drm_panel *panel) in s6d7aa0_prepare() argument
137 struct s6d7aa0 *ctx = panel_to_s6d7aa0(panel); in s6d7aa0_prepare()
138 struct device *dev = &ctx->dsi->dev; in s6d7aa0_prepare()
141 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in s6d7aa0_prepare()
151 dev_err(dev, "Failed to initialize panel: %d\n", ret); in s6d7aa0_prepare()
152 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in s6d7aa0_prepare()
159 static int s6d7aa0_disable(struct drm_panel *panel) in s6d7aa0_disable() argument
161 struct s6d7aa0 *ctx = panel_to_s6d7aa0(panel); in s6d7aa0_disable()
162 struct device *dev = &ctx->dsi->dev; in s6d7aa0_disable()
167 dev_err(dev, "Failed to un-initialize panel: %d\n", ret); in s6d7aa0_disable()
172 static int s6d7aa0_unprepare(struct drm_panel *panel) in s6d7aa0_unprepare() argument
174 struct s6d7aa0 *ctx = panel_to_s6d7aa0(panel); in s6d7aa0_unprepare()
176 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in s6d7aa0_unprepare()
177 regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in s6d7aa0_unprepare()
186 struct mipi_dsi_device *dsi = bl_get_data(bl); in s6d7aa0_bl_update_status() local
190 ret = mipi_dsi_dcs_set_display_brightness(dsi, brightness); in s6d7aa0_bl_update_status()
199 struct mipi_dsi_device *dsi = bl_get_data(bl); in s6d7aa0_bl_get_brightness() local
203 ret = mipi_dsi_dcs_get_display_brightness(dsi, &brightness); in s6d7aa0_bl_get_brightness()
216 s6d7aa0_create_backlight(struct mipi_dsi_device *dsi) in s6d7aa0_create_backlight() argument
218 struct device *dev = &dsi->dev; in s6d7aa0_create_backlight()
225 return devm_backlight_device_register(dev, dev_name(dev), dev, dsi, in s6d7aa0_create_backlight()
229 /* Initialization code and structures for LSL080AL02 panel */
233 struct mipi_dsi_device *dsi = ctx->dsi; in s6d7aa0_lsl080al02_init() local
234 struct device *dev = &dsi->dev; in s6d7aa0_lsl080al02_init()
245 mipi_dsi_dcs_write_seq(dsi, MCS_OTP_RELOAD, 0x00, 0x10); in s6d7aa0_lsl080al02_init()
249 mipi_dsi_dcs_write_seq(dsi, 0xb6, 0x10); in s6d7aa0_lsl080al02_init()
252 mipi_dsi_dcs_write_seq(dsi, MCS_BL_CTL, 0x40, 0x00, 0x28); in s6d7aa0_lsl080al02_init()
256 mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_ADDRESS_MODE, 0x04); in s6d7aa0_lsl080al02_init()
258 ret = mipi_dsi_dcs_exit_sleep_mode(dsi); in s6d7aa0_lsl080al02_init()
265 mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_SET_ADDRESS_MODE, 0x00); in s6d7aa0_lsl080al02_init()
273 ret = mipi_dsi_dcs_set_display_on(dsi); in s6d7aa0_lsl080al02_init()
284 struct mipi_dsi_device *dsi = ctx->dsi; in s6d7aa0_lsl080al02_off() local
287 mipi_dsi_dcs_write_seq(dsi, MCS_BL_CTL, 0x40, 0x00, 0x20); in s6d7aa0_lsl080al02_off()
318 /* Initialization code and structures for LSL080AL03 panel */
322 struct mipi_dsi_device *dsi = ctx->dsi; in s6d7aa0_lsl080al03_init() local
323 struct device *dev = &dsi->dev; in s6d7aa0_lsl080al03_init()
334 if (ctx->desc->panel_type == S6D7AA0_PANEL_LSL080AL03) { in s6d7aa0_lsl080al03_init()
335 mipi_dsi_dcs_write_seq(dsi, MCS_BL_CTL, 0xc7, 0x00, 0x29); in s6d7aa0_lsl080al03_init()
336 mipi_dsi_dcs_write_seq(dsi, 0xbc, 0x01, 0x4e, 0xa0); in s6d7aa0_lsl080al03_init()
337 mipi_dsi_dcs_write_seq(dsi, 0xfd, 0x16, 0x10, 0x11, 0x23, in s6d7aa0_lsl080al03_init()
339 mipi_dsi_dcs_write_seq(dsi, 0xfe, 0x00, 0x02, 0x03, 0x21, in s6d7aa0_lsl080al03_init()
341 } else if (ctx->desc->panel_type == S6D7AA0_PANEL_LTL101AT01) { in s6d7aa0_lsl080al03_init()
342 mipi_dsi_dcs_write_seq(dsi, MCS_BL_CTL, 0x40, 0x00, 0x08); in s6d7aa0_lsl080al03_init()
343 mipi_dsi_dcs_write_seq(dsi, 0xbc, 0x01, 0x4e, 0x0b); in s6d7aa0_lsl080al03_init()
344 mipi_dsi_dcs_write_seq(dsi, 0xfd, 0x16, 0x10, 0x11, 0x23, in s6d7aa0_lsl080al03_init()
346 mipi_dsi_dcs_write_seq(dsi, 0xfe, 0x00, 0x02, 0x03, 0x21, in s6d7aa0_lsl080al03_init()
350 mipi_dsi_dcs_write_seq(dsi, 0xb3, 0x51); in s6d7aa0_lsl080al03_init()
351 mipi_dsi_dcs_write_seq(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 0x24); in s6d7aa0_lsl080al03_init()
352 mipi_dsi_dcs_write_seq(dsi, 0xf2, 0x02, 0x08, 0x08); in s6d7aa0_lsl080al03_init()
356 mipi_dsi_dcs_write_seq(dsi, 0xc0, 0x80, 0x80, 0x30); in s6d7aa0_lsl080al03_init()
357 mipi_dsi_dcs_write_seq(dsi, 0xcd, in s6d7aa0_lsl080al03_init()
360 mipi_dsi_dcs_write_seq(dsi, 0xce, in s6d7aa0_lsl080al03_init()
363 mipi_dsi_dcs_write_seq(dsi, 0xc1, 0x03); in s6d7aa0_lsl080al03_init()
365 ret = mipi_dsi_dcs_exit_sleep_mode(dsi); in s6d7aa0_lsl080al03_init()
377 ret = mipi_dsi_dcs_set_display_on(dsi); in s6d7aa0_lsl080al03_init()
388 struct mipi_dsi_device *dsi = ctx->dsi; in s6d7aa0_lsl080al03_off() local
390 mipi_dsi_dcs_write_seq(dsi, 0x22, 0x00); in s6d7aa0_lsl080al03_off()
421 /* Initialization structures for LTL101AT01 panel */
449 static int s6d7aa0_get_modes(struct drm_panel *panel, in s6d7aa0_get_modes() argument
455 ctx = container_of(panel, struct s6d7aa0, panel); in s6d7aa0_get_modes()
457 return -EINVAL; in s6d7aa0_get_modes()
459 mode = drm_mode_duplicate(connector->dev, ctx->desc->drm_mode); in s6d7aa0_get_modes()
461 return -ENOMEM; in s6d7aa0_get_modes()
465 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in s6d7aa0_get_modes()
466 connector->display_info.width_mm = mode->width_mm; in s6d7aa0_get_modes()
467 connector->display_info.height_mm = mode->height_mm; in s6d7aa0_get_modes()
468 connector->display_info.bus_flags = ctx->desc->bus_flags; in s6d7aa0_get_modes()
481 static int s6d7aa0_probe(struct mipi_dsi_device *dsi) in s6d7aa0_probe() argument
483 struct device *dev = &dsi->dev; in s6d7aa0_probe()
489 return -ENOMEM; in s6d7aa0_probe()
491 ctx->desc = of_device_get_match_data(dev); in s6d7aa0_probe()
492 if (!ctx->desc) in s6d7aa0_probe()
493 return -ENODEV; in s6d7aa0_probe()
495 ctx->supplies[0].supply = "power"; in s6d7aa0_probe()
496 ctx->supplies[1].supply = "vmipi"; in s6d7aa0_probe()
497 ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies), in s6d7aa0_probe()
498 ctx->supplies); in s6d7aa0_probe()
502 ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in s6d7aa0_probe()
503 if (IS_ERR(ctx->reset_gpio)) in s6d7aa0_probe()
504 return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), in s6d7aa0_probe()
505 "Failed to get reset-gpios\n"); in s6d7aa0_probe()
507 ctx->dsi = dsi; in s6d7aa0_probe()
508 mipi_dsi_set_drvdata(dsi, ctx); in s6d7aa0_probe()
510 dsi->lanes = 4; in s6d7aa0_probe()
511 dsi->format = MIPI_DSI_FMT_RGB888; in s6d7aa0_probe()
512 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST in s6d7aa0_probe()
513 | ctx->desc->mode_flags; in s6d7aa0_probe()
515 drm_panel_init(&ctx->panel, dev, &s6d7aa0_panel_funcs, in s6d7aa0_probe()
517 ctx->panel.prepare_prev_first = true; in s6d7aa0_probe()
519 ret = drm_panel_of_backlight(&ctx->panel); in s6d7aa0_probe()
523 /* Use DSI-based backlight as fallback if available */ in s6d7aa0_probe()
524 if (ctx->desc->has_backlight && !ctx->panel.backlight) { in s6d7aa0_probe()
525 ctx->panel.backlight = s6d7aa0_create_backlight(dsi); in s6d7aa0_probe()
526 if (IS_ERR(ctx->panel.backlight)) in s6d7aa0_probe()
527 return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight), in s6d7aa0_probe()
531 drm_panel_add(&ctx->panel); in s6d7aa0_probe()
533 ret = mipi_dsi_attach(dsi); in s6d7aa0_probe()
535 dev_err(dev, "Failed to attach to DSI host: %d\n", ret); in s6d7aa0_probe()
536 drm_panel_remove(&ctx->panel); in s6d7aa0_probe()
543 static void s6d7aa0_remove(struct mipi_dsi_device *dsi) in s6d7aa0_remove() argument
545 struct s6d7aa0 *ctx = mipi_dsi_get_drvdata(dsi); in s6d7aa0_remove()
548 ret = mipi_dsi_detach(dsi); in s6d7aa0_remove()
550 dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); in s6d7aa0_remove()
552 drm_panel_remove(&ctx->panel); in s6d7aa0_remove()
576 .name = "panel-samsung-s6d7aa0",
583 MODULE_DESCRIPTION("Samsung S6D7AA0 MIPI-DSI LCD controller driver");