Lines Matching +full:vcc +full:- +full:dsi +full:- +full:supply
1 // SPDX-License-Identifier: GPL-2.0+
5 * base on panel-kingdisplay-kd097d04.c
40 struct regulator *vcc; member
52 { 0x80, 0x03 }, /* 0X03:4-LANE; 0X02:3-LANE; 0X01:2-LANE */
67 { 0x20, 0x28 }, /* VGL_R = -12V */
68 { 0x21, 0x28 }, /* VGL_R2 = -12V */
83 { 0x41, 0xA0 }, /* LN = 640->1280 line */
91 { 0x59, 0x0A }, /* VCL = -2.9V */
93 { 0x5B, 0x14 }, /* VGL = -11V */
491 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in ltk500hd1829_unprepare() local
494 ret = mipi_dsi_dcs_set_display_off(dsi); in ltk500hd1829_unprepare()
496 dev_err(panel->dev, "failed to set display off: %d\n", ret); in ltk500hd1829_unprepare()
498 ret = mipi_dsi_dcs_enter_sleep_mode(dsi); in ltk500hd1829_unprepare()
500 dev_err(panel->dev, "failed to enter sleep mode: %d\n", ret); in ltk500hd1829_unprepare()
506 regulator_disable(ctx->iovcc); in ltk500hd1829_unprepare()
507 regulator_disable(ctx->vcc); in ltk500hd1829_unprepare()
515 struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); in ltk500hd1829_prepare() local
519 ret = regulator_enable(ctx->vcc); in ltk500hd1829_prepare()
521 dev_err(ctx->dev, "Failed to enable vci supply: %d\n", ret); in ltk500hd1829_prepare()
524 ret = regulator_enable(ctx->iovcc); in ltk500hd1829_prepare()
526 dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret); in ltk500hd1829_prepare()
530 gpiod_set_value_cansleep(ctx->reset_gpio, 1); in ltk500hd1829_prepare()
533 gpiod_set_value_cansleep(ctx->reset_gpio, 0); in ltk500hd1829_prepare()
538 for (i = 0; i < ctx->panel_desc->num_init; i++) { in ltk500hd1829_prepare()
539 ret = mipi_dsi_generic_write(dsi, &ctx->panel_desc->init[i], in ltk500hd1829_prepare()
542 dev_err(panel->dev, "failed to write init cmds: %d\n", ret); in ltk500hd1829_prepare()
547 ret = mipi_dsi_dcs_exit_sleep_mode(dsi); in ltk500hd1829_prepare()
549 dev_err(panel->dev, "failed to exit sleep mode: %d\n", ret); in ltk500hd1829_prepare()
556 ret = mipi_dsi_dcs_set_display_on(dsi); in ltk500hd1829_prepare()
558 dev_err(panel->dev, "failed to set display on: %d\n", ret); in ltk500hd1829_prepare()
565 regulator_disable(ctx->iovcc); in ltk500hd1829_prepare()
567 regulator_disable(ctx->vcc); in ltk500hd1829_prepare()
577 mode = drm_mode_duplicate(connector->dev, ctx->panel_desc->mode); in ltk500hd1829_get_modes()
579 dev_err(ctx->dev, "failed to add mode %ux%u@%u\n", in ltk500hd1829_get_modes()
580 ctx->panel_desc->mode->hdisplay, ctx->panel_desc->mode->vdisplay, in ltk500hd1829_get_modes()
581 drm_mode_vrefresh(ctx->panel_desc->mode)); in ltk500hd1829_get_modes()
582 return -ENOMEM; in ltk500hd1829_get_modes()
587 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; in ltk500hd1829_get_modes()
588 connector->display_info.width_mm = mode->width_mm; in ltk500hd1829_get_modes()
589 connector->display_info.height_mm = mode->height_mm; in ltk500hd1829_get_modes()
601 static int ltk500hd1829_probe(struct mipi_dsi_device *dsi) in ltk500hd1829_probe() argument
604 struct device *dev = &dsi->dev; in ltk500hd1829_probe()
607 ctx = devm_kzalloc(&dsi->dev, sizeof(*ctx), GFP_KERNEL); in ltk500hd1829_probe()
609 return -ENOMEM; in ltk500hd1829_probe()
611 ctx->panel_desc = of_device_get_match_data(dev); in ltk500hd1829_probe()
612 if (!ctx->panel_desc) in ltk500hd1829_probe()
613 return -EINVAL; in ltk500hd1829_probe()
615 ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); in ltk500hd1829_probe()
616 if (IS_ERR(ctx->reset_gpio)) { in ltk500hd1829_probe()
618 return PTR_ERR(ctx->reset_gpio); in ltk500hd1829_probe()
621 ctx->vcc = devm_regulator_get(dev, "vcc"); in ltk500hd1829_probe()
622 if (IS_ERR(ctx->vcc)) { in ltk500hd1829_probe()
623 ret = PTR_ERR(ctx->vcc); in ltk500hd1829_probe()
624 if (ret != -EPROBE_DEFER) in ltk500hd1829_probe()
625 dev_err(dev, "Failed to request vcc regulator: %d\n", ret); in ltk500hd1829_probe()
629 ctx->iovcc = devm_regulator_get(dev, "iovcc"); in ltk500hd1829_probe()
630 if (IS_ERR(ctx->iovcc)) { in ltk500hd1829_probe()
631 ret = PTR_ERR(ctx->iovcc); in ltk500hd1829_probe()
632 if (ret != -EPROBE_DEFER) in ltk500hd1829_probe()
637 mipi_dsi_set_drvdata(dsi, ctx); in ltk500hd1829_probe()
639 ctx->dev = dev; in ltk500hd1829_probe()
641 dsi->lanes = 4; in ltk500hd1829_probe()
642 dsi->format = MIPI_DSI_FMT_RGB888; in ltk500hd1829_probe()
643 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | in ltk500hd1829_probe()
646 drm_panel_init(&ctx->panel, &dsi->dev, <k500hd1829_funcs, in ltk500hd1829_probe()
649 ret = drm_panel_of_backlight(&ctx->panel); in ltk500hd1829_probe()
653 drm_panel_add(&ctx->panel); in ltk500hd1829_probe()
655 ret = mipi_dsi_attach(dsi); in ltk500hd1829_probe()
658 drm_panel_remove(&ctx->panel); in ltk500hd1829_probe()
665 static void ltk500hd1829_remove(struct mipi_dsi_device *dsi) in ltk500hd1829_remove() argument
667 struct ltk500hd1829 *ctx = mipi_dsi_get_drvdata(dsi); in ltk500hd1829_remove()
670 ret = mipi_dsi_detach(dsi); in ltk500hd1829_remove()
672 dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret); in ltk500hd1829_remove()
674 drm_panel_remove(&ctx->panel); in ltk500hd1829_remove()
692 .name = "panel-leadtek-ltk500hd1829",
700 MODULE_AUTHOR("Heiko Stuebner <heiko.stuebner@theobroma-systems.com>");