Skip to contentSkip to conversation

drm: panel: add support for panels used in LG P880/P895

PATCH Superseded Svyatoslav Ryhel 3 participants 9 messages Apr 13, 2025 – Apr 16, 2025

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover drm: panel: add support for panels used in LG P880/P895

Add support for panels used in LG P880/P895 which are based on Renesas IC (not related to Renesas RISC-V architecture just the same manufacturer).

Maxim Schwalm (1):
drm: panel: Add support for Renesas R69328 based MIPI DSI panel

Svyatoslav Ryhel (3):
dt-bindings: display: panel: Document Renesas R61307 based DSI panel
drm: panel: Add support for Renesas R61307 based MIPI DSI panel
dt-bindings: display: panel: Document Renesas R69328 based DSI panel

 .../display/panel/renesas,r61307.yaml         |  93 +++++
 .../display/panel/renesas,r69328.yaml         |  72 ++++
 drivers/gpu/drm/panel/Kconfig                 |  26 ++
 drivers/gpu/drm/panel/Makefile                |   2 +
 drivers/gpu/drm/panel/panel-renesas-r61307.c  | 326 ++++++++++++++++++
 drivers/gpu/drm/panel/panel-renesas-r69328.c  | 282 +++++++++++++++
 6 files changed, 801 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml
 create mode 100644 Documentation/devicetree/bindings/display/panel/renesas,r69328.yaml
 create mode 100644 drivers/gpu/drm/panel/panel-renesas-r61307.c
 create mode 100644 drivers/gpu/drm/panel/panel-renesas-r69328.c
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/4 dt-bindings: display: panel: Document Renesas R61307 based DSI panel

R61307 is liquid crystal driver for high-definition amorphous silicon (a-Si) panels and is ideal for tablets and smartphones.

---
 .../display/panel/renesas,r61307.yaml         | 93 +++++++++++++++++++
 1 file changed, 93 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml
Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml new file +93 -0
new file mode 100644
index 000000000000..a98d2d2e02d2
@@ -0,0 +1,93 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/renesas,r61307.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas R61307 based DSI Display Panel
+
+maintainers:
+  - Svyatoslav Ryhel <[email protected]>
+
+description:
+  The Renesas R61307 is a generic DSI Panel IC used to control LCD panels.
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+  compatible:
+    enum:
+        # KOE/HITACHI TX13D100VM0EAA 5.0" XGA TFT LCD panel
+      - hit,tx13d100vm0eaa
+      - koe,tx13d100vm0eaa
+
+  reg:
+    maxItems: 1
+
+  vcc-supply:
+    description: Regulator for main power supply.
+
+  iovcc-supply:
+    description: Regulator for 1.8V IO power supply.
+
+  backlight: true
+
+  renesas,gamma:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      0 - disabled
+      1-3 - gamma setting A presets
+    enum: [0, 1, 2, 3]
+
+  renesas,inversion:
+    type: boolean
+    description: switch between line and column inversion. The line
+      inversion is set by default.
+
+  renesas,contrast:
+    type: boolean
+    description: digital contrast adjustment
+
+  reset-gpios: true
+  port: true
+
+required:
+  - compatible
+  - port
+  - backlight
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    dsi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        panel@1 {
+            compatible = "koe,tx13d100vm0eaa";
+            reg = <1>;
+
+            reset-gpios = <&gpio 176 GPIO_ACTIVE_LOW>;
+
+            renesas,gamma = <3>;
+            renesas,inversion;
+            renesas,contrast;
+
+            vcc-supply = <&vcc_3v0_lcd>;
+            iovcc-supply = <&iovcc_1v8_lcd>;
+
+            backlight = <&backlight>;
+
+            port {
+                panel_in: endpoint {
+                    remote-endpoint = <&dsi_out>;
+                };
+            };
+        };
+    };
+
+...
Signature · 1 line
2.43.0
maintainer
#2 lore raw

Re: [PATCH v1 1/4] dt-bindings: display: panel: Document Renesas R61307 based DSI panel

Quoted 28 lines · Svyatoslav Ryhel

R61307 is liquid crystal driver for high-definition amorphous silicon (a-Si) panels and is ideal for tablets and smartphones.

