[PATCH 0/4] Add support for Saef SFTO340XC panel.

2025-04-09 Thread Kory Maincent
Add support for Saef Technology Limited SFTO340XC LCD panel.
Add alongside the number of lanes configuration in the ili9881c driver
as the board on my desc use the panel with only two lanes.

Signed-off-by: Kory Maincent 
---
Kory Maincent (4):
  dt-bindings: display: panel: ili9881c: Add dsi-lanes property
  drm/panel: ilitek-ili9881c: Add support for two-lane configuration
  dt-bindings: ili9881c: Add Saef SFTO340XC support
  drm: panel: Add Saef SFTO340XC LCD panel

 .../bindings/display/panel/ilitek,ili9881c.yaml|   6 +
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c  | 267 -
 2 files changed, 271 insertions(+), 2 deletions(-)
---
base-commit: 0af2f6be1b4281385b618cb86ad946eded089ac8
change-id: 20250129-feature_sfto340xc-d2b25a5b5748

Best regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com



[PATCH 4/4] drm: panel: Add Saef SFTO340XC LCD panel

2025-04-08 Thread Kory Maincent
Add support for Saef Technology Limited SFTO340XC LCD panel.

Signed-off-by: Kory Maincent 
---
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 232 ++
 1 file changed, 232 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c 
