]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
video: panel: add Samsung LTL106HL02 MIPI DSI panel driver
authorAnton Bambura <jenneron@protonmail.com>
Wed, 31 Jan 2024 06:57:16 +0000 (08:57 +0200)
committerAnatolij Gustschin <agust@denx.de>
Sun, 21 Apr 2024 07:07:02 +0000 (09:07 +0200)
LTL106HL02 is a color active matrix TFT (Thin Film Transistor)
liquid crystal display (LCD) that uses amorphous silicon TFT as
switching devices. This model is composed of a TFT LCD panel, a
driver circuit and a backlight unit. The resolution of a 10.6"
contains 1920 x 1080 pixels and can display up to 16,8M color
with wide viewing angle.

Co-developed-by: Jonas Schwöbel <jonasschwoebel@yahoo.de>
Signed-off-by: Jonas Schwöbel <jonasschwoebel@yahoo.de>
Co-developed-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Anton Bambura <jenneron@protonmail.com>
drivers/video/Kconfig
drivers/video/Makefile
drivers/video/samsung-ltl106hl02.c [new file with mode: 0644]

index 742ea6edee6672061801d3dde48f5ae466449968..7808ae7919e073fa125a488ce5e8fc5cc2b9e14a 100644 (file)
@@ -555,6 +555,15 @@ config VIDEO_LCD_RENESAS_R69328
          IPS-LCD module with Renesas R69328 IC. The panel has a 720x1280
          resolution and uses 24 bit RGB per pixel.
 
+config VIDEO_LCD_SAMSUNG_LTL106HL02
+       tristate "Samsung LTL106HL02 1920x1080 DSI video mode panel"
+       depends on PANEL && BACKLIGHT
+       select VIDEO_MIPI_DSI
+       help
+         Say Y here if you want to enable support for Samsung LTL106HL02
+         LCD module found in Microsoft Surface 2. The panel has a FullHD
+         resolution (1920x1080).
+
 config VIDEO_LCD_SSD2828
        bool "SSD2828 bridge chip"
        ---help---
index bb6d9b74b93f4440d855ff5b04d879433b0ed516..f3f70cd04a17a28417e3dfe080f9f5f758c9f756 100644 (file)
@@ -63,6 +63,7 @@ obj-$(CONFIG_VIDEO_LCD_ORISETECH_OTM8009A) += orisetech_otm8009a.o
 obj-$(CONFIG_VIDEO_LCD_RAYDIUM_RM68200) += raydium-rm68200.o
 obj-$(CONFIG_VIDEO_LCD_RENESAS_R61307) += renesas-r61307.o
 obj-$(CONFIG_VIDEO_LCD_RENESAS_R69328) += renesas-r69328.o
+obj-$(CONFIG_VIDEO_LCD_SAMSUNG_LTL106HL02) += samsung-ltl106hl02.o
 obj-$(CONFIG_VIDEO_LCD_SSD2828) += ssd2828.o
 obj-$(CONFIG_VIDEO_LCD_TDO_TL070WSH30) += tdo-tl070wsh30.o
 obj-$(CONFIG_VIDEO_MCDE_SIMPLE) += mcde_simple.o