---
 .../display/panel/renesas,r61307.yaml         | 93 +++++++++++++++++++
 1 file changed, 93 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml
Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml new file +13 -0
new file mode 100644
index 000000000000..a98d2d2e02d2
@@ -0,0 +1,93 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/renesas,r61307.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas R61307 based DSI Display Panel
+
+maintainers:
+  - Svyatoslav Ryhel <[email protected]>
+
+description:
+  The Renesas R61307 is a generic DSI Panel IC used to control LCD panels.

Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml line 23

Quoted 10 lines
Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml new file +10 -0
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+  compatible:
+    enum:
+        # KOE/HITACHI TX13D100VM0EAA 5.0" XGA TFT LCD panel
+      - hit,tx13d100vm0eaa
+      - koe,tx13d100vm0eaa

Usuually when the display IC is known, there's a fallback compatible for it. Then 'renesas' vendor prefix on the properties makes more sense.

Quoted 13 lines
Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml new file +13 -0
+
+  reg:
+    maxItems: 1
+
+  vcc-supply:
+    description: Regulator for main power supply.
+
+  iovcc-supply:
+    description: Regulator for 1.8V IO power supply.
+
+  backlight: true
+
+  renesas,gamma:

Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml line 46

Quoted 10 lines
Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml new file +10 -0
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      0 - disabled
+      1-3 - gamma setting A presets
+    enum: [0, 1, 2, 3]
+
+  renesas,inversion:
+    type: boolean
+    description: switch between line and column inversion. The line
+      inversion is set by default.

The property name is odd since there's always some sort of inversion. Perhaps renesas,column-inversion?

Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml line 50

Quoted 4 lines
Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml new file +4 -0
+
+  renesas,contrast:
+    type: boolean
+    description: digital contrast adjustment

I would have expected contrast to be more than boolean. Is this something any a-Si panel would support or somehow Renesas specific?

Quoted 46 lines
Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml new file +43 -0
+
+  reset-gpios: true
+  port: true
+
+required:
+  - compatible
+  - port
+  - backlight
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    dsi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        panel@1 {
+            compatible = "koe,tx13d100vm0eaa";
+            reg = <1>;
+
+            reset-gpios = <&gpio 176 GPIO_ACTIVE_LOW>;
+
+            renesas,gamma = <3>;
+            renesas,inversion;
+            renesas,contrast;
+
+            vcc-supply = <&vcc_3v0_lcd>;
+            iovcc-supply = <&iovcc_1v8_lcd>;
+
+            backlight = <&backlight>;
+
+            port {
+                panel_in: endpoint {
+                    remote-endpoint = <&dsi_out>;
+                };
+            };
+        };
+    };
+
+...
Signature · 1 line
2.43.0
#3 lore raw

Re: [PATCH v1 1/4] dt-bindings: display: panel: Document Renesas R61307 based DSI panel

ср, 16 квіт. 2025 р. о 00:55 Rob Herring <[email protected]> пише:

Quoted 35 lines · Svyatoslav Ryhel
Quoted 33 lines

R61307 is liquid crystal driver for high-definition amorphous silicon (a-Si) panels and is ideal for tablets and smartphones.

---
 .../display/panel/renesas,r61307.yaml         | 93 +++++++++++++++++++
 1 file changed, 93 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml
Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml new file +18 -0
new file mode 100644
index 000000000000..a98d2d2e02d2
@@ -0,0 +1,93 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/renesas,r61307.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas R61307 based DSI Display Panel
+
+maintainers:
+  - Svyatoslav Ryhel <[email protected]>
+
+description:
+  The Renesas R61307 is a generic DSI Panel IC used to control LCD panels.
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
Quoted 9 lines

Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml line 23

Quoted 5 lines
Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml new file +5 -0
+  compatible:
+    enum:
+        # KOE/HITACHI TX13D100VM0EAA 5.0" XGA TFT LCD panel
+      - hit,tx13d100vm0eaa
+      - koe,tx13d100vm0eaa

Usuually when the display IC is known, there's a fallback compatible for it. Then 'renesas' vendor prefix on the properties makes more sense.

Acknowledged, thank you.