b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index 
5c429715159755df2461063dad0971642e2b9041..8ea837ff3f7ad1f4b8ba5f2e9f50472a16afcbae
 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -43,6 +43,7 @@ struct ili9881c_desc {
const struct drm_display_mode *mode;
const unsigned long mode_flags;
u8 default_address_mode;
+   const unsigned int msleep_delay;
 };
 
 struct ili9881c {
@@ -457,6 +458,207 @@ static const struct ili9881c_instr k101_im2byl02_init[] = 
{
ILI9881C_COMMAND_INSTR(0xD3, 0x3F), /* VN0 */
 };
 
+static const struct ili9881c_instr sfto340xc_init[] = {
+   ILI9881C_SWITCH_PAGE_INSTR(3),
+   ILI9881C_COMMAND_INSTR(0x01, 0x00),
+   ILI9881C_COMMAND_INSTR(0x02, 0x01),
+   ILI9881C_COMMAND_INSTR(0x03, 0x73),
+   ILI9881C_COMMAND_INSTR(0x04, 0x03),
+   ILI9881C_COMMAND_INSTR(0x05, 0x00),
+   ILI9881C_COMMAND_INSTR(0x06, 0x0A),
+   ILI9881C_COMMAND_INSTR(0x07, 0x05),
+   ILI9881C_COMMAND_INSTR(0x08, 0x00),
+   ILI9881C_COMMAND_INSTR(0x09, 0x40),
+   ILI9881C_COMMAND_INSTR(0x0a, 0x00),
+   ILI9881C_COMMAND_INSTR(0x0B, 0x00),
+   ILI9881C_COMMAND_INSTR(0x0C, 0x00),
+   ILI9881C_COMMAND_INSTR(0x0D, 0x40),
+   ILI9881C_COMMAND_INSTR(0x0E, 0x00),
+   ILI9881C_COMMAND_INSTR(0x0f, 0x3c),
+   ILI9881C_COMMAND_INSTR(0x10, 0x3c),
+   ILI9881C_COMMAND_INSTR(0x11, 0x00),
+   ILI9881C_COMMAND_INSTR(0x12, 0x00),
+   ILI9881C_COMMAND_INSTR(0x13, 0x00),
+   ILI9881C_COMMAND_INSTR(0x14, 0x00),
+   ILI9881C_COMMAND_INSTR(0x15, 0x00),
+   ILI9881C_COMMAND_INSTR(0x16, 0x00),
+   ILI9881C_COMMAND_INSTR(0x17, 0x00),
+   ILI9881C_COMMAND_INSTR(0x18, 0x00),
+   ILI9881C_COMMAND_INSTR(0x19, 0x00),
+   ILI9881C_COMMAND_INSTR(0x1A, 0x00),
+   ILI9881C_COMMAND_INSTR(0x1B, 0x00),
+   ILI9881C_COMMAND_INSTR(0x1C, 0x00),
+   ILI9881C_COMMAND_INSTR(0x1D, 0x00),
+   ILI9881C_COMMAND_INSTR(0x1E, 0xC0),
+   ILI9881C_COMMAND_INSTR(0x1F, 0x80),
+   ILI9881C_COMMAND_INSTR(0x20, 0x06),
+   ILI9881C_COMMAND_INSTR(0x21, 0x01),
+   ILI9881C_COMMAND_INSTR(0x22, 0x00),
+   ILI9881C_COMMAND_INSTR(0x23, 0x00),
+   ILI9881C_COMMAND_INSTR(0x24, 0x00),
+   ILI9881C_COMMAND_INSTR(0x25, 0x00),
+   ILI9881C_COMMAND_INSTR(0x26, 0x00),
+   ILI9881C_COMMAND_INSTR(0x27, 0x00),
+   ILI9881C_COMMAND_INSTR(0x28, 0xB3),
+   ILI9881C_COMMAND_INSTR(0x29, 0x03),
+   ILI9881C_COMMAND_INSTR(0x2A, 0x00),
+   ILI9881C_COMMAND_INSTR(0x2B, 0x00),
+   ILI9881C_COMMAND_INSTR(0x2C, 0x00),
+   ILI9881C_COMMAND_INSTR(0x2D, 0x00),
+   ILI9881C_COMMAND_INSTR(0x2E, 0x00),
+   ILI9881C_COMMAND_INSTR(0x2F, 0x00),
+   ILI9881C_COMMAND_INSTR(0x30, 0x00),
+   ILI9881C_COMMAND_INSTR(0x31, 0x00),
+   ILI9881C_COMMAND_INSTR(0x32, 0x00),
+   ILI9881C_COMMAND_INSTR(0x33, 0x00),
+   ILI9881C_COMMAND_INSTR(0x34, 0x23),
+   ILI9881C_COMMAND_INSTR(0x35, 0x00),
+   ILI9881C_COMMAND_INSTR(0x36, 0x00),
+   ILI9881C_COMMAND_INSTR(0x37, 0x08),
+   ILI9881C_COMMAND_INSTR(0x38, 0x3C),
+   ILI9881C_COMMAND_INSTR(0x39, 0x00),
+   ILI9881C_COMMAND_INSTR(0x3A, 0x00),
+   ILI9881C_COMMAND_INSTR(0x3B, 0x00),
+   ILI9881C_COMMAND_INSTR(0x3C, 0x00),
+   ILI9881C_COMMAND_INSTR(0x3D, 0x00),
+   ILI9881C_COMMAND_INSTR(0x3E, 0x00),
+   ILI9881C_COMMAND_INSTR(0x3F, 0x00),
+   ILI9881C_COMMAND_INSTR(0x40, 0x00),
+   ILI9881C_COMMAND_INSTR(0x41, 0x00),
+   ILI9881C_COMMAND_INSTR(0x42, 0x00),
+   ILI9881C_COMMAND_INSTR(0x43, 0x00),
+   ILI9881C_COMMAND_INSTR(0x44, 0x00),
+   ILI9881C_COMMAND_INSTR(0x50, 0x01),
+   ILI9881C_COMMAND_INSTR(0x51, 0x23),
+   ILI9881C_COMMAND_INSTR(0x52, 0x44),
+   ILI9881C_COMMAND_INSTR(0x53, 0x67),
+   ILI9881C_COMMAND_INSTR(0x54, 0x89),
+   ILI9881C_COMMAND_INSTR(0x55, 0xAB),
+   ILI9881C_COMMAND_INSTR(0x56, 0x01),
+   ILI9881C_COMMAND_INSTR(0x57, 0x23),
+   ILI9881C_COMMAND_INSTR(0x58, 0x45),
+   ILI9881C_COMMAND_INSTR(0x59, 0x67),
+   ILI9881C_COMMAND_INSTR(0x5A, 0x89),
+   ILI9881C_COMMAND_INSTR(0x5B, 0xAB),
+   ILI9881C_COMMAND_INSTR(0x5C, 0xCD),
+   ILI9881C_COMMAND_INSTR(0x5D, 0xEF),
+   ILI9881C_COMMAND_INSTR(0x5E, 0x01),
+   ILI9881C_COMMAND_INSTR(0x5F, 0x00),
+   ILI9881C_COMMAND_INSTR(0x60, 0x00),
+   ILI9881C_COMMAND_INSTR(0x61, 0x01),
+   ILI9881C_COMMAND_INSTR(0x62, 0x01),
+   ILI9881C_COMMAND_INSTR(0x63, 0x08),
+   ILI9881C_COMMAND_INSTR(0x64, 0x0E),
+   ILI9881C_COMMAND_INSTR(0x65, 0x0E),
+   ILI9881C_COMMAND_INSTR(0x66, 0x0F

[PATCH 2/4] drm/panel: ilitek-ili9881c: Add support for two-lane configuration

2025-04-08 Thread Kory Maincent
Enable support for two-lane configuration which is done by setting the
LANSEL_SW_EN and LANSEL_SW bits in the Pad Control register.

Use the dsi-lanes device tree parameter to configure the number of lanes.
The default configuration remains set to four lanes.

Signed-off-by: Kory Maincent 
---
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 35 +--
 1 file changed, 33 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c 
b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index 
28cd7560e5db1d5734b10babdb4e4e553c6e07d0..5c429715159755df2461063dad0971642e2b9041
 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -1263,6 +1263,21 @@ static int ili9881c_send_cmd_data(struct ili9881c *ctx, 
u8 cmd, u8 data)
return 0;
 }
 
+static int ili9881c_set_lanes_cfg(struct ili9881c *ctx)
+{
+   int ret;
+
+   if (ctx->dsi->lanes != 2)
+   /* Nothing to do */
+   return 0;
+
+   ret = ili9881c_switch_page(ctx, 1);
+   if (ret)
+   return ret;
+
+   return ili9881c_send_cmd_data(ctx, 0xB7, 0x3);
+}
+
 static int ili9881c_prepare(struct drm_panel *panel)
 {
struct ili9881c *ctx = panel_to_ili9881c(panel);
@@ -1295,6 +1310,10 @@ static int ili9881c_prepare(struct drm_panel *panel)
return ret;
}
 
+   ret = ili9881c_set_lanes_cfg(ctx);
+   if (ret)
+   return ret;
+
ret = ili9881c_switch_page(ctx, 0);
if (ret)
return ret;
@@ -1504,7 +1523,7 @@ static const struct drm_panel_funcs ili9881c_funcs = {
 static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
 {
struct ili9881c *ctx;
-   int ret;
+   int ret, lanes;
 
ctx = devm_kzalloc(&dsi->dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx)
@@ -1545,11 +1564,23 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device 
*dsi)
if (ret)
return ret;
 
+   ret = of_property_read_u32(dsi->dev.of_node, "dsi-lanes", &lanes);
+   if (ret == -EINVAL) {
+   lanes = 4;
+   } else if (ret) {
+   dev_err(&dsi->dev, "Failed to get dsi-lanes property (%d)\n",
+   ret);
+   return ret;
+   } else if (lanes < 2 || 4 < lanes) {
+   dev_err(&dsi->dev, "Wrong number of dsi-lanes (%d)\n", lanes);
+   return -EINVAL;
+   }
+
drm_panel_add(&ctx->panel);
 
dsi->mode_flags = ctx->desc->mode_flags;
dsi->format = MIPI_DSI_FMT_RGB888;
-   dsi->lanes = 4;
+   dsi->lanes = lanes;
 
return mipi_dsi_attach(dsi);
 }

-- 
2.34.1



[PATCH 1/4] dt-bindings: display: panel: ili9881c: Add dsi-lanes property

2025-04-08 Thread Kory Maincent
Add the dsi-lanes property to specify the number of DSI lanes used by the
panel. This allows configuring the panel for either two, three or four
lanes.

Signed-off-by: Kory Maincent 
---
 Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml | 5 +
 1 file changed, 5 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml 
b/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml
index 
baf5dfe5f5ebdd92f460a78d0e56e1b45e7dd323..e36550616f6aac86c79832a48132ce8c11ebcf7a
 100644
--- a/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml
+++ b/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml
@@ -27,6 +27,11 @@ properties:
   reg:
 maxItems: 1
 
+  dsi-lanes:
+description: Number of DSI lanes to be used must be <2>, <3> or <4>
+$ref: /schemas/types.yaml#/definitions/uint32
+enum: [2, 3, 4]
+
   backlight: true
   power-supply: true
   reset-gpios: true

-- 
2.34.1



[PATCH 3/4] dt-bindings: ili9881c: Add Saef SFTO340XC support

2025-04-08 Thread Kory Maincent
Document the compatible value for Saef SFTO340XC panels.

Signed-off-by: Kory Maincent 
---
 Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml 
b/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml
index 
e36550616f6aac86c79832a48132ce8c11ebcf7a..7e47564cf1f18a9ea9e64deded7a7edbff133406
 100644
--- a/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml
+++ b/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml
@@ -19,6 +19,7 @@ properties:
   - ampire,am8001280g
   - bananapi,lhr050h41
   - feixin,k101-im2byl02
+  - saef,sfto340xc
   - startek,kd050hdfia020
   - tdo,tl050hdv35
   - wanchanglong,w552946aba

-- 
2.34.1



Re: [PATCH 1/4] dt-bindings: display: panel: ili9881c: Add dsi-lanes property

2025-04-09 Thread Kory Maincent
On Tue, 8 Apr 2025 17:44:32 +0200
Maxime Ripard  wrote:

> hi,
> 
> On Tue, Apr 08, 2025 at 05:27:00PM +0200, Kory Maincent wrote:
> > Add the dsi-lanes property to specify the number of DSI lanes used by the
> > panel. This allows configuring the panel for either two, three or four
> > lanes.
> > 
> > Signed-off-by: Kory Maincent 
> > ---
> >  Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml | 5
> > + 1 file changed, 5 insertions(+)
> > 
> > diff --git
> > a/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml
> > b/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml
> > index
> > baf5dfe5f5ebdd92f460a78d0e56e1b45e7dd323..e36550616f6aac86c79832a48132ce8c11ebcf7a
> > 100644 ---
> > a/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml +++
> > b/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml @@
> > -27,6 +27,11 @@ properties: reg: maxItems: 1 
> > +  dsi-lanes:
> > +description: Number of DSI lanes to be used must be <2>, <3> or <4>
> > +$ref: /schemas/types.yaml#/definitions/uint32
> > +enum: [2, 3, 4]
> > +  
> 
> We have the data-lanes property for that already

Indeed but there is no such usage in panel bindings, only in bridge bindings.

You are saying that I should add something like that:
  port:
$ref: /schemas/graph.yaml#/properties/port

properties: 
  endpoint: 
$ref: /schemas/media/video-interfaces.yaml# 
unevaluatedProperties: false

data-lanes:
  minItems: 2
  maxItems: 4   

And use drm_of_get_data_lanes_count in the drivers.

If we do so, maybe this binding should land in panel-common.yaml instead?

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com


[PATCH RFC v2 3/5] drm/panel: ilitek-ili9881c: Add support for two-lane configuration

2025-04-24 Thread Kory Maincent
Enable support for two-lane configuration which is done by setting the
LANSEL_SW_EN and LANSEL_SW bits in the Pad Control register.

Use the data-lanes device tree parameter to configure the number of lanes.
The default configuration remains set to four lanes.

Signed-off-by: Kory Maincent 
---

Change in v2:
- Read the data-lanes parameter from the port endpoint and use
  drm_of_get_data_lanes_count instead of of_property_read_u32.
---
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 33 +--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c 
b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index 
28cd7560e5db1d5734b10babdb4e4e553c6e07d0..2e38dea28336f445cb6a074dbbec006f0659287a
 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -16,6 +16,7 @@
 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -1263,6 +1264,21 @@ static int ili9881c_send_cmd_data(struct ili9881c *ctx, 
u8 cmd, u8 data)
return 0;
 }
 
+static int ili9881c_set_lanes_cfg(struct ili9881c *ctx)
+{
+   int ret;
+
+   if (ctx->dsi->lanes != 2)
+   /* Nothing to do */
+   return 0;
+
+   ret = ili9881c_switch_page(ctx, 1);
+   if (ret)
+   return ret;
+
+   return ili9881c_send_cmd_data(ctx, 0xB7, 0x3);
+}
+
 static int ili9881c_prepare(struct drm_panel *panel)
 {
struct ili9881c *ctx = panel_to_ili9881c(panel);
@@ -1295,6 +1311,10 @@ static int ili9881c_prepare(struct drm_panel *panel)
return ret;
}
 
+   ret = ili9881c_set_lanes_cfg(ctx);
+   if (ret)
+   return ret;
+
ret = ili9881c_switch_page(ctx, 0);
if (ret)
return ret;
@@ -1503,8 +1523,9 @@ static const struct drm_panel_funcs ili9881c_funcs = {
 
 static int ili9881c_dsi_probe(struct mipi_dsi_device *dsi)
 {
+   struct device_node *endpoint;
struct ili9881c *ctx;
-   int ret;
+   int ret, lanes;
 
ctx = devm_kzalloc(&dsi->dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx)
@@ -1545,11 +1566,19 @@ static int ili9881c_dsi_probe(struct mipi_dsi_device 
*dsi)
if (ret)
return ret;
 
+   endpoint = of_graph_get_endpoint_by_regs(dsi->dev.of_node, -1, -1);
+   lanes = drm_of_get_data_lanes_count(endpoint, 2, 4);
+   of_node_put(endpoint);
+   if (lanes == -EINVAL)
+   lanes = 4;
+   else if (lanes < 0)
+   return lanes;
+
drm_panel_add(&ctx->panel);
 
dsi->mode_flags = ctx->desc->mode_flags;
dsi->format = MIPI_DSI_FMT_RGB888;
-   dsi->lanes = 4;
+   dsi->lanes = lanes;
 
return mipi_dsi_attach(dsi);
 }

-- 
2.34.1



[PATCH RFC v2 4/5] dt-bindings: ili9881c: Add Saef SFTO340XC support

2025-04-24 Thread Kory Maincent
Document the compatible value for Saef SFTO340XC panels.

Signed-off-by: Kory Maincent 
---
 Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml 
b/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml
index 
3a897e464178dfc8a7c70e0fafb51184c50a520b..1e6845454e23bb37f1f7adffd99cd17a5effe68e
 100644
--- a/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml
+++ b/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml
@@ -19,6 +19,7 @@ properties:
   - ampire,am8001280g
   - bananapi,lhr050h41
   - feixin,k101-im2byl02
+  - saef,sfto340xc
   - startek,kd050hdfia020
   - tdo,tl050hdv35
   - wanchanglong,w552946aba

-- 
2.34.1



[PATCH RFC v2 5/5] drm: panel: Add Saef SFTO340XC LCD panel

2025-04-24 Thread Kory Maincent
Add support for Saef Technology Limited SFTO340XC LCD panel.

Signed-off-by: Kory Maincent 
---
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c | 232 ++
 1 file changed, 232 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c 
b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
index 
2e38dea28336f445cb6a074dbbec006f0659287a..574d2dad873474ffa02d554aff9d62c63e070d99
 100644
--- a/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
+++ b/drivers/gpu/drm/panel/panel-ilitek-ili9881c.c
@@ -44,6 +44,7 @@ struct ili9881c_desc {
const struct drm_display_mode *mode;
const unsigned long mode_flags;
u8 default_address_mode;
+   const unsigned int msleep_delay;
 };
 
 struct ili9881c {
@@ -458,6 +459,207 @@ static const struct ili9881c_instr k101_im2byl02_init[] = 
{
ILI9881C_COMMAND_INSTR(0xD3, 0x3F), /* VN0 */
 };
 
+static const struct ili9881c_instr sfto340xc_init[] = {
+   ILI9881C_SWITCH_PAGE_INSTR(3),
+   ILI9881C_COMMAND_INSTR(0x01, 0x00),
+   ILI9881C_COMMAND_INSTR(0x02, 0x01),
+   ILI9881C_COMMAND_INSTR(0x03, 0x73),
+   ILI9881C_COMMAND_INSTR(0x04, 0x03),
+   ILI9881C_COMMAND_INSTR(0x05, 0x00),
+   ILI9881C_COMMAND_INSTR(0x06, 0x0A),
+   ILI9881C_COMMAND_INSTR(0x07, 0x05),
+   ILI9881C_COMMAND_INSTR(0x08, 0x00),
+   ILI9881C_COMMAND_INSTR(0x09, 0x40),
+   ILI9881C_COMMAND_INSTR(0x0a, 0x00),
+   ILI9881C_COMMAND_INSTR(0x0B, 0x00),
+   ILI9881C_COMMAND_INSTR(0x0C, 0x00),
+   ILI9881C_COMMAND_INSTR(0x0D, 0x40),
+   ILI9881C_COMMAND_INSTR(0x0E, 0x00),
+   ILI9881C_COMMAND_INSTR(0x0f, 0x3c),
+   ILI9881C_COMMAND_INSTR(0x10, 0x3c),
+   ILI9881C_COMMAND_INSTR(0x11, 0x00),
+   ILI9881C_COMMAND_INSTR(0x12, 0x00),
+   ILI9881C_COMMAND_INSTR(0x13, 0x00),
+   ILI9881C_COMMAND_INSTR(0x14, 0x00),
+   ILI9881C_COMMAND_INSTR(0x15, 0x00),
+   ILI9881C_COMMAND_INSTR(0x16, 0x00),
+   ILI9881C_COMMAND_INSTR(0x17, 0x00),
+   ILI9881C_COMMAND_INSTR(0x18, 0x00),
+   ILI9881C_COMMAND_INSTR(0x19, 0x00),
+   ILI9881C_COMMAND_INSTR(0x1A, 0x00),
+   ILI9881C_COMMAND_INSTR(0x1B, 0x00),
+   ILI9881C_COMMAND_INSTR(0x1C, 0x00),
+   ILI9881C_COMMAND_INSTR(0x1D, 0x00),
+   ILI9881C_COMMAND_INSTR(0x1E, 0xC0),
+   ILI9881C_COMMAND_INSTR(0x1F, 0x80),
+   ILI9881C_COMMAND_INSTR(0x20, 0x06),
+   ILI9881C_COMMAND_INSTR(0x21, 0x01),
+   ILI9881C_COMMAND_INSTR(0x22, 0x00),
+   ILI9881C_COMMAND_INSTR(0x23, 0x00),
+   ILI9881C_COMMAND_INSTR(0x24, 0x00),
+   ILI9881C_COMMAND_INSTR(0x25, 0x00),
+   ILI9881C_COMMAND_INSTR(0x26, 0x00),
+   ILI9881C_COMMAND_INSTR(0x27, 0x00),
+   ILI9881C_COMMAND_INSTR(0x28, 0xB3),
+   ILI9881C_COMMAND_INSTR(0x29, 0x03),
+   ILI9881C_COMMAND_INSTR(0x2A, 0x00),
+   ILI9881C_COMMAND_INSTR(0x2B, 0x00),
+   ILI9881C_COMMAND_INSTR(0x2C, 0x00),
+   ILI9881C_COMMAND_INSTR(0x2D, 0x00),
+   ILI9881C_COMMAND_INSTR(0x2E, 0x00),
+   ILI9881C_COMMAND_INSTR(0x2F, 0x00),
+   ILI9881C_COMMAND_INSTR(0x30, 0x00),
+   ILI9881C_COMMAND_INSTR(0x31, 0x00),
+   ILI9881C_COMMAND_INSTR(0x32, 0x00),
+   ILI9881C_COMMAND_INSTR(0x33, 0x00),
+   ILI9881C_COMMAND_INSTR(0x34, 0x23),
+   ILI9881C_COMMAND_INSTR(0x35, 0x00),
+   ILI9881C_COMMAND_INSTR(0x36, 0x00),
+   ILI9881C_COMMAND_INSTR(0x37, 0x08),
+   ILI9881C_COMMAND_INSTR(0x38, 0x3C),
+   ILI9881C_COMMAND_INSTR(0x39, 0x00),
+   ILI9881C_COMMAND_INSTR(0x3A, 0x00),
+   ILI9881C_COMMAND_INSTR(0x3B, 0x00),
+   ILI9881C_COMMAND_INSTR(0x3C, 0x00),
+   ILI9881C_COMMAND_INSTR(0x3D, 0x00),
+   ILI9881C_COMMAND_INSTR(0x3E, 0x00),
+   ILI9881C_COMMAND_INSTR(0x3F, 0x00),
+   ILI9881C_COMMAND_INSTR(0x40, 0x00),
+   ILI9881C_COMMAND_INSTR(0x41, 0x00),
+   ILI9881C_COMMAND_INSTR(0x42, 0x00),
+   ILI9881C_COMMAND_INSTR(0x43, 0x00),
+   ILI9881C_COMMAND_INSTR(0x44, 0x00),
+   ILI9881C_COMMAND_INSTR(0x50, 0x01),
+   ILI9881C_COMMAND_INSTR(0x51, 0x23),
+   ILI9881C_COMMAND_INSTR(0x52, 0x44),
+   ILI9881C_COMMAND_INSTR(0x53, 0x67),
+   ILI9881C_COMMAND_INSTR(0x54, 0x89),
+   ILI9881C_COMMAND_INSTR(0x55, 0xAB),
+   ILI9881C_COMMAND_INSTR(0x56, 0x01),
+   ILI9881C_COMMAND_INSTR(0x57, 0x23),
+   ILI9881C_COMMAND_INSTR(0x58, 0x45),
+   ILI9881C_COMMAND_INSTR(0x59, 0x67),
+   ILI9881C_COMMAND_INSTR(0x5A, 0x89),
+   ILI9881C_COMMAND_INSTR(0x5B, 0xAB),
+   ILI9881C_COMMAND_INSTR(0x5C, 0xCD),
+   ILI9881C_COMMAND_INSTR(0x5D, 0xEF),
+   ILI9881C_COMMAND_INSTR(0x5E, 0x01),
+   ILI9881C_COMMAND_INSTR(0x5F, 0x00),
+   ILI9881C_COMMAND_INSTR(0x60, 0x00),
+   ILI9881C_COMMAND_INSTR(0x61, 0x01),
+   ILI9881C_COMMAND_INSTR(0x62, 0x01),
+   ILI9881C_COMMAND_INSTR(0x63, 0x08),
+   ILI9881C_COMMAND_INSTR(0x64, 0x0E),
+   ILI9881C_COMMAND_INSTR(0x65, 0x0E),
+   ILI9881C_COMMAND_INSTR(0x66, 0x0F

[PATCH RFC v2 0/5] Add support for Saef SFTO340XC panel.

2025-04-24 Thread Kory Maincent
Add support for Saef Technology Limited SFTO340XC LCD panel.
Add alongside the number of lanes configuration in the ili9881c driver
as the board on my desc use the panel with only two lanes.

Faced an issue with panel-common binding. Wrote a fix (first patch) but not
sure it is the right one. If someone from dt tree could take a look, it
would be nice.

Signed-off-by: Kory Maincent 
---
Changes in v2:
- Add new patch trying to fix panel-common binding.
- Read the data-lanes parameter from the port endpoint and use
  drm_of_get_data_lanes_count instead of of_property_read_u32.
- Link to v1: 
https://lore.kernel.org/r/20250408-feature_sfto340xc-v1-0-f303d1b9a...@bootlin.com

---
Kory Maincent (5):
  dt-bindings: display: panel: Fix port binding
  dt-bindings: display: panel: ili9881c: Add data-lanes property
  drm/panel: ilitek-ili9881c: Add support for two-lane configuration
  dt-bindings: ili9881c: Add Saef SFTO340XC support
  drm: panel: Add Saef SFTO340XC LCD panel

 .../bindings/display/panel/ilitek,ili9881c.yaml|  21 ++
 .../bindings/display/panel/panel-common.yaml   |   2 +-
 drivers/gpu/drm/panel/panel-ilitek-ili9881c.c  | 265 -
 3 files changed, 285 insertions(+), 3 deletions(-)
---
base-commit: bef4f1156b74721b7d14538659031119b6f2
change-id: 20250129-feature_sfto340xc-d2b25a5b5748

Best regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com



[PATCH RFC v2 2/5] dt-bindings: display: panel: ili9881c: Add data-lanes property

2025-04-24 Thread Kory Maincent
Add the data-lanes property to specify the number of DSI lanes used by the
panel. This allows configuring the panel for either two, three or four
lanes.

At the same time, extend the devicetree example with an endpoint node for
better clarity.

Signed-off-by: Kory Maincent 
---

Change in v2:
- Use data-lanes property from video-interfaces.yaml
- Add endpoint description example
---
 .../bindings/display/panel/ilitek,ili9881c.yaml  | 20 
 1 file changed, 20 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml 
b/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml
index 
baf5dfe5f5ebdd92f460a78d0e56e1b45e7dd323..3a897e464178dfc8a7c70e0fafb51184c50a520b
 100644
--- a/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml
+++ b/Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.yaml
@@ -27,6 +27,20 @@ properties:
   reg:
 maxItems: 1
 
+  port:
+$ref: /schemas/graph.yaml#/$defs/port-base
+unevaluatedProperties: false
+
+properties:
+  endpoint:
+$ref: /schemas/media/video-interfaces.yaml#
+unevaluatedProperties: false
+
+properties:
+  data-lanes:
+minItems: 1
+maxItems: 4
+
   backlight: true
   power-supply: true
   reset-gpios: true
@@ -53,6 +67,12 @@ examples:
 power-supply = <®_display>;
 reset-gpios = <&r_pio 0 5 GPIO_ACTIVE_LOW>; /* PL05 */
 backlight = <&pwm_bl>;
+port {
+panel_in: endpoint {
+remote-endpoint = <&dsi_out>;
+data-lanes = <1 2>;
+};
+};
 };
 };
 

-- 
2.34.1



[PATCH RFC v2 1/5] dt-bindings: display: panel: Fix port binding

2025-04-24 Thread Kory Maincent
Faced a binding error check while adding the data-lanes property in the
ilitek,ili9881c binding. See the next patch for the binding changes.
Here is the error:
Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.example.dtb:
panel@0: port:endpoint: Unevaluated properties are not allowed
('data-lanes' was unexpected)

Change the reference of properties/port to $defs/port-base to makes it
work.
The only difference between port and port-base is the unevaluatedProperty
set to false. I have tried to use properties/port in both panel-common
and ilitek,ili9881c bindings but the error is still there. The only way
to not face the error is to use $defs/port-base reference. I don't
really understand the ins and outs, maybe it is a issue from the binding
check tool.

Signed-off-by: Kory Maincent 
---

Changes in v2:
- New patch
---
 Documentation/devicetree/bindings/display/panel/panel-common.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/display/panel/panel-common.yaml 
b/Documentation/devicetree/bindings/display/panel/panel-common.yaml
index 
087415753d606ce67bceabaa9b0ba7d463282f92..635f67ced0cb7103684a1415ab740d83409a7dbb
 100644
--- a/Documentation/devicetree/bindings/display/panel/panel-common.yaml
+++ b/Documentation/devicetree/bindings/display/panel/panel-common.yaml
@@ -76,7 +76,7 @@ properties:
 
   # Connectivity
   port:
-$ref: /schemas/graph.yaml#/properties/port
+$ref: /schemas/graph.yaml#/$defs/port-base
 
   ddc-i2c-bus:
 $ref: /schemas/types.yaml#/definitions/phandle

-- 
2.34.1



Re: [PATCH RFC v2 1/5] dt-bindings: display: panel: Fix port binding

2025-04-28 Thread Kory Maincent
On Mon, 28 Apr 2025 09:32:21 +0200
Krzysztof Kozlowski  wrote:

> On Thu, Apr 24, 2025 at 05:07:39PM GMT, Kory Maincent wrote:
> > Faced a binding error check while adding the data-lanes property in the
> > ilitek,ili9881c binding. See the next patch for the binding changes.
> > Here is the error:
> > Documentation/devicetree/bindings/display/panel/ilitek,ili9881c.example.dtb:
> > panel@0: port:endpoint: Unevaluated properties are not allowed
> > ('data-lanes' was unexpected)  
> 
> There is no error at this point so your rationale is not correct. You
> cannot use possible error as reason to fix something... You can use
> instead other arguments that the binding is incomplete or incorrect.

As I have said in the cover letter, I faced this error and this patch fixed it
but I didn't get the ins and outs.
Indeed, I didn't understand the conflict between the port definition in
panel-common and the panel binding change from the 2nd patch.

> > Change the reference of properties/port to $defs/port-base to makes it
> > work.
> > The only difference between port and port-base is the unevaluatedProperty
> > set to false. I have tried to use properties/port in both panel-common
> > and ilitek,ili9881c bindings but the error is still there. The only way
> > to not face the error is to use $defs/port-base reference. I don't
> > really understand the ins and outs, maybe it is a issue from the binding
> > check tool.
> > 
> > Signed-off-by: Kory Maincent 
> > ---
> > 
> > Changes in v2:
> > - New patch
> > ---
> >  Documentation/devicetree/bindings/display/panel/panel-common.yaml | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git
> > a/Documentation/devicetree/bindings/display/panel/panel-common.yaml
> > b/Documentation/devicetree/bindings/display/panel/panel-common.yaml index
> > 087415753d606ce67bceabaa9b0ba7d463282f92..635f67ced0cb7103684a1415ab740d83409a7dbb
> > 100644 ---
> > a/Documentation/devicetree/bindings/display/panel/panel-common.yaml +++
> > b/Documentation/devicetree/bindings/display/panel/panel-common.yaml @@
> > -76,7 +76,7 @@ properties: # Connectivity port:
> > -$ref: /schemas/graph.yaml#/properties/port
> > +$ref: /schemas/graph.yaml#/$defs/port-base  
> 
> This allows anything in the port in every other binding, so is not
> correct. You need to fully describe the port here with
> additionalProps:false, probably. Just like every other binding with
> port-base is doing.

Yeah that was expected.
As I said I tried with port-base but it throw me this error and I didn't manage
to remove it with only the panel binding change for now.

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com