Re: [PATCH v4 3/3] drm/panel: add panel driver for Leadtek LTK500HD1829

2020-01-04 Thread Sam Ravnborg
On Tue, Dec 24, 2019 at 12:26:41PM +0100, Heiko Stuebner wrote:
> From: Heiko Stuebner 
> 
> The LTK500HD1829 is 5.5" DSI display.
> 
> changes in v4:
> - drop error message if backlight not found, no other panel
>   does that and if needed it should live in drm_panel_of_backlight
> changes in v3:
> - drop one more overlooked panel->drm access
> 
> Signed-off-by: Heiko Stuebner 

Applied to drm-misc-next.
Updated to fix a few trivial checkpatch warnings when I applied.

Sam
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v4 3/3] drm/panel: add panel driver for Leadtek LTK500HD1829

2019-12-24 Thread Heiko Stuebner
From: Heiko Stuebner 

The LTK500HD1829 is 5.5" DSI display.

changes in v4:
- drop error message if backlight not found, no other panel
  does that and if needed it should live in drm_panel_of_backlight
changes in v3:
- drop one more overlooked panel->drm access

Signed-off-by: Heiko Stuebner 
---
 drivers/gpu/drm/panel/Kconfig |  11 +
 drivers/gpu/drm/panel/Makefile|   1 +
 .../drm/panel/panel-leadtek-ltk500hd1829.c| 532 ++
 3 files changed, 544 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index d86d875de783..41f796b28dd5 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -109,6 +109,17 @@ config DRM_PANEL_KINGDISPLAY_KD097D04
  24 bit RGB per pixel. It provides a MIPI DSI interface to
  the host and has a built-in LED backlight.
 
+config DRM_PANEL_LEADTEK_LTK500HD1829
+   tristate "Leadtek LTK500HD1829 panel"
+   depends on OF
+   depends on DRM_MIPI_DSI
+   depends on BACKLIGHT_CLASS_DEVICE
+   help
+ Say Y here if you want to enable support for Kingdisplay kd097d04
+ TFT-LCD modules. The panel has a 1536x2048 resolution and uses
+ 24 bit RGB per pixel. It provides a MIPI DSI interface to
+ the host and has a built-in LED backlight.
+
 config DRM_PANEL_SAMSUNG_LD9040
tristate "Samsung LD9040 RGB/SPI panel"
depends on OF && SPI
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index f7cf83672fb8..4dc7acff21b9 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += 
panel-ilitek-ili9881c.o
 obj-$(CONFIG_DRM_PANEL_INNOLUX_P079ZCA) += panel-innolux-p079zca.o
 obj-$(CONFIG_DRM_PANEL_JDI_LT070ME05000) += panel-jdi-lt070me05000.o
 obj-$(CONFIG_DRM_PANEL_KINGDISPLAY_KD097D04) += panel-kingdisplay-kd097d04.o
+obj-$(CONFIG_DRM_PANEL_LEADTEK_LTK500HD1829) += panel-leadtek-ltk500hd1829.o
 obj-$(CONFIG_DRM_PANEL_LG_LB035Q02) += panel-lg-lb035q02.o
 obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
 obj-$(CONFIG_DRM_PANEL_NEC_NL8048HL11) += panel-nec-nl8048hl11.o
diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c 
b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
new file mode 100644
index ..07494b124301
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
@@ -0,0 +1,532 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2019 Theobroma Systems Design und Consulting GmbH
+ *
+ * base on panel-kingdisplay-kd097d04.c
+ * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+struct ltk500hd1829 {
+   struct device *dev;
+   struct drm_panel panel;
+   struct gpio_desc *reset_gpio;
+   struct regulator *vcc;
+   struct regulator *iovcc;
+   bool prepared;
+};
+
+struct ltk500hd1829_cmd {
+   char cmd;
+   char data;
+};
+
+/*
+ * There is no description in the Reference Manual about these commands.
+ * We received them from the vendor, so just use them as is.
+ */
+static const struct ltk500hd1829_cmd init_code[] = {
+   { 0xE0, 0x00 },
+   { 0xE1, 0x93 },
+   { 0xE2, 0x65 },
+   { 0xE3, 0xF8 },
+   { 0x80, 0x03 },
+   { 0xE0, 0x04 },
+   { 0x2D, 0x03 },
+   { 0xE0, 0x01 },
+   { 0x00, 0x00 },
+   { 0x01, 0xB6 },
+   { 0x03, 0x00 },
+   { 0x04, 0xC5 },
+   { 0x17, 0x00 },
+   { 0x18, 0xBF },
+   { 0x19, 0x01 },
+   { 0x1A, 0x00 },
+   { 0x1B, 0xBF },
+   { 0x1C, 0x01 },
+   { 0x1F, 0x7C },
+   { 0x20, 0x26 },
+   { 0x21, 0x26 },
+   { 0x22, 0x4E },
+   { 0x37, 0x09 },
+   { 0x38, 0x04 },
+   { 0x39, 0x08 },
+   { 0x3A, 0x1F },
+   { 0x3B, 0x1F },
+   { 0x3C, 0x78 },
+   { 0x3D, 0xFF },
+   { 0x3E, 0xFF },
+   { 0x3F, 0x00 },
+   { 0x40, 0x04 },
+   { 0x41, 0xA0 },
+   { 0x43, 0x0F },
+   { 0x44, 0x0A },
+   { 0x45, 0x24 },
+   { 0x55, 0x01 },
+   { 0x56, 0x01 },
+   { 0x57, 0xA5 },
+   { 0x58, 0x0A },
+   { 0x59, 0x4A },
+   { 0x5A, 0x38 },
+   { 0x5B, 0x10 },
+   { 0x5C, 0x19 },
+   { 0x5D, 0x7C },
+   { 0x5E, 0x64 },
+   { 0x5F, 0x54 },
+   { 0x60, 0x48 },
+   { 0x61, 0x44 },
+   { 0x62, 0x35 },
+   { 0x63, 0x3A },
+   { 0x64, 0x24 },
+   { 0x65, 0x3B },
+   { 0x66, 0x39 },
+   { 0x67, 0x37 },
+   { 0x68, 0x56 },
+   { 0x69, 0x41 },
+   { 0x6A, 0x47 },
+   { 0x6B, 0x2F },
+   { 0x6C, 0x23 },
+   { 0x6D, 0x13 },
+   { 0x6E, 0x02 },
+   { 0x6F, 0x08 },
+   { 0x70, 0x7C },
+   { 0x71, 0x64 },
+   { 0x72, 0x54 },
+   {