Quoted 18 lines
Quoted 18 lines
Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml new file +18 -0
+
+  reg:
+    maxItems: 1
+
+  vcc-supply:
+    description: Regulator for main power supply.
+
+  iovcc-supply:
+    description: Regulator for 1.8V IO power supply.
+
+  backlight: true
+
+  renesas,gamma:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      0 - disabled
+      1-3 - gamma setting A presets
+    enum: [0, 1, 2, 3]
Quoted 9 lines

Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml line 46

Quoted 5 lines
Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml new file +5 -0
+
+  renesas,inversion:
+    type: boolean
+    description: switch between line and column inversion. The line
+      inversion is set by default.

The property name is odd since there's always some sort of inversion. Perhaps renesas,column-inversion?

Acknowledged, thank you.

Quoted 8 lines

Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml line 50

Quoted 4 lines
Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml new file +4 -0
+
+  renesas,contrast:
+    type: boolean
+    description: digital contrast adjustment

I would have expected contrast to be more than boolean. Is this something any a-Si panel would support or somehow Renesas specific?

ATM there is only one known set of commands regards digital contrast adjustment and it application is optional, hence bool. However, panel which my device uses refuses to work properly without this configuration applied. Since there is no specific programming guide regards this IC I cannot say for sure if this is panel specific or a Renesas IC feature. When/if there will be any additional data available this property can by adjusted or dropped.

Quoted 46 lines
Quoted 46 lines
Documentation/devicetree/bindings/display/panel/renesas,r61307.yaml new file +43 -1
+
+  reset-gpios: true
+  port: true
+
+required:
+  - compatible
+  - port
+  - backlight
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    dsi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        panel@1 {
+            compatible = "koe,tx13d100vm0eaa";
+            reg = <1>;
+
+            reset-gpios = <&gpio 176 GPIO_ACTIVE_LOW>;
+
+            renesas,gamma = <3>;
+            renesas,inversion;
+            renesas,contrast;
+
+            vcc-supply = <&vcc_3v0_lcd>;
+            iovcc-supply = <&iovcc_1v8_lcd>;
+
+            backlight = <&backlight>;
+
+            port {
+                panel_in: endpoint {
+                    remote-endpoint = <&dsi_out>;
+                };
+            };
+        };
+    };
+
+...
--

2.43.0

#4 lore raw

PATCH 2/4 drm: panel: Add support for Renesas R61307 based MIPI DSI panel

In reply to Svyatoslav Ryhel

R61307 is liquid crystal driver for high-definition amorphous silicon (a-Si) panels and is ideal for tablets and smartphones.

Supported compatibles are:
- hit,tx13d100vm0eaa
- koe,tx13d100vm0eaa

---
 drivers/gpu/drm/panel/Kconfig                |  13 +
 drivers/gpu/drm/panel/Makefile               |   1 +
 drivers/gpu/drm/panel/panel-renesas-r61307.c | 326 +++++++++++++++++++
 3 files changed, 340 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-renesas-r61307.c
drivers/gpu/drm/panel/Kconfig +13 -0
index d7469c565d1d..e8723f42cafb 100644
@@ -605,6 +605,19 @@ config DRM_PANEL_RAYDIUM_RM69380
 	  This panel controller can be found in the Lenovo Xiaoxin Pad Pro 2021
 	  in combination with an EDO OLED panel.
 
+config DRM_PANEL_RENESAS_R61307
+	tristate "Renesas R61307 DSI video mode 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 KOE tx13d100vm0eaa
+	  IPS-LCD module with Renesas R69328 IC. The panel has a 1024x768
+	  resolution and uses 24 bit RGB per pixel.
+
+	  This panel controller can be found in LG Optimus Vu P895 smartphone
+	  in combination with LCD panel.
+
 config DRM_PANEL_RONBO_RB070D30
 	tristate "Ronbo Electronics RB070D30 panel"
 	depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
index 7dcf72646cac..61d8853df1a7 100644
@@ -61,6 +61,7 @@ obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM67191) += panel-raydium-rm67191.o
 obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o
 obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM692E5) += panel-raydium-rm692e5.o
 obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM69380) += panel-raydium-rm69380.o
+obj-$(CONFIG_DRM_PANEL_RENESAS_R61307) += panel-renesas-r61307.o
 obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMS581VF01) += panel-samsung-ams581vf01.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMS639RQ08) += panel-samsung-ams639rq08.o