diff --git a/drivers/video/samsung-ltl106hl02.c b/drivers/video/samsung-ltl106hl02.c
new file mode 100644 (file)
index 0000000..5e6c11c
--- /dev/null
@@ -0,0 +1,157 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Samsung LTL106HL02-001 DSI panel driver
+ *
+ * Copyright (c) 2020 Anton Bambura <jenneron@protonmail.com>
+ * Copyright (c) 2023 Svyatoslav Ryhel <clamor95@gmail.com>
+ * Copyright (c) 2024 Jonas Schwöbel <jonasschwoebel@yahoo.de>
+ */
+
+#include <backlight.h>
+#include <dm.h>
+#include <panel.h>
+#include <log.h>
+#include <mipi_dsi.h>
+#include <asm/gpio.h>
+#include <linux/delay.h>
+#include <power/regulator.h>
+
+struct samsung_ltl106hl02_priv {
+       struct udevice *vdd;
+       struct udevice *backlight;
+
+       struct gpio_desc reset_gpio;
+};
+
+static struct display_timing default_timing = {
+       .pixelclock.typ         = 137000000,
+       .hactive.typ            = 1920,
+       .hfront_porch.typ       = 32,
+       .hback_porch.typ        = 64,
+       .hsync_len.typ          = 32,
+       .vactive.typ            = 1080,
+       .vfront_porch.typ       = 2,
+       .vback_porch.typ        = 26,
+       .vsync_len.typ          = 3,
+};
+
+static int samsung_ltl106hl02_enable_backlight(struct udevice *dev)
+{
+       struct mipi_dsi_panel_plat *plat = dev_get_plat(dev);
+       struct mipi_dsi_device *dsi = plat->device;
+       int ret;
+
+       ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
+       if (ret < 0) {
+               log_debug("%s: failed to exit sleep mode: %d\n",
+                         __func__, ret);
+               return ret;
+       }
+       mdelay(70);
+
+       ret = mipi_dsi_dcs_set_display_on(dsi);
+       if (ret < 0) {
+               log_debug("%s: failed to enable display: %d\n",
+                         __func__, ret);
+               return ret;
+       }
+       mdelay(5);
+
+       return 0;
+}
+
+static int samsung_ltl106hl02_set_backlight(struct udevice *dev, int percent)
+{
+       struct samsung_ltl106hl02_priv *priv = dev_get_priv(dev);
+       int ret;
+
+       ret = backlight_enable(priv->backlight);
+       if (ret)
+               return ret;
+
+       return backlight_set_brightness(priv->backlight, percent);
+}
+
+static int samsung_ltl106hl02_timings(struct udevice *dev,
+                                     struct display_timing *timing)
+{
+       memcpy(timing, &default_timing, sizeof(*timing));
+       return 0;
+}
+
+static int samsung_ltl106hl02_of_to_plat(struct udevice *dev)
+{
+       struct samsung_ltl106hl02_priv *priv = dev_get_priv(dev);
+       int ret;
+
+       ret = uclass_get_device_by_phandle(UCLASS_PANEL_BACKLIGHT, dev,
+                                          "backlight", &priv->backlight);
+       if (ret) {
+               log_debug("%s: cannot get backlight: ret = %d\n",
+                         __func__, ret);
+               return ret;
+       }
+
+       ret = uclass_get_device_by_phandle(UCLASS_REGULATOR, dev,
+                                          "vdd-supply", &priv->vdd);
+       if (ret)
+               log_debug("%s: cannot get vdd-supply: error %d\n",
+                         __func__, ret);
+
+       ret = gpio_request_by_name(dev, "reset-gpios", 0,
+                                  &priv->reset_gpio, GPIOD_IS_OUT);
+       if (ret)
+               log_debug("%s: cannot get reset-gpios: error %d\n",
+                         __func__, ret);
+
+       return 0;
+}
+
+static int samsung_ltl106hl02_hw_init(struct udevice *dev)
+{
+       struct samsung_ltl106hl02_priv *priv = dev_get_priv(dev);
+
+       dm_gpio_set_value(&priv->reset_gpio, 1);
+       regulator_set_enable_if_allowed(priv->vdd, 1);
+
+       /* Dataheets states at least 8.5 msec for vdd stabilization */
+       mdelay(10);
+
+       dm_gpio_set_value(&priv->reset_gpio, 0);
+
+       return 0;
+}
+
+static int samsung_ltl106hl02_probe(struct udevice *dev)
+{
+       struct mipi_dsi_panel_plat *plat = dev_get_plat(dev);
+
+       /* fill characteristics of DSI data link */
+       plat->lanes = 4;
+       plat->format = MIPI_DSI_FMT_RGB888;
+       plat->mode_flags = MIPI_DSI_MODE_VIDEO;
+
+       return samsung_ltl106hl02_hw_init(dev);
+}
+
+static const struct panel_ops samsung_ltl106hl02_ops = {
+       .enable_backlight       = samsung_ltl106hl02_enable_backlight,
+       .set_backlight          = samsung_ltl106hl02_set_backlight,
+       .get_display_timing     = samsung_ltl106hl02_timings,
+};
+
+static const struct udevice_id samsung_ltl106hl02_ids[] = {
+       { .compatible = "samsung,ltl106hl02-001" },
+       { }
+};
+
+U_BOOT_DRIVER(samsung_ltl106hl02) = {
+       .name           = "samsung_ltl106hl02",
+       .id             = UCLASS_PANEL,
+       .of_match       = samsung_ltl106hl02_ids,
+       .ops            = &samsung_ltl106hl02_ops,
+       .of_to_plat     = samsung_ltl106hl02_of_to_plat,
+       .probe          = samsung_ltl106hl02_probe,
+       .plat_auto      = sizeof(struct mipi_dsi_panel_plat),
+       .priv_auto      = sizeof(struct samsung_ltl106hl02_priv),
+};