* [PATCH 0/3] drm/panel: add one more Leadtek panel, the ltk101b4029w
@ 2024-02-15 9:05 Heiko Stuebner
2024-02-15 9:05 ` [PATCH 1/3] drm/panel: ltk500hd1829: make room for more similar panels Heiko Stuebner
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Heiko Stuebner @ 2024-02-15 9:05 UTC (permalink / raw)
To: neil.armstrong
Cc: quic_jesszhan, sam, maarten.lankhorst, mripard, tzimmermann,
robh+dt, krzysztof.kozlowski+dt, conor+dt, heiko, dri-devel,
devicetree, linux-kernel, quentin.schulz
Similar in setup to the ltk500hd1829, group it with this driver.
Heiko Stuebner (3):
drm/panel: ltk500hd1829: make room for more similar panels
dt-bindings: display: ltk500hd1829: add variant compatible for
ltk101b4029w
drm/panel: ltk500hd1829: add panel type for ltk101b4029w
.../display/panel/leadtek,ltk500hd1829.yaml | 4 +-
.../drm/panel/panel-leadtek-ltk500hd1829.c | 265 ++++++++++++++++--
2 files changed, 244 insertions(+), 25 deletions(-)
--
2.39.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/3] drm/panel: ltk500hd1829: make room for more similar panels
2024-02-15 9:05 [PATCH 0/3] drm/panel: add one more Leadtek panel, the ltk101b4029w Heiko Stuebner
@ 2024-02-15 9:05 ` Heiko Stuebner
2024-02-15 16:25 ` Jessica Zhang
2024-02-15 9:05 ` [PATCH 2/3] dt-bindings: display: ltk500hd1829: add variant compatible for ltk101b4029w Heiko Stuebner
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Heiko Stuebner @ 2024-02-15 9:05 UTC (permalink / raw)
To: neil.armstrong
Cc: quic_jesszhan, sam, maarten.lankhorst, mripard, tzimmermann,
robh+dt, krzysztof.kozlowski+dt, conor+dt, heiko, dri-devel,
devicetree, linux-kernel, quentin.schulz, Heiko Stuebner
From: Heiko Stuebner <heiko.stuebner@cherry.de>
There exist more dsi-panels from Leadtek sharing supplies and timings
with only the panel-mode and init commands differing.
So make room in the driver to also keep variants here instead of
requiring additional drivers per panel.
Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
---
.../drm/panel/panel-leadtek-ltk500hd1829.c | 73 ++++++++++++-------
1 file changed, 47 insertions(+), 26 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
index 39e408c9f762f..42f4e2584af18 100644
--- a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
+++ b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
@@ -11,6 +11,7 @@
#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/of_device.h>
#include <linux/regulator/consumer.h>
#include <video/mipi_display.h>
@@ -21,25 +22,32 @@
#include <drm/drm_modes.h>
#include <drm/drm_panel.h>
+struct ltk500hd1829_cmd {
+ char cmd;
+ char data;
+};
+
+struct ltk500hd1829_desc {
+ const struct drm_display_mode *mode;
+ const struct ltk500hd1829_cmd *init;
+ unsigned int num_init;
+};
+
struct ltk500hd1829 {
struct device *dev;
struct drm_panel panel;
struct gpio_desc *reset_gpio;
struct regulator *vcc;
struct regulator *iovcc;
+ const struct ltk500hd1829_desc *panel_desc;
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[] = {
+static const struct ltk500hd1829_cmd ltk500hd1829_init[] = {
{ 0xE0, 0x00 },
{ 0xE1, 0x93 },
{ 0xE2, 0x65 },
@@ -260,6 +268,26 @@ static const struct ltk500hd1829_cmd init_code[] = {
{ 0x35, 0x00 },
};
+static const struct drm_display_mode ltk500hd1829_mode = {
+ .hdisplay = 720,
+ .hsync_start = 720 + 50,
+ .hsync_end = 720 + 50 + 50,
+ .htotal = 720 + 50 + 50 + 50,
+ .vdisplay = 1280,
+ .vsync_start = 1280 + 30,
+ .vsync_end = 1280 + 30 + 4,
+ .vtotal = 1280 + 30 + 4 + 12,
+ .clock = 69217,
+ .width_mm = 62,
+ .height_mm = 110,
+};
+
+static const struct ltk500hd1829_desc ltk500hd1829_data = {
+ .mode = <k500hd1829_mode,
+ .init = ltk500hd1829_init,
+ .num_init = ARRAY_SIZE(ltk500hd1829_init),
+};
+
static inline
struct ltk500hd1829 *panel_to_ltk500hd1829(struct drm_panel *panel)
{
@@ -324,8 +352,8 @@ static int ltk500hd1829_prepare(struct drm_panel *panel)
/* tRT: >= 5ms */
usleep_range(5000, 6000);
- for (i = 0; i < ARRAY_SIZE(init_code); i++) {
- ret = mipi_dsi_generic_write(dsi, &init_code[i],
+ for (i = 0; i < ctx->panel_desc->num_init; i++) {
+ ret = mipi_dsi_generic_write(dsi, &ctx->panel_desc->init[i],
sizeof(struct ltk500hd1829_cmd));
if (ret < 0) {
dev_err(panel->dev, "failed to write init cmds: %d\n", ret);
@@ -359,31 +387,17 @@ static int ltk500hd1829_prepare(struct drm_panel *panel)
return ret;
}
-static const struct drm_display_mode default_mode = {
- .hdisplay = 720,
- .hsync_start = 720 + 50,
- .hsync_end = 720 + 50 + 50,
- .htotal = 720 + 50 + 50 + 50,
- .vdisplay = 1280,
- .vsync_start = 1280 + 30,
- .vsync_end = 1280 + 30 + 4,
- .vtotal = 1280 + 30 + 4 + 12,
- .clock = 69217,
- .width_mm = 62,
- .height_mm = 110,
-};
-
static int ltk500hd1829_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct ltk500hd1829 *ctx = panel_to_ltk500hd1829(panel);
struct drm_display_mode *mode;
- mode = drm_mode_duplicate(connector->dev, &default_mode);
+ mode = drm_mode_duplicate(connector->dev, ctx->panel_desc->mode);
if (!mode) {
dev_err(ctx->dev, "failed to add mode %ux%u@%u\n",
- default_mode.hdisplay, default_mode.vdisplay,
- drm_mode_vrefresh(&default_mode));
+ ctx->panel_desc->mode->hdisplay, ctx->panel_desc->mode->vdisplay,
+ drm_mode_vrefresh(ctx->panel_desc->mode));
return -ENOMEM;
}
@@ -413,6 +427,10 @@ static int ltk500hd1829_probe(struct mipi_dsi_device *dsi)
if (!ctx)
return -ENOMEM;
+ ctx->panel_desc = of_device_get_match_data(dev);
+ if (!ctx->panel_desc)
+ return -EINVAL;
+
ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR(ctx->reset_gpio)) {
dev_err(dev, "cannot get reset gpio\n");
@@ -492,7 +510,10 @@ static void ltk500hd1829_remove(struct mipi_dsi_device *dsi)
}
static const struct of_device_id ltk500hd1829_of_match[] = {
- { .compatible = "leadtek,ltk500hd1829", },
+ {
+ .compatible = "leadtek,ltk500hd1829",
+ .data = <k500hd1829_data,
+ },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, ltk500hd1829_of_match);
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] dt-bindings: display: ltk500hd1829: add variant compatible for ltk101b4029w
2024-02-15 9:05 [PATCH 0/3] drm/panel: add one more Leadtek panel, the ltk101b4029w Heiko Stuebner
2024-02-15 9:05 ` [PATCH 1/3] drm/panel: ltk500hd1829: make room for more similar panels Heiko Stuebner
@ 2024-02-15 9:05 ` Heiko Stuebner
2024-02-15 17:06 ` Conor Dooley
2024-02-15 9:05 ` [PATCH 3/3] drm/panel: ltk500hd1829: add panel type " Heiko Stuebner
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Heiko Stuebner @ 2024-02-15 9:05 UTC (permalink / raw)
To: neil.armstrong
Cc: quic_jesszhan, sam, maarten.lankhorst, mripard, tzimmermann,
robh+dt, krzysztof.kozlowski+dt, conor+dt, heiko, dri-devel,
devicetree, linux-kernel, quentin.schulz, Heiko Stuebner
From: Heiko Stuebner <heiko.stuebner@cherry.de>
Add the compatible for the ltk101b4029w panel, that is really similar
to the ltk500hd1829.
Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
---
.../bindings/display/panel/leadtek,ltk500hd1829.yaml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml b/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml
index c5944b4d636c5..d589f16772145 100644
--- a/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml
+++ b/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml
@@ -14,7 +14,9 @@ allOf:
properties:
compatible:
- const: leadtek,ltk500hd1829
+ enum:
+ - leadtek,ltk101b4029w
+ - leadtek,ltk500hd1829
reg: true
backlight: true
reset-gpios: true
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] drm/panel: ltk500hd1829: add panel type for ltk101b4029w
2024-02-15 9:05 [PATCH 0/3] drm/panel: add one more Leadtek panel, the ltk101b4029w Heiko Stuebner
2024-02-15 9:05 ` [PATCH 1/3] drm/panel: ltk500hd1829: make room for more similar panels Heiko Stuebner
2024-02-15 9:05 ` [PATCH 2/3] dt-bindings: display: ltk500hd1829: add variant compatible for ltk101b4029w Heiko Stuebner
@ 2024-02-15 9:05 ` Heiko Stuebner
2024-02-15 16:30 ` Jessica Zhang
2024-02-15 9:40 ` [PATCH 0/3] drm/panel: add one more Leadtek panel, the ltk101b4029w Quentin Schulz
2024-02-16 22:51 ` Heiko Stuebner
4 siblings, 1 reply; 10+ messages in thread
From: Heiko Stuebner @ 2024-02-15 9:05 UTC (permalink / raw)
To: neil.armstrong
Cc: quic_jesszhan, sam, maarten.lankhorst, mripard, tzimmermann,
robh+dt, krzysztof.kozlowski+dt, conor+dt, heiko, dri-devel,
devicetree, linux-kernel, quentin.schulz, Heiko Stuebner
From: Heiko Stuebner <heiko.stuebner@cherry.de>
The ltk101b4029w ist a 10.1 inch DSI panel and shares the same supplies
and startup timings with the existing ltk500hd1829.
So simply add it as a variant with its own init sequence and display-mode.
Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
---
.../drm/panel/panel-leadtek-ltk500hd1829.c | 196 ++++++++++++++++++
1 file changed, 196 insertions(+)
diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
index 42f4e2584af18..7bc538b7c6b7c 100644
--- a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
+++ b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
@@ -43,6 +43,198 @@ struct ltk500hd1829 {
bool prepared;
};
+static const struct ltk500hd1829_cmd ltk101b4029w_init[] = {
+ /* Page0 */
+ { 0xE0, 0x00 },
+ /* PASSWORD */
+ { 0xE1, 0x93 },
+ { 0xE2, 0x65 },
+ { 0xE3, 0xF8 },
+ { 0x80, 0x03 }, /* 0X03:4-LANE; 0X02:3-LANE; 0X01:2-LANE */
+ /* Page1 */
+ { 0xE0, 0x01 },
+ /* Set VCOM */
+ { 0x00, 0x00 },
+ { 0x01, 0x6F },
+ /* Set Gamma Power, VGMP,VGMN,VGSP,VGSN */
+ { 0x17, 0x00 },
+ { 0x18, 0xAF }, /* 4.3V */
+ { 0x19, 0x01 }, /* 0.3V */
+ { 0x1A, 0x00 },
+ { 0x1B, 0xAF }, /* 4.3V */
+ { 0x1C, 0x01 }, /* 0.3V */
+ /* Set Gate Power */
+ { 0x1F, 0x3E }, /* VGH_R = 15V */
+ { 0x20, 0x28 }, /* VGL_R = -12V */
+ { 0x21, 0x28 }, /* VGL_R2 = -12V */
+ { 0x22, 0x7E },
+ /* SETPANEL */
+ { 0x35, 0x26 },
+ { 0x37, 0x09 },
+ /* SET RGBCYC */
+ { 0x38, 0x04 },
+ { 0x39, 0x00 },
+ { 0x3A, 0x01 },
+ { 0x3C, 0x7C },
+ { 0x3D, 0xFF },
+ { 0x3E, 0xFF },
+ { 0x3F, 0x7F },
+ /* Set TCON */
+ { 0x40, 0x06 }, /* RSO = 800 RGB */
+ { 0x41, 0xA0 }, /* LN = 640->1280 line */
+ { 0x42, 0x81 },
+ { 0x43, 0x08 }, /* VFP = 8 */
+ { 0x44, 0x0B }, /* VBP = 12 */
+ { 0x45, 0x28 }, /* HBP = 40 */
+ /* power voltage */
+ { 0x55, 0x0F }, /* DCDCM = 0001, JD PWR_IC */
+ { 0x57, 0x69 },
+ { 0x59, 0x0A }, /* VCL = -2.9V */
+ { 0x5A, 0x28 }, /* VGH = 15V */
+ { 0x5B, 0x14 }, /* VGL = -11V */
+ /* Gamma */
+ { 0x5D, 0x7C },
+ { 0x5E, 0x65 },
+ { 0x5F, 0x55 },
+ { 0x60, 0x47 },
+ { 0x61, 0x43 },
+ { 0x62, 0x32 },
+ { 0x63, 0x34 },
+ { 0x64, 0x1C },
+ { 0x65, 0x33 },
+ { 0x66, 0x31 },
+ { 0x67, 0x30 },
+ { 0x68, 0x4E },
+ { 0x69, 0x3C },
+ { 0x6A, 0x44 },
+ { 0x6B, 0x35 },
+ { 0x6C, 0x31 },
+ { 0x6D, 0x23 },
+ { 0x6E, 0x11 },
+ { 0x6F, 0x00 },
+ { 0x70, 0x7C },
+ { 0x71, 0x65 },
+ { 0x72, 0x55 },
+ { 0x73, 0x47 },
+ { 0x74, 0x43 },
+ { 0x75, 0x32 },
+ { 0x76, 0x34 },
+ { 0x77, 0x1C },
+ { 0x78, 0x33 },
+ { 0x79, 0x31 },
+ { 0x7A, 0x30 },
+ { 0x7B, 0x4E },
+ { 0x7C, 0x3C },
+ { 0x7D, 0x44 },
+ { 0x7E, 0x35 },
+ { 0x7F, 0x31 },
+ { 0x80, 0x23 },
+ { 0x81, 0x11 },
+ { 0x82, 0x00 },
+ /* Page2, for GIP */
+ { 0xE0, 0x02 },
+ /* GIP_L Pin mapping */
+ { 0x00, 0x1E },
+ { 0x01, 0x1E },
+ { 0x02, 0x41 },
+ { 0x03, 0x41 },
+ { 0x04, 0x43 },
+ { 0x05, 0x43 },
+ { 0x06, 0x1F },
+ { 0x07, 0x1F },
+ { 0x08, 0x35 },
+ { 0x09, 0x1F },
+ { 0x0A, 0x15 },
+ { 0x0B, 0x15 },
+ { 0x0C, 0x1F },
+ { 0x0D, 0x47 },
+ { 0x0E, 0x47 },
+ { 0x0F, 0x45 },
+ { 0x10, 0x45 },
+ { 0x11, 0x4B },
+ { 0x12, 0x4B },
+ { 0x13, 0x49 },
+ { 0x14, 0x49 },
+ { 0x15, 0x1F },
+ /* GIP_R Pin mapping */
+ { 0x16, 0x1E },
+ { 0x17, 0x1E },
+ { 0x18, 0x40 },
+ { 0x19, 0x40 },
+ { 0x1A, 0x42 },
+ { 0x1B, 0x42 },
+ { 0x1C, 0x1F },
+ { 0x1D, 0x1F },
+ { 0x1E, 0x35 },
+ { 0x1F, 0x1F },
+ { 0x20, 0x15 },
+ { 0x21, 0x15 },
+ { 0x22, 0x1f },
+ { 0x23, 0x46 },
+ { 0x24, 0x46 },
+ { 0x25, 0x44 },
+ { 0x26, 0x44 },
+ { 0x27, 0x4A },
+ { 0x28, 0x4A },
+ { 0x29, 0x48 },
+ { 0x2A, 0x48 },
+ { 0x2B, 0x1F },
+ /* GIP Timing */
+ { 0x58, 0x40 },
+ { 0x5B, 0x30 },
+ { 0x5C, 0x03 },
+ { 0x5D, 0x30 },
+ { 0x5E, 0x01 },
+ { 0x5F, 0x02 },
+ { 0x63, 0x14 },
+ { 0x64, 0x6A },
+ { 0x67, 0x73 },
+ { 0x68, 0x05 },
+ { 0x69, 0x14 },
+ { 0x6A, 0x6A },
+ { 0x6B, 0x08 },
+ { 0x6C, 0x00 },
+ { 0x6D, 0x00 },
+ { 0x6E, 0x00 },
+ { 0x6F, 0x88 },
+ { 0x77, 0xDD },
+ { 0x79, 0x0E },
+ { 0x7A, 0x03 },
+ { 0x7D, 0x14 },
+ { 0x7E, 0x6A },
+ /* Page4 */
+ { 0xE0, 0x04 },
+ { 0x09, 0x11 },
+ { 0x0E, 0x48 },
+ { 0x2B, 0x2B },
+ { 0x2D, 0x03 },
+ { 0x2E, 0x44 },
+ /* Page0 */
+ { 0xE0, 0x00 },
+ { 0xE6, 0x02 },
+ { 0xE7, 0x0C },
+};
+
+static const struct drm_display_mode ltk101b4029w_mode = {
+ .hdisplay = 800,
+ .hsync_start = 800 + 18,
+ .hsync_end = 800 + 18 + 18,
+ .htotal = 800 + 18 + 18 + 18,
+ .vdisplay = 1280,
+ .vsync_start = 1280 + 24,
+ .vsync_end = 1280 + 24 + 4,
+ .vtotal = 1280 + 24 + 4 + 8,
+ .clock = 67330,
+ .width_mm = 136,
+ .height_mm = 218,
+};
+
+static const struct ltk500hd1829_desc ltk101b4029w_data = {
+ .mode = <k101b4029w_mode,
+ .init = ltk101b4029w_init,
+ .num_init = ARRAY_SIZE(ltk101b4029w_init),
+};
+
/*
* There is no description in the Reference Manual about these commands.
* We received them from the vendor, so just use them as is.
@@ -510,6 +702,10 @@ static void ltk500hd1829_remove(struct mipi_dsi_device *dsi)
}
static const struct of_device_id ltk500hd1829_of_match[] = {
+ {
+ .compatible = "leadtek,ltk101b4029w",
+ .data = <k101b4029w_data,
+ },
{
.compatible = "leadtek,ltk500hd1829",
.data = <k500hd1829_data,
--
2.39.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] drm/panel: add one more Leadtek panel, the ltk101b4029w
2024-02-15 9:05 [PATCH 0/3] drm/panel: add one more Leadtek panel, the ltk101b4029w Heiko Stuebner
` (2 preceding siblings ...)
2024-02-15 9:05 ` [PATCH 3/3] drm/panel: ltk500hd1829: add panel type " Heiko Stuebner
@ 2024-02-15 9:40 ` Quentin Schulz
2024-02-16 22:51 ` Heiko Stuebner
4 siblings, 0 replies; 10+ messages in thread
From: Quentin Schulz @ 2024-02-15 9:40 UTC (permalink / raw)
To: Heiko Stuebner, neil.armstrong
Cc: quic_jesszhan, sam, maarten.lankhorst, mripard, tzimmermann,
robh+dt, krzysztof.kozlowski+dt, conor+dt, dri-devel, devicetree,
linux-kernel
Hi Heiko,
On 2/15/24 10:05, Heiko Stuebner wrote:
> Similar in setup to the ltk500hd1829, group it with this driver.
> > Heiko Stuebner (3):
> drm/panel: ltk500hd1829: make room for more similar panels
> dt-bindings: display: ltk500hd1829: add variant compatible for
> ltk101b4029w
> drm/panel: ltk500hd1829: add panel type for ltk101b4029w
>
For the whole series:
Reviewed-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
Thanks,
Quentin
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] drm/panel: ltk500hd1829: make room for more similar panels
2024-02-15 9:05 ` [PATCH 1/3] drm/panel: ltk500hd1829: make room for more similar panels Heiko Stuebner
@ 2024-02-15 16:25 ` Jessica Zhang
0 siblings, 0 replies; 10+ messages in thread
From: Jessica Zhang @ 2024-02-15 16:25 UTC (permalink / raw)
To: Heiko Stuebner, neil.armstrong
Cc: sam, maarten.lankhorst, mripard, tzimmermann, robh+dt,
krzysztof.kozlowski+dt, conor+dt, dri-devel, devicetree,
linux-kernel, quentin.schulz, Heiko Stuebner
On 2/15/2024 1:05 AM, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@cherry.de>
>
> There exist more dsi-panels from Leadtek sharing supplies and timings
> with only the panel-mode and init commands differing.
>
> So make room in the driver to also keep variants here instead of
> requiring additional drivers per panel.
>
> Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
Hi Heiko,
Reviewed-by: Jessica Zhang <quic_jesszhan@quicinc.com>
Thanks,
Jessica Zhang
> ---
> .../drm/panel/panel-leadtek-ltk500hd1829.c | 73 ++++++++++++-------
> 1 file changed, 47 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
> index 39e408c9f762f..42f4e2584af18 100644
> --- a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
> +++ b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
> @@ -11,6 +11,7 @@
> #include <linux/gpio/consumer.h>
> #include <linux/module.h>
> #include <linux/of.h>
> +#include <linux/of_device.h>
> #include <linux/regulator/consumer.h>
>
> #include <video/mipi_display.h>
> @@ -21,25 +22,32 @@
> #include <drm/drm_modes.h>
> #include <drm/drm_panel.h>
>
> +struct ltk500hd1829_cmd {
> + char cmd;
> + char data;
> +};
> +
> +struct ltk500hd1829_desc {
> + const struct drm_display_mode *mode;
> + const struct ltk500hd1829_cmd *init;
> + unsigned int num_init;
> +};
> +
> struct ltk500hd1829 {
> struct device *dev;
> struct drm_panel panel;
> struct gpio_desc *reset_gpio;
> struct regulator *vcc;
> struct regulator *iovcc;
> + const struct ltk500hd1829_desc *panel_desc;
> 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[] = {
> +static const struct ltk500hd1829_cmd ltk500hd1829_init[] = {
> { 0xE0, 0x00 },
> { 0xE1, 0x93 },
> { 0xE2, 0x65 },
> @@ -260,6 +268,26 @@ static const struct ltk500hd1829_cmd init_code[] = {
> { 0x35, 0x00 },
> };
>
> +static const struct drm_display_mode ltk500hd1829_mode = {
> + .hdisplay = 720,
> + .hsync_start = 720 + 50,
> + .hsync_end = 720 + 50 + 50,
> + .htotal = 720 + 50 + 50 + 50,
> + .vdisplay = 1280,
> + .vsync_start = 1280 + 30,
> + .vsync_end = 1280 + 30 + 4,
> + .vtotal = 1280 + 30 + 4 + 12,
> + .clock = 69217,
> + .width_mm = 62,
> + .height_mm = 110,
> +};
> +
> +static const struct ltk500hd1829_desc ltk500hd1829_data = {
> + .mode = <k500hd1829_mode,
> + .init = ltk500hd1829_init,
> + .num_init = ARRAY_SIZE(ltk500hd1829_init),
> +};
> +
> static inline
> struct ltk500hd1829 *panel_to_ltk500hd1829(struct drm_panel *panel)
> {
> @@ -324,8 +352,8 @@ static int ltk500hd1829_prepare(struct drm_panel *panel)
> /* tRT: >= 5ms */
> usleep_range(5000, 6000);
>
> - for (i = 0; i < ARRAY_SIZE(init_code); i++) {
> - ret = mipi_dsi_generic_write(dsi, &init_code[i],
> + for (i = 0; i < ctx->panel_desc->num_init; i++) {
> + ret = mipi_dsi_generic_write(dsi, &ctx->panel_desc->init[i],
> sizeof(struct ltk500hd1829_cmd));
> if (ret < 0) {
> dev_err(panel->dev, "failed to write init cmds: %d\n", ret);
> @@ -359,31 +387,17 @@ static int ltk500hd1829_prepare(struct drm_panel *panel)
> return ret;
> }
>
> -static const struct drm_display_mode default_mode = {
> - .hdisplay = 720,
> - .hsync_start = 720 + 50,
> - .hsync_end = 720 + 50 + 50,
> - .htotal = 720 + 50 + 50 + 50,
> - .vdisplay = 1280,
> - .vsync_start = 1280 + 30,
> - .vsync_end = 1280 + 30 + 4,
> - .vtotal = 1280 + 30 + 4 + 12,
> - .clock = 69217,
> - .width_mm = 62,
> - .height_mm = 110,
> -};
> -
> static int ltk500hd1829_get_modes(struct drm_panel *panel,
> struct drm_connector *connector)
> {
> struct ltk500hd1829 *ctx = panel_to_ltk500hd1829(panel);
> struct drm_display_mode *mode;
>
> - mode = drm_mode_duplicate(connector->dev, &default_mode);
> + mode = drm_mode_duplicate(connector->dev, ctx->panel_desc->mode);
> if (!mode) {
> dev_err(ctx->dev, "failed to add mode %ux%u@%u\n",
> - default_mode.hdisplay, default_mode.vdisplay,
> - drm_mode_vrefresh(&default_mode));
> + ctx->panel_desc->mode->hdisplay, ctx->panel_desc->mode->vdisplay,
> + drm_mode_vrefresh(ctx->panel_desc->mode));
> return -ENOMEM;
> }
>
> @@ -413,6 +427,10 @@ static int ltk500hd1829_probe(struct mipi_dsi_device *dsi)
> if (!ctx)
> return -ENOMEM;
>
> + ctx->panel_desc = of_device_get_match_data(dev);
> + if (!ctx->panel_desc)
> + return -EINVAL;
> +
> ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
> if (IS_ERR(ctx->reset_gpio)) {
> dev_err(dev, "cannot get reset gpio\n");
> @@ -492,7 +510,10 @@ static void ltk500hd1829_remove(struct mipi_dsi_device *dsi)
> }
>
> static const struct of_device_id ltk500hd1829_of_match[] = {
> - { .compatible = "leadtek,ltk500hd1829", },
> + {
> + .compatible = "leadtek,ltk500hd1829",
> + .data = <k500hd1829_data,
> + },
> { /* sentinel */ }
> };
> MODULE_DEVICE_TABLE(of, ltk500hd1829_of_match);
> --
> 2.39.2
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] drm/panel: ltk500hd1829: add panel type for ltk101b4029w
2024-02-15 9:05 ` [PATCH 3/3] drm/panel: ltk500hd1829: add panel type " Heiko Stuebner
@ 2024-02-15 16:30 ` Jessica Zhang
0 siblings, 0 replies; 10+ messages in thread
From: Jessica Zhang @ 2024-02-15 16:30 UTC (permalink / raw)
To: Heiko Stuebner, neil.armstrong
Cc: sam, maarten.lankhorst, mripard, tzimmermann, robh+dt,
krzysztof.kozlowski+dt, conor+dt, dri-devel, devicetree,
linux-kernel, quentin.schulz, Heiko Stuebner
On 2/15/2024 1:05 AM, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@cherry.de>
>
> The ltk101b4029w ist a 10.1 inch DSI panel and shares the same supplies
> and startup timings with the existing ltk500hd1829.
>
> So simply add it as a variant with its own init sequence and display-mode.
>
> Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
Hi Heiko,
Acked-by: Jessica Zhang <quic_jesszhan@quicinc.com>
Thanks,
Jessica Zhang
> ---
> .../drm/panel/panel-leadtek-ltk500hd1829.c | 196 ++++++++++++++++++
> 1 file changed, 196 insertions(+)
>
> diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
> index 42f4e2584af18..7bc538b7c6b7c 100644
> --- a/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
> +++ b/drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
> @@ -43,6 +43,198 @@ struct ltk500hd1829 {
> bool prepared;
> };
>
> +static const struct ltk500hd1829_cmd ltk101b4029w_init[] = {
> + /* Page0 */
> + { 0xE0, 0x00 },
> + /* PASSWORD */
> + { 0xE1, 0x93 },
> + { 0xE2, 0x65 },
> + { 0xE3, 0xF8 },
> + { 0x80, 0x03 }, /* 0X03:4-LANE; 0X02:3-LANE; 0X01:2-LANE */
> + /* Page1 */
> + { 0xE0, 0x01 },
> + /* Set VCOM */
> + { 0x00, 0x00 },
> + { 0x01, 0x6F },
> + /* Set Gamma Power, VGMP,VGMN,VGSP,VGSN */
> + { 0x17, 0x00 },
> + { 0x18, 0xAF }, /* 4.3V */
> + { 0x19, 0x01 }, /* 0.3V */
> + { 0x1A, 0x00 },
> + { 0x1B, 0xAF }, /* 4.3V */
> + { 0x1C, 0x01 }, /* 0.3V */
> + /* Set Gate Power */
> + { 0x1F, 0x3E }, /* VGH_R = 15V */
> + { 0x20, 0x28 }, /* VGL_R = -12V */
> + { 0x21, 0x28 }, /* VGL_R2 = -12V */
> + { 0x22, 0x7E },
> + /* SETPANEL */
> + { 0x35, 0x26 },
> + { 0x37, 0x09 },
> + /* SET RGBCYC */
> + { 0x38, 0x04 },
> + { 0x39, 0x00 },
> + { 0x3A, 0x01 },
> + { 0x3C, 0x7C },
> + { 0x3D, 0xFF },
> + { 0x3E, 0xFF },
> + { 0x3F, 0x7F },
> + /* Set TCON */
> + { 0x40, 0x06 }, /* RSO = 800 RGB */
> + { 0x41, 0xA0 }, /* LN = 640->1280 line */
> + { 0x42, 0x81 },
> + { 0x43, 0x08 }, /* VFP = 8 */
> + { 0x44, 0x0B }, /* VBP = 12 */
> + { 0x45, 0x28 }, /* HBP = 40 */
> + /* power voltage */
> + { 0x55, 0x0F }, /* DCDCM = 0001, JD PWR_IC */
> + { 0x57, 0x69 },
> + { 0x59, 0x0A }, /* VCL = -2.9V */
> + { 0x5A, 0x28 }, /* VGH = 15V */
> + { 0x5B, 0x14 }, /* VGL = -11V */
> + /* Gamma */
> + { 0x5D, 0x7C },
> + { 0x5E, 0x65 },
> + { 0x5F, 0x55 },
> + { 0x60, 0x47 },
> + { 0x61, 0x43 },
> + { 0x62, 0x32 },
> + { 0x63, 0x34 },
> + { 0x64, 0x1C },
> + { 0x65, 0x33 },
> + { 0x66, 0x31 },
> + { 0x67, 0x30 },
> + { 0x68, 0x4E },
> + { 0x69, 0x3C },
> + { 0x6A, 0x44 },
> + { 0x6B, 0x35 },
> + { 0x6C, 0x31 },
> + { 0x6D, 0x23 },
> + { 0x6E, 0x11 },
> + { 0x6F, 0x00 },
> + { 0x70, 0x7C },
> + { 0x71, 0x65 },
> + { 0x72, 0x55 },
> + { 0x73, 0x47 },
> + { 0x74, 0x43 },
> + { 0x75, 0x32 },
> + { 0x76, 0x34 },
> + { 0x77, 0x1C },
> + { 0x78, 0x33 },
> + { 0x79, 0x31 },
> + { 0x7A, 0x30 },
> + { 0x7B, 0x4E },
> + { 0x7C, 0x3C },
> + { 0x7D, 0x44 },
> + { 0x7E, 0x35 },
> + { 0x7F, 0x31 },
> + { 0x80, 0x23 },
> + { 0x81, 0x11 },
> + { 0x82, 0x00 },
> + /* Page2, for GIP */
> + { 0xE0, 0x02 },
> + /* GIP_L Pin mapping */
> + { 0x00, 0x1E },
> + { 0x01, 0x1E },
> + { 0x02, 0x41 },
> + { 0x03, 0x41 },
> + { 0x04, 0x43 },
> + { 0x05, 0x43 },
> + { 0x06, 0x1F },
> + { 0x07, 0x1F },
> + { 0x08, 0x35 },
> + { 0x09, 0x1F },
> + { 0x0A, 0x15 },
> + { 0x0B, 0x15 },
> + { 0x0C, 0x1F },
> + { 0x0D, 0x47 },
> + { 0x0E, 0x47 },
> + { 0x0F, 0x45 },
> + { 0x10, 0x45 },
> + { 0x11, 0x4B },
> + { 0x12, 0x4B },
> + { 0x13, 0x49 },
> + { 0x14, 0x49 },
> + { 0x15, 0x1F },
> + /* GIP_R Pin mapping */
> + { 0x16, 0x1E },
> + { 0x17, 0x1E },
> + { 0x18, 0x40 },
> + { 0x19, 0x40 },
> + { 0x1A, 0x42 },
> + { 0x1B, 0x42 },
> + { 0x1C, 0x1F },
> + { 0x1D, 0x1F },
> + { 0x1E, 0x35 },
> + { 0x1F, 0x1F },
> + { 0x20, 0x15 },
> + { 0x21, 0x15 },
> + { 0x22, 0x1f },
> + { 0x23, 0x46 },
> + { 0x24, 0x46 },
> + { 0x25, 0x44 },
> + { 0x26, 0x44 },
> + { 0x27, 0x4A },
> + { 0x28, 0x4A },
> + { 0x29, 0x48 },
> + { 0x2A, 0x48 },
> + { 0x2B, 0x1F },
> + /* GIP Timing */
> + { 0x58, 0x40 },
> + { 0x5B, 0x30 },
> + { 0x5C, 0x03 },
> + { 0x5D, 0x30 },
> + { 0x5E, 0x01 },
> + { 0x5F, 0x02 },
> + { 0x63, 0x14 },
> + { 0x64, 0x6A },
> + { 0x67, 0x73 },
> + { 0x68, 0x05 },
> + { 0x69, 0x14 },
> + { 0x6A, 0x6A },
> + { 0x6B, 0x08 },
> + { 0x6C, 0x00 },
> + { 0x6D, 0x00 },
> + { 0x6E, 0x00 },
> + { 0x6F, 0x88 },
> + { 0x77, 0xDD },
> + { 0x79, 0x0E },
> + { 0x7A, 0x03 },
> + { 0x7D, 0x14 },
> + { 0x7E, 0x6A },
> + /* Page4 */
> + { 0xE0, 0x04 },
> + { 0x09, 0x11 },
> + { 0x0E, 0x48 },
> + { 0x2B, 0x2B },
> + { 0x2D, 0x03 },
> + { 0x2E, 0x44 },
> + /* Page0 */
> + { 0xE0, 0x00 },
> + { 0xE6, 0x02 },
> + { 0xE7, 0x0C },
> +};
> +
> +static const struct drm_display_mode ltk101b4029w_mode = {
> + .hdisplay = 800,
> + .hsync_start = 800 + 18,
> + .hsync_end = 800 + 18 + 18,
> + .htotal = 800 + 18 + 18 + 18,
> + .vdisplay = 1280,
> + .vsync_start = 1280 + 24,
> + .vsync_end = 1280 + 24 + 4,
> + .vtotal = 1280 + 24 + 4 + 8,
> + .clock = 67330,
> + .width_mm = 136,
> + .height_mm = 218,
> +};
> +
> +static const struct ltk500hd1829_desc ltk101b4029w_data = {
> + .mode = <k101b4029w_mode,
> + .init = ltk101b4029w_init,
> + .num_init = ARRAY_SIZE(ltk101b4029w_init),
> +};
> +
> /*
> * There is no description in the Reference Manual about these commands.
> * We received them from the vendor, so just use them as is.
> @@ -510,6 +702,10 @@ static void ltk500hd1829_remove(struct mipi_dsi_device *dsi)
> }
>
> static const struct of_device_id ltk500hd1829_of_match[] = {
> + {
> + .compatible = "leadtek,ltk101b4029w",
> + .data = <k101b4029w_data,
> + },
> {
> .compatible = "leadtek,ltk500hd1829",
> .data = <k500hd1829_data,
> --
> 2.39.2
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] dt-bindings: display: ltk500hd1829: add variant compatible for ltk101b4029w
2024-02-15 9:05 ` [PATCH 2/3] dt-bindings: display: ltk500hd1829: add variant compatible for ltk101b4029w Heiko Stuebner
@ 2024-02-15 17:06 ` Conor Dooley
2024-02-15 21:17 ` Heiko Stübner
0 siblings, 1 reply; 10+ messages in thread
From: Conor Dooley @ 2024-02-15 17:06 UTC (permalink / raw)
To: Heiko Stuebner
Cc: neil.armstrong, quic_jesszhan, sam, maarten.lankhorst, mripard,
tzimmermann, robh+dt, krzysztof.kozlowski+dt, conor+dt,
dri-devel, devicetree, linux-kernel, quentin.schulz,
Heiko Stuebner
[-- Attachment #1: Type: text/plain, Size: 1301 bytes --]
On Thu, Feb 15, 2024 at 10:05:14AM +0100, Heiko Stuebner wrote:
> From: Heiko Stuebner <heiko.stuebner@cherry.de>
>
> Add the compatible for the ltk101b4029w panel, that is really similar
> to the ltk500hd1829.
Please mention what makes the devices incompatible. "really similar" is
vague and could be used for a device that was only cosmetically
different.
With that,
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Cheers,
Conor.
>
> Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
> ---
> .../bindings/display/panel/leadtek,ltk500hd1829.yaml | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml b/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml
> index c5944b4d636c5..d589f16772145 100644
> --- a/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml
> +++ b/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml
> @@ -14,7 +14,9 @@ allOf:
>
> properties:
> compatible:
> - const: leadtek,ltk500hd1829
> + enum:
> + - leadtek,ltk101b4029w
> + - leadtek,ltk500hd1829
> reg: true
> backlight: true
> reset-gpios: true
> --
> 2.39.2
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] dt-bindings: display: ltk500hd1829: add variant compatible for ltk101b4029w
2024-02-15 17:06 ` Conor Dooley
@ 2024-02-15 21:17 ` Heiko Stübner
0 siblings, 0 replies; 10+ messages in thread
From: Heiko Stübner @ 2024-02-15 21:17 UTC (permalink / raw)
To: Conor Dooley
Cc: neil.armstrong, quic_jesszhan, sam, maarten.lankhorst, mripard,
tzimmermann, robh+dt, krzysztof.kozlowski+dt, conor+dt,
dri-devel, devicetree, linux-kernel, quentin.schulz,
Heiko Stuebner
Am Donnerstag, 15. Februar 2024, 18:06:06 CET schrieb Conor Dooley:
> On Thu, Feb 15, 2024 at 10:05:14AM +0100, Heiko Stuebner wrote:
> > From: Heiko Stuebner <heiko.stuebner@cherry.de>
> >
> > Add the compatible for the ltk101b4029w panel, that is really similar
> > to the ltk500hd1829.
>
> Please mention what makes the devices incompatible. "really similar" is
> vague and could be used for a device that was only cosmetically
> different.
ok, I'll modify the paragraph to:
=======
Add the compatible for the ltk101b4029w panel, that has the same
manufacturer, general bringup and supplies but a different dsi-init-
sequence as the ltk500hd1829 .
=======
> With that,
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
>
> Cheers,
> Conor.
>
> >
> > Signed-off-by: Heiko Stuebner <heiko.stuebner@cherry.de>
> > ---
> > .../bindings/display/panel/leadtek,ltk500hd1829.yaml | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml b/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml
> > index c5944b4d636c5..d589f16772145 100644
> > --- a/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml
> > +++ b/Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml
> > @@ -14,7 +14,9 @@ allOf:
> >
> > properties:
> > compatible:
> > - const: leadtek,ltk500hd1829
> > + enum:
> > + - leadtek,ltk101b4029w
> > + - leadtek,ltk500hd1829
> > reg: true
> > backlight: true
> > reset-gpios: true
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/3] drm/panel: add one more Leadtek panel, the ltk101b4029w
2024-02-15 9:05 [PATCH 0/3] drm/panel: add one more Leadtek panel, the ltk101b4029w Heiko Stuebner
` (3 preceding siblings ...)
2024-02-15 9:40 ` [PATCH 0/3] drm/panel: add one more Leadtek panel, the ltk101b4029w Quentin Schulz
@ 2024-02-16 22:51 ` Heiko Stuebner
4 siblings, 0 replies; 10+ messages in thread
From: Heiko Stuebner @ 2024-02-16 22:51 UTC (permalink / raw)
To: Heiko Stuebner, neil.armstrong
Cc: conor+dt, quic_jesszhan, robh+dt, quentin.schulz, linux-kernel,
sam, krzysztof.kozlowski+dt, tzimmermann, devicetree, dri-devel,
mripard, maarten.lankhorst
On Thu, 15 Feb 2024 10:05:12 +0100, Heiko Stuebner wrote:
> Similar in setup to the ltk500hd1829, group it with this driver.
>
> Heiko Stuebner (3):
> drm/panel: ltk500hd1829: make room for more similar panels
> dt-bindings: display: ltk500hd1829: add variant compatible for
> ltk101b4029w
> drm/panel: ltk500hd1829: add panel type for ltk101b4029w
>
> [...]
Applied, thanks!
Adapted the commit message in the binding patch to show
where the panels are similar but also different (init-sequence)
[1/3] drm/panel: ltk500hd1829: make room for more similar panels
commit: f9488c160d6e8e5e548452a0d36057a1f8c04045
[2/3] dt-bindings: display: ltk500hd1829: add variant compatible for ltk101b4029w
commit: c71efc6337135670164334404ef11506b31b7a81
[3/3] drm/panel: ltk500hd1829: add panel type for ltk101b4029w
commit: 239cce651ea617002ff26f068f2568b2baf6421a
Best regards,
--
Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2024-02-16 22:51 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-15 9:05 [PATCH 0/3] drm/panel: add one more Leadtek panel, the ltk101b4029w Heiko Stuebner
2024-02-15 9:05 ` [PATCH 1/3] drm/panel: ltk500hd1829: make room for more similar panels Heiko Stuebner
2024-02-15 16:25 ` Jessica Zhang
2024-02-15 9:05 ` [PATCH 2/3] dt-bindings: display: ltk500hd1829: add variant compatible for ltk101b4029w Heiko Stuebner
2024-02-15 17:06 ` Conor Dooley
2024-02-15 21:17 ` Heiko Stübner
2024-02-15 9:05 ` [PATCH 3/3] drm/panel: ltk500hd1829: add panel type " Heiko Stuebner
2024-02-15 16:30 ` Jessica Zhang
2024-02-15 9:40 ` [PATCH 0/3] drm/panel: add one more Leadtek panel, the ltk101b4029w Quentin Schulz
2024-02-16 22:51 ` Heiko Stuebner
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.