drivers/gpu/drm/panel/panel-renesas-r61307.c new file +326 -0

326 lines not on this page · raw message

Signature · 1 line
2.43.0
#5 lore raw

PATCH 3/4 dt-bindings: display: panel: Document Renesas R69328 based DSI panel

In reply to Svyatoslav Ryhel

R69328 is liquid crystal driver for high-definition amorphous silicon (a-Si) panels and is ideal for tablets and smartphones.

---
 .../display/panel/renesas,r69328.yaml         | 72 +++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/display/panel/renesas,r69328.yaml
Documentation/devicetree/bindings/display/panel/renesas,r69328.yaml new file +72 -0
new file mode 100644
index 000000000000..1c1ce5ed6f2f
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/panel/renesas,r69328.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas R69328 based DSI Display Panel
+
+maintainers:
+  - Svyatoslav Ryhel <[email protected]>
+
+description:
+  The Renesas R69328 is a generic DSI Panel IC used to control LCD panels.
+
+allOf:
+  - $ref: panel-common.yaml#
+
+properties:
+  compatible:
+    enum:
+        # JDI DX12D100VM0EAA 4.7" WXGA TFT LCD panel
+      - jdi,dx12d100vm0eaa
+
+  reg:
+    maxItems: 1
+
+  vdd-supply:
+    description: Regulator for main power supply.
+
+  vddio-supply:
+    description: Regulator for 1.8V IO power supply.
+
+  backlight: true
+
+  reset-gpios: true
+  port: true
+
+required:
+  - compatible
+  - port
+  - backlight
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    dsi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        panel@1 {
+            compatible = "jdi,dx12d100vm0eaa";
+            reg = <1>;
+
+            reset-gpios = <&gpio 176 GPIO_ACTIVE_LOW>;
+
+            vdd-supply = <&vdd_3v0_lcd>;
+            vddio-supply = <&vdd_1v8_io>;
+
+            backlight = <&backlight>;
+
+            port {
+                panel_in: endpoint {
+                    remote-endpoint = <&dsi_out>;
+                };
+            };
+        };
+    };
+
+...
Signature · 1 line
2.43.0
#6 lore raw

PATCH 4/4 drm: panel: Add support for Renesas R69328 based MIPI DSI panel

In reply to Svyatoslav Ryhel

From: Maxim Schwalm <[email protected]>

Driver adds support for panels with Renesas R69328 IC

Currently supported compatible is:
- jdi,dx12d100vm0eaa

---
 drivers/gpu/drm/panel/Kconfig                |  13 +
 drivers/gpu/drm/panel/Makefile               |   1 +
 drivers/gpu/drm/panel/panel-renesas-r69328.c | 282 +++++++++++++++++++
 3 files changed, 296 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-renesas-r69328.c
drivers/gpu/drm/panel/Kconfig +13 -0
index e8723f42cafb..86c66f818a11 100644
@@ -618,6 +618,19 @@ config DRM_PANEL_RENESAS_R61307
 	  This panel controller can be found in LG Optimus Vu P895 smartphone
 	  in combination with LCD panel.
 
+config DRM_PANEL_RENESAS_R69328
+	tristate "Renesas R69328 720x1280 DSI video mode 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 JDI dx12d100vm0eaa
+	  IPS-LCD module with Renesas R69328 IC. The panel has a 720x1280
+	  resolution and uses 24 bit RGB per pixel.
+
+	  This panel controller can be found in LG Optimus 4X P895 smartphone
+	  in combination with LCD panel.
+
 config DRM_PANEL_RONBO_RB070D30
 	tristate "Ronbo Electronics RB070D30 panel"
 	depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
index 61d8853df1a7..37e4e13165a9 100644
@@ -62,6 +62,7 @@ obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o
 obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM692E5) += panel-raydium-rm692e5.o
 obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM69380) += panel-raydium-rm69380.o
 obj-$(CONFIG_DRM_PANEL_RENESAS_R61307) += panel-renesas-r61307.o
+obj-$(CONFIG_DRM_PANEL_RENESAS_R69328) += panel-renesas-r69328.o
 obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMS581VF01) += panel-samsung-ams581vf01.o
 obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMS639RQ08) += panel-samsung-ams639rq08.o
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +282 -0

