Lines Matching +full:dsi +full:- +full:based

1 // SPDX-License-Identifier: GPL-2.0
3 * Driver for panels based on Himax HX8394 controller, such as:
5 * - HannStar HSD060BHW4 5.99" MIPI-DSI panel
9 * Based on drivers/gpu/drm/panel/panel-sitronix-st7703.c
15 #include <linux/media-bus-format.h>
27 #define DRV_NAME "panel-himax-hx8394"
29 /* Manufacturer specific commands sent via DSI, listed in HX8394-F datasheet */
93 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in hsd060bhw4_init_sequence() local
96 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETEXTC, in hsd060bhw4_init_sequence()
100 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER, in hsd060bhw4_init_sequence()
104 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETMIPI, in hsd060bhw4_init_sequence()
108 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETDISP, in hsd060bhw4_init_sequence()
112 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETCYC, in hsd060bhw4_init_sequence()
118 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP0, in hsd060bhw4_init_sequence()
125 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP1, in hsd060bhw4_init_sequence()
133 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP2, in hsd060bhw4_init_sequence()
141 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGAMMA, in hsd060bhw4_init_sequence()
151 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPANEL, in hsd060bhw4_init_sequence()
154 /* Unknown command, not listed in the HX8394-F datasheet */ in hsd060bhw4_init_sequence()
155 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN1, in hsd060bhw4_init_sequence()
159 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETVCOM, in hsd060bhw4_init_sequence()
162 /* Unknown command, not listed in the HX8394-F datasheet */ in hsd060bhw4_init_sequence()
163 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN3, in hsd060bhw4_init_sequence()
167 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK, in hsd060bhw4_init_sequence()
171 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER, in hsd060bhw4_init_sequence()
175 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK, in hsd060bhw4_init_sequence()
178 /* Unknown command, not listed in the HX8394-F datasheet */ in hsd060bhw4_init_sequence()
179 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN3, in hsd060bhw4_init_sequence()
210 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in powkiddy_x55_init_sequence() local
213 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETEXTC, in powkiddy_x55_init_sequence()
217 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETMIPI, in powkiddy_x55_init_sequence()
221 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER, in powkiddy_x55_init_sequence()
225 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETDISP, in powkiddy_x55_init_sequence()
229 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETCYC, in powkiddy_x55_init_sequence()
235 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETVCOM, in powkiddy_x55_init_sequence()
239 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP0, in powkiddy_x55_init_sequence()
246 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP1, in powkiddy_x55_init_sequence()
254 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP2, in powkiddy_x55_init_sequence()
262 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGAMMA, in powkiddy_x55_init_sequence()
270 /* Unknown command, not listed in the HX8394-F datasheet */ in powkiddy_x55_init_sequence()
271 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN1, in powkiddy_x55_init_sequence()
275 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPANEL, in powkiddy_x55_init_sequence()
278 /* Unknown command, not listed in the HX8394-F datasheet */ in powkiddy_x55_init_sequence()
279 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN3, in powkiddy_x55_init_sequence()
283 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK, in powkiddy_x55_init_sequence()
286 /* Unknown command, not listed in the HX8394-F datasheet */ in powkiddy_x55_init_sequence()
287 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN4, in powkiddy_x55_init_sequence()
292 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK, in powkiddy_x55_init_sequence()
296 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK, in powkiddy_x55_init_sequence()
300 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER, in powkiddy_x55_init_sequence()
304 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK, in powkiddy_x55_init_sequence()
307 /* Unknown command, not listed in the HX8394-F datasheet */ in powkiddy_x55_init_sequence()
308 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN5, in powkiddy_x55_init_sequence()
311 /* Unknown command, not listed in the HX8394-F datasheet */ in powkiddy_x55_init_sequence()
312 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN2, in powkiddy_x55_init_sequence()
344 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in mchp_ac40t08a_init_sequence() local
350 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETEXTC, in mchp_ac40t08a_init_sequence()
354 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETMIPI, in mchp_ac40t08a_init_sequence()
358 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER, in mchp_ac40t08a_init_sequence()
363 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETDISP, in mchp_ac40t08a_init_sequence()
367 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETCYC, in mchp_ac40t08a_init_sequence()
374 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETVCOM, in mchp_ac40t08a_init_sequence()
378 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP0, in mchp_ac40t08a_init_sequence()
387 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP1, in mchp_ac40t08a_init_sequence()
398 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGIP2, in mchp_ac40t08a_init_sequence()
409 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETGAMMA, in mchp_ac40t08a_init_sequence()
421 /* Unknown command, not listed in the HX8394-F datasheet (C0H) */ in mchp_ac40t08a_init_sequence()
422 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN1, in mchp_ac40t08a_init_sequence()
426 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETCABC, in mchp_ac40t08a_init_sequence()
430 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPANEL, in mchp_ac40t08a_init_sequence()
433 /* Unknown command, not listed in the HX8394-F datasheet (D4h) */ in mchp_ac40t08a_init_sequence()
434 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN3, in mchp_ac40t08a_init_sequence()
438 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK, in mchp_ac40t08a_init_sequence()
442 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN4, in mchp_ac40t08a_init_sequence()
447 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK, in mchp_ac40t08a_init_sequence()
451 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK, in mchp_ac40t08a_init_sequence()
455 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETPOWER, in mchp_ac40t08a_init_sequence()
459 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_SETREGBANK, in mchp_ac40t08a_init_sequence()
462 /* Unknown command, not listed in the HX8394-F datasheet (C6h) */ in mchp_ac40t08a_init_sequence()
463 mipi_dsi_dcs_write_seq(dsi, HX8394_CMD_UNKNOWN2, in mchp_ac40t08a_init_sequence()
495 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in hx8394_enable() local
498 ret = ctx->desc->init_sequence(ctx); in hx8394_enable()
500 dev_err(ctx->dev, "Panel init sequence failed: %d\n", ret); in hx8394_enable()
504 ret = mipi_dsi_dcs_exit_sleep_mode(dsi); in hx8394_enable()
506 dev_err(ctx->dev, "Failed to exit sleep mode: %d\n", ret); in hx8394_enable()
513 ret = mipi_dsi_dcs_set_display_on(dsi); in hx8394_enable()
515 dev_err(ctx->dev, "Failed to turn on the display: %d\n", ret); in hx8394_enable()
523 if (!mipi_dsi_dcs_enter_sleep_mode(dsi)) in hx8394_enable()
532 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in hx8394_disable() local
535 ret = mipi_dsi_dcs_enter_sleep_mode(dsi); in hx8394_disable()
537 dev_err(ctx->dev, "Failed to enter sleep mode: %d\n", ret); in hx8394_disable()
550 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in hx8394_unprepare()
552 regulator_disable(ctx->iovcc); in hx8394_unprepare()
553 regulator_disable(ctx->vcc); in hx8394_unprepare()
563 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in hx8394_prepare()
565 ret = regulator_enable(ctx->vcc); in hx8394_prepare()
567 dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret); in hx8394_prepare()
571 ret = regulator_enable(ctx->iovcc); in hx8394_prepare()
573 dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret); in hx8394_prepare()
577 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in hx8394_prepare()
584 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in hx8394_prepare()
585 regulator_disable(ctx->vcc); in hx8394_prepare()
595 mode = drm_mode_duplicate(connector->dev, ctx->desc->mode); in hx8394_get_modes()
597 dev_err(ctx->dev, "Failed to add mode %ux%u@%u\n", in hx8394_get_modes()
598 ctx->desc->mode->hdisplay, ctx->desc->mode->vdisplay, in hx8394_get_modes()
599 drm_mode_vrefresh(ctx->desc->mode)); in hx8394_get_modes()
600 return -ENOMEM; in hx8394_get_modes()
605 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in hx8394_get_modes()
606 connector->display_info.width_mm = mode->width_mm; in hx8394_get_modes()
607 connector->display_info.height_mm = mode->height_mm; in hx8394_get_modes()
617 return ctx->orientation; in hx8394_get_orientation()
629 static int hx8394_probe(struct mipi_dsi_device *dsi) in hx8394_probe() argument
631 struct device *dev = &dsi->dev; in hx8394_probe()
637 return -ENOMEM; in hx8394_probe()
639 ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); in hx8394_probe()
640 if (IS_ERR(ctx->reset_gpio)) in hx8394_probe()
641 return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), in hx8394_probe()
644 ret = of_drm_get_panel_orientation(dev->of_node, &ctx->orientation); in hx8394_probe()
646 dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret); in hx8394_probe()
650 mipi_dsi_set_drvdata(dsi, ctx); in hx8394_probe()
652 ctx->dev = dev; in hx8394_probe()
653 ctx->desc = of_device_get_match_data(dev); in hx8394_probe()
655 dsi->mode_flags = ctx->desc->mode_flags; in hx8394_probe()
656 dsi->format = ctx->desc->format; in hx8394_probe()
657 dsi->lanes = ctx->desc->lanes; in hx8394_probe()
659 ctx->vcc = devm_regulator_get(dev, "vcc"); in hx8394_probe()
660 if (IS_ERR(ctx->vcc)) in hx8394_probe()
661 return dev_err_probe(dev, PTR_ERR(ctx->vcc), in hx8394_probe()
664 ctx->iovcc = devm_regulator_get(dev, "iovcc"); in hx8394_probe()
665 if (IS_ERR(ctx->iovcc)) in hx8394_probe()
666 return dev_err_probe(dev, PTR_ERR(ctx->iovcc), in hx8394_probe()
669 drm_panel_init(&ctx->panel, dev, &hx8394_drm_funcs, in hx8394_probe()
672 ret = drm_panel_of_backlight(&ctx->panel); in hx8394_probe()
676 drm_panel_add(&ctx->panel); in hx8394_probe()
678 ret = mipi_dsi_attach(dsi); in hx8394_probe()
681 drm_panel_remove(&ctx->panel); in hx8394_probe()
685 dev_dbg(dev, "%ux%u@%u %ubpp dsi %udl - ready\n", in hx8394_probe()
686 ctx->desc->mode->hdisplay, ctx->desc->mode->vdisplay, in hx8394_probe()
687 drm_mode_vrefresh(ctx->desc->mode), in hx8394_probe()
688 mipi_dsi_pixel_format_to_bpp(dsi->format), dsi->lanes); in hx8394_probe()
693 static void hx8394_remove(struct mipi_dsi_device *dsi) in hx8394_remove() argument
695 struct hx8394 *ctx = mipi_dsi_get_drvdata(dsi); in hx8394_remove()
698 ret = mipi_dsi_detach(dsi); in hx8394_remove()
700 dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); in hx8394_remove()
702 drm_panel_remove(&ctx->panel); in hx8394_remove()
707 { .compatible = "powkiddy,x55-panel", .data = &powkiddy_x55_desc },
708 { .compatible = "microchip,ac40t08a-mipi-panel", .data = &mchp_ac40t08a_desc },
724 MODULE_DESCRIPTION("DRM driver for Himax HX8394 based MIPI DSI panels");