282 lines not on this page · raw message

Signature · 1 line
2.43.0
#7 lore raw

Re: [PATCH v1 4/4] drm: panel: Add support for Renesas R69328 based MIPI DSI panel

Quoted 59 lines · Svyatoslav Ryhel

From: Maxim Schwalm <[email protected]>

Driver adds support for panels with Renesas R69328 IC

Currently supported compatible is:
- jdi,dx12d100vm0eaa

---
  drivers/gpu/drm/panel/Kconfig                |  13 +
  drivers/gpu/drm/panel/Makefile               |   1 +
  drivers/gpu/drm/panel/panel-renesas-r69328.c | 282 +++++++++++++++++++
  3 files changed, 296 insertions(+)

create mode 100644 drivers/gpu/drm/panel/panel-renesas-r69328.c

drivers/gpu/drm/panel/Kconfig +13 -0
index e8723f42cafb..86c66f818a11 100644
@@ -618,6 +618,19 @@ config DRM_PANEL_RENESAS_R61307
  	  This panel controller can be found in LG Optimus Vu P895 smartphone
  	  in combination with LCD panel.
 
+config DRM_PANEL_RENESAS_R69328
+	tristate "Renesas R69328 720x1280 DSI video mode 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 JDI dx12d100vm0eaa
+	  IPS-LCD module with Renesas R69328 IC. The panel has a 720x1280
+	  resolution and uses 24 bit RGB per pixel.
+
+	  This panel controller can be found in LG Optimus 4X P895 smartphone
+	  in combination with LCD panel.
+
  config DRM_PANEL_RONBO_RB070D30
  	tristate "Ronbo Electronics RB070D30 panel"
  	depends on OF
drivers/gpu/drm/panel/Makefile +1 -0
index 61d8853df1a7..37e4e13165a9 100644
@@ -62,6 +62,7 @@ obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM68200) += panel-raydium-rm68200.o
  obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM692E5) += panel-raydium-rm692e5.o
  obj-$(CONFIG_DRM_PANEL_RAYDIUM_RM69380) += panel-raydium-rm69380.o
  obj-$(CONFIG_DRM_PANEL_RENESAS_R61307) += panel-renesas-r61307.o
+obj-$(CONFIG_DRM_PANEL_RENESAS_R69328) += panel-renesas-r69328.o
  obj-$(CONFIG_DRM_PANEL_RONBO_RB070D30) += panel-ronbo-rb070d30.o
  obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMS581VF01) += panel-samsung-ams581vf01.o
  obj-$(CONFIG_DRM_PANEL_SAMSUNG_AMS639RQ08) += panel-samsung-ams639rq08.o
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +0 -0
new file mode 100644
index 000000000000..207067b29473

drivers/gpu/drm/panel/panel-renesas-r69328.c line 1

Quoted 1 line
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +1 -0
@@ -0,0 +1,282 @@
+// SPDX-License-Identifier: GPL-2.0

add Blank line

Quoted 8 lines
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +8 -0
+#include <linux/array_size.h>
+#include <linux/delay.h>
+#include <linux/err.h>
+#include <linux/gpio/consumer.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/property.h>
+#include <linux/regulator/consumer.h>

drivers/gpu/drm/panel/panel-renesas-r69328.c line 19

Quoted 10 lines
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +10 -0
+
+#include <video/mipi_display.h>
+
+#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_modes.h>
+#include <drm/drm_panel.h>
+
+#define R69328_MACP		0xb0 /* Manufacturer Access CMD Protect */
+#define   R69328_MACP_ON	0x03
+#define   R69328_MACP_OFF	0x04

remove extra ' ' after #define

Quoted 49 lines
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +49 -0
+
+#define R69328_GAMMA_SET_A	0xc8 /* Gamma Setting A */
+#define R69328_GAMMA_SET_B	0xc9 /* Gamma Setting B */
+#define R69328_GAMMA_SET_C	0xca /* Gamma Setting C */
+
+#define R69328_POWER_SET	0xd1
+
+struct renesas_r69328 {
+	struct drm_panel panel;
+	struct mipi_dsi_device *dsi;
+
+	struct regulator *vdd_supply;
+	struct regulator *vddio_supply;
+	struct gpio_desc *reset_gpio;
+
+	bool prepared;
+};
+
+static inline struct renesas_r69328 *to_renesas_r69328(struct drm_panel *panel)
+{
+	return container_of(panel, struct renesas_r69328, panel);
+}
+
+static void renesas_r69328_reset(struct renesas_r69328 *priv)
+{
+	gpiod_set_value_cansleep(priv->reset_gpio, 1);
+	usleep_range(10000, 11000);
+	gpiod_set_value_cansleep(priv->reset_gpio, 0);
+	usleep_range(2000, 3000);
+}
+
+static int renesas_r69328_prepare(struct drm_panel *panel)
+{
+	struct renesas_r69328 *priv = to_renesas_r69328(panel);
+	struct device *dev = &priv->dsi->dev;
+	int ret;
+
+	if (priv->prepared)
+		return 0;
+
+	ret = regulator_enable(priv->vdd_supply);
+	if (ret) {
+		dev_err(dev, "failed to enable vdd power supply\n");
+		return ret;
+	}
+
+	usleep_range(10000, 11000);
+
+	ret = regulator_enable(priv->vddio_supply);

drivers/gpu/drm/panel/panel-renesas-r69328.c line 78

Quoted 10 lines
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +10 -0
+	if (ret < 0) {
+		dev_err(dev, "failed to enable vddio power supply\n");
+		return ret;
+	}
+
+	usleep_range(10000, 11000);
+
+	renesas_r69328_reset(priv);
+
+	priv->prepared = true;

a '\n' before return

Quoted 65 lines
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +65 -0
+	return 0;
+}
+
+static int renesas_r69328_enable(struct drm_panel *panel)
+{
+	struct renesas_r69328 *priv = to_renesas_r69328(panel);
+	struct mipi_dsi_multi_context ctx = { .dsi = priv->dsi };
+
+	/* Set address mode */
+	mipi_dsi_dcs_write_seq_multi(&ctx, MIPI_DCS_SET_ADDRESS_MODE, 0x00);
+	mipi_dsi_dcs_set_pixel_format_multi(&ctx, MIPI_DCS_PIXEL_FMT_24BIT << 4);
+	mipi_dsi_dcs_exit_sleep_mode_multi(&ctx);
+
+	mipi_dsi_msleep(&ctx, 100);
+
+	/* MACP Off */
+	mipi_dsi_generic_write_seq_multi(&ctx, R69328_MACP, R69328_MACP_OFF);
+
+	mipi_dsi_generic_write_seq_multi(&ctx, R69328_POWER_SET, 0x14, 0x1d,
+					 0x21, 0x67, 0x11, 0x9a);
+
+	mipi_dsi_generic_write_seq_multi(&ctx, R69328_GAMMA_SET_A, 0x00, 0x1a,
+					 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
+					 0x11, 0x18, 0x1e, 0x1c, 0x00, 0x00, 0x1a,
+					 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
+					 0x11, 0x18, 0x1e, 0x1c, 0x00);
+
+	mipi_dsi_generic_write_seq_multi(&ctx, R69328_GAMMA_SET_B, 0x00, 0x1a,
+					 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
+					 0x11, 0x18, 0x1e, 0x1c, 0x00, 0x00, 0x1a,
+					 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
+					 0x11, 0x18, 0x1e, 0x1c, 0x00);
+
+	mipi_dsi_generic_write_seq_multi(&ctx, R69328_GAMMA_SET_C, 0x00, 0x1a,
+					 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
+					 0x11, 0x18, 0x1e, 0x1c, 0x00, 0x00, 0x1a,
+					 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
+					 0x11, 0x18, 0x1e, 0x1c, 0x00);
+
+	/* MACP On */
+	mipi_dsi_generic_write_seq_multi(&ctx, R69328_MACP, R69328_MACP_ON);
+
+	mipi_dsi_dcs_set_display_on_multi(&ctx);
+	mipi_dsi_msleep(&ctx, 50);
+
+	return 0;
+}
+
+static int renesas_r69328_disable(struct drm_panel *panel)
+{
+	struct renesas_r69328 *priv = to_renesas_r69328(panel);
+	struct mipi_dsi_multi_context ctx = { .dsi = priv->dsi };
+
+	mipi_dsi_dcs_set_display_off_multi(&ctx);
+	mipi_dsi_msleep(&ctx, 60);
+	mipi_dsi_dcs_enter_sleep_mode_multi(&ctx);
+
+	return 0;
+}
+
+static int renesas_r69328_unprepare(struct drm_panel *panel)
+{
+	struct renesas_r69328 *priv = to_renesas_r69328(panel);
+
+	if (!priv->prepared)

drivers/gpu/drm/panel/panel-renesas-r69328.c line 153

Quoted 10 lines
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +10 -0
+		return 0;
+
+	gpiod_set_value_cansleep(priv->reset_gpio, 1);
+
+	usleep_range(5000, 6000);
+
+	regulator_disable(priv->vddio_supply);
+	regulator_disable(priv->vdd_supply);
+
+	priv->prepared = false;

a '\n' before return

Quoted 74 lines
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +74 -0
+	return 0;
+}
+
+static const struct drm_display_mode renesas_r69328_mode = {
+	.clock = (720 + 92 + 62 + 4) * (1280 + 6 + 3 + 1) * 60 / 1000,
+	.hdisplay = 720,
+	.hsync_start = 720 + 92,
+	.hsync_end = 720 + 92 + 62,
+	.htotal = 720 + 92 + 62 + 4,
+	.vdisplay = 1280,
+	.vsync_start = 1280 + 6,
+	.vsync_end = 1280 + 6 + 3,
+	.vtotal = 1280 + 6 + 3 + 1,
+	.width_mm = 59,
+	.height_mm = 105,
+};
+
+static int renesas_r69328_get_modes(struct drm_panel *panel,
+				    struct drm_connector *connector)
+{
+	struct drm_display_mode *mode;
+
+	mode = drm_mode_duplicate(connector->dev, &renesas_r69328_mode);
+	if (!mode)
+		return -ENOMEM;
+
+	drm_mode_set_name(mode);
+
+	mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
+	connector->display_info.width_mm = mode->width_mm;
+	connector->display_info.height_mm = mode->height_mm;
+	drm_mode_probed_add(connector, mode);
+
+	return 1;
+}
+
+static const struct drm_panel_funcs renesas_r69328_panel_funcs = {
+	.prepare = renesas_r69328_prepare,
+	.enable = renesas_r69328_enable,
+	.disable = renesas_r69328_disable,
+	.unprepare = renesas_r69328_unprepare,
+	.get_modes = renesas_r69328_get_modes,
+};
+
+static int renesas_r69328_probe(struct mipi_dsi_device *dsi)
+{
+	struct device *dev = &dsi->dev;
+	struct renesas_r69328 *priv;
+	int ret;
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	priv->vdd_supply = devm_regulator_get(dev, "vdd");
+	if (IS_ERR(priv->vdd_supply))
+		return dev_err_probe(dev, PTR_ERR(priv->vdd_supply),
+				     "Failed to get vdd-supply\n");
+
+	priv->vddio_supply = devm_regulator_get(dev, "vddio");
+	if (IS_ERR(priv->vddio_supply))
+		return dev_err_probe(dev, PTR_ERR(priv->vddio_supply),
+				     "Failed to get vddio-supply\n");
+
+	priv->reset_gpio = devm_gpiod_get_optional(dev, "reset",
+						   GPIOD_OUT_LOW);
+	if (IS_ERR(priv->reset_gpio))
+		return dev_err_probe(dev, PTR_ERR(priv->reset_gpio),
+				     "Failed to get reset-gpios\n");
+
+	priv->dsi = dsi;
+	mipi_dsi_set_drvdata(dsi, priv);
+
+	dsi->lanes = 4;

drivers/gpu/drm/panel/panel-renesas-r69328.c line 237

Quoted 10 lines
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +10 -0
+	dsi->format = MIPI_DSI_FMT_RGB888;
+	dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
+			  MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM;
+
+	drm_panel_init(&priv->panel, dev, &renesas_r69328_panel_funcs,
+		       DRM_MODE_CONNECTOR_DSI);
+
+	ret = drm_panel_of_backlight(&priv->panel);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to get backlight\n");

drm_panel_of_backlight, 0 on success, or a negative error code on failure so

	if( ret > 0)

drivers/gpu/drm/panel/panel-renesas-r69328.c line 241

Quoted 4 lines
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +4 -0
+
+	drm_panel_add(&priv->panel);
+
+	ret = mipi_dsi_attach(dsi);

if ( ret > 0) it return negative error code

drivers/gpu/drm/panel/panel-renesas-r69328.c line 245

Quoted 4 lines
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +4 -0
+	if (ret) {
+		dev_err(dev, "Failed to attach to DSI host: %d\n", ret);
+		drm_panel_remove(&priv->panel);
+		return ret;

use return dev_err_probe

drivers/gpu/drm/panel/panel-renesas-r69328.c line 256

Quoted 11 lines
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +11 -0
+	}
+
+	return 0;
+}
+
+static void renesas_r69328_remove(struct mipi_dsi_device *dsi)
+{
+	struct renesas_r69328 *priv = mipi_dsi_get_drvdata(dsi);
+	int ret;
+
+	ret = mipi_dsi_detach(dsi);

if ( ret > 0) it return negative error code

Quoted 16 lines
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +16 -0
+	if (ret)
+		dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret);
+
+	drm_panel_remove(&priv->panel);
+}
+
+static const struct of_device_id renesas_r69328_of_match[] = {
+	{ .compatible = "jdi,dx12d100vm0eaa" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, renesas_r69328_of_match);
+
+static struct mipi_dsi_driver renesas_r69328_driver = {
+	.probe = renesas_r69328_probe,
+	.remove = renesas_r69328_remove,
+	.driver = {

drivers/gpu/drm/panel/panel-renesas-r69328.c line 282

Quoted 10 lines
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +10 -0
+		.name = "panel-renesas-r69328",
+		.of_match_table = renesas_r69328_of_match,
+	},
+};
+module_mipi_dsi_driver(renesas_r69328_driver);
+
+MODULE_AUTHOR("Maxim Schwalm <[email protected]>");
+MODULE_AUTHOR("Svyatoslav Ryhel <[email protected]>");
+MODULE_DESCRIPTION("Renesas R69328-based panel driver");
+MODULE_LICENSE("GPL");

Thanks
Alok

#8 lore raw

Re: [PATCH v1 4/4] drm: panel: Add support for Renesas R69328 based MIPI DSI panel

Quoted 10 lines · ALOK TIWARI
Quoted 10 lines

+    mipi_dsi_set_drvdata(dsi, priv);
+
+    dsi->lanes = 4;
+    dsi->format = MIPI_DSI_FMT_RGB888;
+    dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
+              MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM; +
+    drm_panel_init(&priv->panel, dev, &renesas_r69328_panel_funcs, +               DRM_MODE_CONNECTOR_DSI);

Quoted 8 lines
Quoted 4 lines

+
+    ret = drm_panel_of_backlight(&priv->panel);
+    if (ret)
+        return dev_err_probe(dev, ret, "Failed to get backlight\n");

drm_panel_of_backlight, 0 on success, or a negative error code on failure so
    if( ret > 0)

ie if( ret < 0)

Quoted 7 lines

drivers/gpu/drm/panel/panel-renesas-r69328.c line 241

Quoted 5 lines
drivers/gpu/drm/panel/panel-renesas-r69328.c new file +4 -0
+
+    drm_panel_add(&priv->panel);
+
+    ret = mipi_dsi_attach(dsi);

if ( ret > 0) it return negative error code

ie if( ret < 0)

Quoted 8 lines
Quoted 5 lines

+    if (ret) {
+        dev_err(dev, "Failed to attach to DSI host: %d\n", ret); +        drm_panel_remove(&priv->panel);
+        return ret;

use return dev_err_probe

Quoted 13 lines

drivers/gpu/drm/panel/panel-renesas-r69328.c line 256

Quoted 11 lines

+    }

drivers/gpu/drm/panel/panel-renesas-r69328.c new file +10 -0
+
+    return 0;
+}
+
+static void renesas_r69328_remove(struct mipi_dsi_device *dsi)
+{
+    struct renesas_r69328 *priv = mipi_dsi_get_drvdata(dsi);
+    int ret;
+
+    ret = mipi_dsi_detach(dsi);

if ( ret > 0) it return negative error code

ie if( ret < 0)

Quoted 4 lines
Quoted 4 lines

+    if (ret)
+        dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); +

Thanks,
Alok