Skip to contentSkip to conversation

drm: Add support for Okaya RH128128T

PATCH In review Geert Uytterhoeven 6 participants 18 messages Jan 15, 2020 – Jan 23, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v2 cover drm: Add support for Okaya RH128128T

Hi all,

This patch series adds support for the Okaya RH128128T LCD to the existing ST7735R driver. This is a 128x128 1.4" TFT display driven by a Sitronix ST7715R TFT Controller/Driver. It is used on e.g. the Renesas YRSK-LCD-PMOD extension board, which is shipped with Renesas RSK+RZA1 development boards[1], and with several other Renesas starter kits, for RX, Synergy, and RZ/T1 MCUs and SoCs.

Changes compared to v1[2]:
- Convert DT bindings to DT schema,
- Add YRSK-LCD-PMOD reference and links,
- Add Reviewed-by,
- Split driver preparation and adding actual support in two separate patches,
- Replace st7735r_priv.rgb by a pointer to struct st7735r_cfg,
- Change prefix of jd_t18003_t01_pipe_enable() and

    jd_t18003_t01_pipe_funcs(),

- Update Kconfig help text,
- Improve file comment header.

This has been tested using the r7s72100-rskrza1-pmod-spi.dtso and r7s72100-rskrza1-pmod2-lcd.dtso DT overlays[3].
Note that for using this on RSK+RZA1, there is a dependency on RSPI cs-gpios support (now in linux-next).
With DT overlays, this also depends on DT overlays[4] and gpio-hog overlay support[5].

Thanks!

[1] https://renesasrulz.com/the_vault/f/archive-forum/4981/upgrading-to-the-renesas-rz-a1h
[1] https://lore.kernel.org/dri-devel/[email protected]/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/log/?h=topic/renesas-overlays
[4] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/log/?h=topic/overlays
[5] "[PATCH/RFC 0/2] gpio: of: Add DT overlay support for GPIO hogs"

    https://lore.kernel.org/lkml/[email protected]/

Geert Uytterhoeven (5):
dt-bindings: display: sitronix,st7735r: Convert to DT schema
dt-bindings: display: sitronix,st7735r: Add Okaya RH128128T drm/mipi_dbi: Add support for display offsets
drm: tiny: st7735r: Prepare for adding support for more displays
drm: tiny: st7735r: Add support for Okaya RH128128T

 .../bindings/display/sitronix,st7735r.txt     | 35 ---------
 .../bindings/display/sitronix,st7735r.yaml    | 71 +++++++++++++++++
 MAINTAINERS                                   |  2 +-
 drivers/gpu/drm/drm_mipi_dbi.c                | 30 +++++---
 drivers/gpu/drm/tiny/Kconfig                  |  8 +-
 drivers/gpu/drm/tiny/st7735r.c                | 76 +++++++++++++++----
 include/drm/drm_mipi_dbi.h                    | 12 +++
 7 files changed, 170 insertions(+), 64 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/display/sitronix,st7735r.txt
 create mode 100644 Documentation/devicetree/bindings/display/sitronix,st7735r.yaml
Signature · 12 lines
2.17.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
#1 lore raw

PATCH v2 1/5 dt-bindings: display: sitronix,st7735r: Convert to DT schema

Convert the DT binding documentation for Sitronix ST7735R displays to DT schema.

Add a reference to the Adafruit 1.8" LCD while at it.

---
v2:
- New.

---
 .../bindings/display/sitronix,st7735r.txt     | 35 ----------
 .../bindings/display/sitronix,st7735r.yaml    | 65 +++++++++++++++++++
 MAINTAINERS                                   |  2 +-
 3 files changed, 66 insertions(+), 36 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/display/sitronix,st7735r.txt
 create mode 100644 Documentation/devicetree/bindings/display/sitronix,st7735r.yaml
Documentation/devicetree/bindings/display/sitronix,st7735r.txt deleted +0 -35
deleted file mode 100644
index cd5c7186890a2be7..0000000000000000
@@ -1,35 +0,0 @@
-Sitronix ST7735R display panels
-
-This binding is for display panels using a Sitronix ST7735R controller in SPI
-mode.
-
-Required properties:
-- compatible:	"jianda,jd-t18003-t01", "sitronix,st7735r"
-- dc-gpios:	Display data/command selection (D/CX)
-- reset-gpios:	Reset signal (RSTX)
-
-The node for this driver must be a child node of a SPI controller, hence
-all mandatory properties described in ../spi/spi-bus.txt must be specified.
-
-Optional properties:
-- rotation:	panel rotation in degrees counter clockwise (0,90,180,270)
-- backlight:	phandle of the backlight device attached to the panel
-
-Example:
-
-	backlight: backlight {
-		compatible = "gpio-backlight";
-		gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
-	};
-
-	...
-
-	display@0{
-		compatible = "jianda,jd-t18003-t01", "sitronix,st7735r";
-		reg = <0>;
-		spi-max-frequency = <32000000>;
-		dc-gpios = <&gpio 43 GPIO_ACTIVE_HIGH>;
-		reset-gpios = <&gpio 80 GPIO_ACTIVE_HIGH>;
-		rotation = <270>;
-		backlight = &backlight;
-	};
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml new file +65 -0

65 lines not on this page · raw message

MAINTAINERS +1 -1
index ea8262509bdd21ac..3007f83bd504194a 100644
@@ -5382,7 +5382,7 @@ M:	David Lechner <[email protected]>
 T:	git git://anongit.freedesktop.org/drm/drm-misc
 S:	Maintained
 F:	drivers/gpu/drm/tiny/st7735r.c
-F:	Documentation/devicetree/bindings/display/sitronix,st7735r.txt
+F:	Documentation/devicetree/bindings/display/sitronix,st7735r.yaml
 
 DRM DRIVER FOR SONY ACX424AKP PANELS
 M:	Linus Walleij <[email protected]>
Signature · 1 line
2.17.1
Reviewed-by on v2 1/5
#2 lore raw

Re: [PATCH v2 1/5] dt-bindings: display: sitronix,st7735r: Convert to DT schema

Hi Geert.

Thanks for doing the conversion to meta-schema.

Quoted 14 lines · Geert Uytterhoeven

Convert the DT binding documentation for Sitronix ST7735R displays to DT schema.

Add a reference to the Adafruit 1.8" LCD while at it.

---

Documentation/devicetree/bindings/display/sitronix,st7735r.yaml new file +0 -0
new file mode 100644
index 0000000000000000..21bccc91f74255e1

Documentation/devicetree/bindings/display/sitronix,st7735r.yaml line 1

Quoted 1 line
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml new file +1 -0
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: GPL-2.0-only

Use (GPL-2.0-only OR BSD-2-Clause) for new binding files.

Quoted 6 lines
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml new file +6 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sitronix,st7735r.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sitronix ST7735R Display Panels Device Tree Bindings

Documentation/devicetree/bindings/display/sitronix,st7735r.yaml line 17

Quoted 10 lines
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml new file +10 -0
+
+maintainers:
+  - David Lechner <[email protected]>
+
+description:
+  This binding is for display panels using a Sitronix ST7735R controller in
+  SPI mode.
+
+allOf:
+  - $ref: panel/panel-common.yaml#

I am no binding expert so I do not know how to add it. But the old binding described that this MUST be a child of spi. This is missing here.

Other panels using spi does not have it - so it is probarly OK.

So with the license fixed:

Quoted 63 lines
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml new file +48 -0
+
+properties:
+  compatible:
+    oneOf:
+      - description:
+          Adafruit 1.8" 160x128 Color TFT LCD (Product ID 358 or 618)
+        items:
+          - enum:
+              - jianda,jd-t18003-t01
+          - const: sitronix,st7735r
+
+  spi-max-frequency:
+    maximum: 32000000
+
+  dc-gpios:
+    maxItems: 1
+    description: Display data/command selection (D/CX)
+
+required:
+  - compatible
+  - reg
+  - dc-gpios
+  - reset-gpios
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    backlight: backlight {
+            compatible = "gpio-backlight";
+            gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
+    };
+
+    spi {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            display@0{
+                    compatible = "jianda,jd-t18003-t01", "sitronix,st7735r";
+                    reg = <0>;
+                    spi-max-frequency = <32000000>;
+                    dc-gpios = <&gpio 43 GPIO_ACTIVE_HIGH>;
+                    reset-gpios = <&gpio 80 GPIO_ACTIVE_HIGH>;
+                    rotation = <270>;
+            };
+    };
+
+...
MAINTAINERS +1 -1
index ea8262509bdd21ac..3007f83bd504194a 100644
@@ -5382,7 +5382,7 @@ M:	David Lechner <[email protected]>
 T:	git git://anongit.freedesktop.org/drm/drm-misc
 S:	Maintained
 F:	drivers/gpu/drm/tiny/st7735r.c
-F:	Documentation/devicetree/bindings/display/sitronix,st7735r.txt
+F:	Documentation/devicetree/bindings/display/sitronix,st7735r.yaml
 
 DRM DRIVER FOR SONY ACX424AKP PANELS
 M:	Linus Walleij <[email protected]>
Signature · 1 line
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Re: [PATCH v2 1/5] dt-bindings: display: sitronix,st7735r: Convert to DT schema

Hi Sam,

Quoted 9 lines · Sam Ravnborg
Quoted 7 lines · Geert Uytterhoeven

Convert the DT binding documentation for Sitronix ST7735R displays to DT schema.

Add a reference to the Adafruit 1.8" LCD while at it.

---

Quoted 8 lines

Documentation/devicetree/bindings/display/sitronix,st7735r.yaml line 1

Quoted 7 lines
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml new file +1 -0
new file mode 100644
index 0000000000000000..21bccc91f74255e1
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: GPL-2.0-only

Use (GPL-2.0-only OR BSD-2-Clause) for new binding files.

I used GPL-2.0-only, as this is a conversion of an existing binding file, covered by the default GPL-2.0-only of the Linux kernel source tree.

Quoted 21 lines
Quoted 6 lines
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml new file +6 -0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sitronix,st7735r.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sitronix ST7735R Display Panels Device Tree Bindings

Documentation/devicetree/bindings/display/sitronix,st7735r.yaml line 17

Quoted 10 lines
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml new file +10 -0
+
+maintainers:
+  - David Lechner <[email protected]>
+
+description:
+  This binding is for display panels using a Sitronix ST7735R controller in
+  SPI mode.
+
+allOf:
+  - $ref: panel/panel-common.yaml#

I am no binding expert so I do not know how to add it. But the old binding described that this MUST be a child of spi. This is missing here.

Quoted 1 line

Other panels using spi does not have it - so it is probarly OK.

Yeah, I couldn't find any examples of expressing that requirement in yaml.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
maintainer
#4 lore raw

Re: [PATCH v2 1/5] dt-bindings: display: sitronix,st7735r: Convert to DT schema

In reply to Geert Uytterhoeven
Quoted 71 lines · Geert Uytterhoeven

Convert the DT binding documentation for Sitronix ST7735R displays to DT schema.

Add a reference to the Adafruit 1.8" LCD while at it.

---
v2:
- New.

---
  .../bindings/display/sitronix,st7735r.txt     | 35 ----------
  .../bindings/display/sitronix,st7735r.yaml    | 65 +++++++++++++++++++
  MAINTAINERS                                   |  2 +-
  3 files changed, 66 insertions(+), 36 deletions(-)

delete mode 100644 Documentation/devicetree/bindings/display/sitronix,st7735r.txt create mode 100644 Documentation/devicetree/bindings/display/sitronix,st7735r.yaml

Documentation/devicetree/bindings/display/sitronix,st7735r.txt deleted +0 -35
deleted file mode 100644
index cd5c7186890a2be7..0000000000000000
@@ -1,35 +0,0 @@
-Sitronix ST7735R display panels
-
-This binding is for display panels using a Sitronix ST7735R controller in SPI
-mode.
-
-Required properties:
-- compatible:	"jianda,jd-t18003-t01", "sitronix,st7735r"
-- dc-gpios:	Display data/command selection (D/CX)
-- reset-gpios:	Reset signal (RSTX)
-
-The node for this driver must be a child node of a SPI controller, hence
-all mandatory properties described in ../spi/spi-bus.txt must be specified.
-
-Optional properties:
-- rotation:	panel rotation in degrees counter clockwise (0,90,180,270)
-- backlight:	phandle of the backlight device attached to the panel
-
-Example:
-
-	backlight: backlight {
-		compatible = "gpio-backlight";
-		gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
-	};
-
-	...
-
-	display@0{
-		compatible = "jianda,jd-t18003-t01", "sitronix,st7735r";
-		reg = <0>;
-		spi-max-frequency = <32000000>;
-		dc-gpios = <&gpio 43 GPIO_ACTIVE_HIGH>;
-		reset-gpios = <&gpio 80 GPIO_ACTIVE_HIGH>;
-		rotation = <270>;
-		backlight = &backlight;
-	};
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml new file +7 -0
new file mode 100644
index 0000000000000000..21bccc91f74255e1
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: GPL-2.0-only
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/sitronix,st7735r.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sitronix ST7735R Display Panels Device Tree Bindings

Documentation/devicetree/bindings/display/sitronix,st7735r.yaml line 17

Quoted 10 lines
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml new file +10 -0
+
+maintainers:
+  - David Lechner <[email protected]>
+
+description:
+  This binding is for display panels using a Sitronix ST7735R controller in
+  SPI mode.
+
+allOf:
+  - $ref: panel/panel-common.yaml#

not all of these properties are applicable.

Quoted 13 lines
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml new file +13 -0
+
+properties:
+  compatible:
+    oneOf:
+      - description:
+          Adafruit 1.8" 160x128 Color TFT LCD (Product ID 358 or 618)
+        items:
+          - enum:
+              - jianda,jd-t18003-t01
+          - const: sitronix,st7735r
+
+  spi-max-frequency:
+    maximum: 32000000

Documentation/devicetree/bindings/display/sitronix,st7735r.yaml line 40

Quoted 10 lines
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml new file +10 -0
+
+  dc-gpios:
+    maxItems: 1
+    description: Display data/command selection (D/CX)
+
+required:
+  - compatible
+  - reg
+  - dc-gpios
+  - reset-gpios

Missing optional rotation and backlight properties.

Quoted 31 lines
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml new file +25 -0
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    backlight: backlight {
+            compatible = "gpio-backlight";
+            gpios = <&gpio 44 GPIO_ACTIVE_HIGH>;
+    };
+
+    spi {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            display@0{
+                    compatible = "jianda,jd-t18003-t01", "sitronix,st7735r";
+                    reg = <0>;
+                    spi-max-frequency = <32000000>;
+                    dc-gpios = <&gpio 43 GPIO_ACTIVE_HIGH>;
+                    reset-gpios = <&gpio 80 GPIO_ACTIVE_HIGH>;
+                    rotation = <270>;
+            };
+    };
+
+...
MAINTAINERS +0 -0
index ea8262509bdd21ac..3007f83bd504194a 100644

MAINTAINERS M: David Lechner <[email protected]> · line 5388

Quoted 8 lines
MAINTAINERS +1 -1
@@ -5382,7 +5382,7 @@ M:	David Lechner <[email protected]>
  T:	git git://anongit.freedesktop.org/drm/drm-misc
  S:	Maintained
  F:	drivers/gpu/drm/tiny/st7735r.c
-F:	Documentation/devicetree/bindings/display/sitronix,st7735r.txt
+F:	Documentation/devicetree/bindings/display/sitronix,st7735r.yaml
 
  DRM DRIVER FOR SONY ACX424AKP PANELS
  M:	Linus Walleij <[email protected]>

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

PATCH 1/1 dt-bindings: restrict properties for sitronix,st7735r

Hi David.

Quoted 6 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+allOf:
+  - $ref: panel/panel-common.yaml#

not all of these properties are applicable.

Quoted 7 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+required:
+  - compatible
+  - reg
+  - dc-gpios
+  - reset-gpios

Missing optional rotation and backlight properties.

Thanks for catching this. I have written a little .yaml files since I applied this - and learned a little more of the syntax.

See attached patch for my attempt to fix this.
Please review.

Sam

From 6b54fb0a071c0732cd4bd5b88f456b5a85bcf4f2 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Mon, 20 Jan 2020 19:55:04 +0100
Subject: [PATCH] dt-bindings: restrict properties for sitronix,st7735r

David Lechner noticed (paraphrased):
- not all properties from panel-common are applicable.
- missing optional rotation and backlight properties

Fix this by listing all allowed properties, and do not allow other properties.

Fixes abdd9e3705c8 ("dt-bindings: display: sitronix,st7735r: Convert to DT schema")
Cc Geert Uytterhoeven <[email protected]>
Cc David Lechner <[email protected]>
Cc Rob Herring <[email protected]>
---
 .../devicetree/bindings/display/sitronix,st7735r.yaml      | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml +7 -0
index 8892d79e6e10..0cebaaefda03 100644
@@ -39,12 +39,19 @@ properties:
     maxItems: 1
     description: Display data/command selection (D/CX)
 
+  backlight: true
+  reg: true
+  reset-gpios: true
+  rotation: true
+
 required:
   - compatible
   - reg
   - dc-gpios
   - reset-gpios
 
+additionalProperties: false
+
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#6 lore raw

Re: [PATCH] dt-bindings: restrict properties for sitronix,st7735r

Quoted 14 lines · Sam Ravnborg

Hi David.

Quoted 12 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+allOf:
+  - $ref: panel/panel-common.yaml#

not all of these properties are applicable.

Quoted 5 lines
(quoted diff) +5 -0
+required:
+  - compatible
+  - reg
+  - dc-gpios
+  - reset-gpios
Quoted 7 lines
Quoted 1 line

Missing optional rotation and backlight properties.

Thanks for catching this. I have written a little .yaml files since I applied this - and learned a little more of the syntax.

See attached patch for my attempt to fix this.
Please review.

Hi David, Geert.

Any feedback on this patch?

Sam

Quoted 56 lines

Sam

Quoted 1 line

From 6b54fb0a071c0732cd4bd5b88f456b5a85bcf4f2 Mon Sep 17 00:00:00 2001

From: Sam Ravnborg <[email protected]>
Date: Mon, 20 Jan 2020 19:55:04 +0100
Subject: [PATCH] dt-bindings: restrict properties for sitronix,st7735r

David Lechner noticed (paraphrased):
- not all properties from panel-common are applicable.
- missing optional rotation and backlight properties

Fix this by listing all allowed properties, and do not allow other properties.

Fixes abdd9e3705c8 ("dt-bindings: display: sitronix,st7735r: Convert to DT schema")
Cc Geert Uytterhoeven <[email protected]>
Cc David Lechner <[email protected]>
Cc Rob Herring <[email protected]>
---
 .../devicetree/bindings/display/sitronix,st7735r.yaml      | 7 +++++++
 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml +7 -0
index 8892d79e6e10..0cebaaefda03 100644
@@ -39,12 +39,19 @@ properties:
     maxItems: 1
     description: Display data/command selection (D/CX)
 
+  backlight: true
+  reg: true
+  reset-gpios: true
+  rotation: true
+
 required:
   - compatible
   - reg
   - dc-gpios
   - reset-gpios
 
+additionalProperties: false
+
 examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 1/1
#7 lore raw

Re: [PATCH] dt-bindings: restrict properties for sitronix,st7735r

In reply to Sam Ravnborg

Hi Sam,

Quoted 9 lines · Sam Ravnborg

From 6b54fb0a071c0732cd4bd5b88f456b5a85bcf4f2 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Mon, 20 Jan 2020 19:55:04 +0100
Subject: [PATCH] dt-bindings: restrict properties for sitronix,st7735r

David Lechner noticed (paraphrased):
- not all properties from panel-common are applicable.
- missing optional rotation and backlight properties

Quoted 5 lines

Fix this by listing all allowed properties, and do not allow other properties.

Fixes abdd9e3705c8 ("dt-bindings: display: sitronix,st7735r: Convert to DT schema")

I'm far from a DT yaml expert, but LGTM, so:

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#8 lore raw

Re: [PATCH] dt-bindings: restrict properties for sitronix,st7735r

Hi Geert & Rob.

Quoted 12 lines · Geert Uytterhoeven

Hi Sam,

Quoted 9 lines · Sam Ravnborg

From 6b54fb0a071c0732cd4bd5b88f456b5a85bcf4f2 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Mon, 20 Jan 2020 19:55:04 +0100
Subject: [PATCH] dt-bindings: restrict properties for sitronix,st7735r

David Lechner noticed (paraphrased):
- not all properties from panel-common are applicable.
- missing optional rotation and backlight properties

Quoted 8 lines
Quoted 5 lines

Fix this by listing all allowed properties, and do not allow other properties.

Fixes abdd9e3705c8 ("dt-bindings: display: sitronix,st7735r: Convert to DT schema")

I'm far from a DT yaml expert, but LGTM, so:

Thanks, now pushed to drm-misc-next.

Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer Acked-by on v1 1/1
#9 lore raw

Re: [PATCH] dt-bindings: restrict properties for sitronix,st7735r

In reply to Sam Ravnborg
Quoted 42 lines · Sam Ravnborg

Hi David.

Quoted 6 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+allOf:
+  - $ref: panel/panel-common.yaml#

not all of these properties are applicable.

Quoted 7 lines

Review

Quoted 5 lines
(quoted diff) +5 -0
+required:
+  - compatible
+  - reg
+  - dc-gpios
+  - reset-gpios

Missing optional rotation and backlight properties.

Thanks for catching this. I have written a little .yaml files since I applied this - and learned a little more of the syntax.

See attached patch for my attempt to fix this.
Please review.

Sam

From 6b54fb0a071c0732cd4bd5b88f456b5a85bcf4f2 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <[email protected]>
Date: Mon, 20 Jan 2020 19:55:04 +0100
Subject: [PATCH] dt-bindings: restrict properties for sitronix,st7735r

David Lechner noticed (paraphrased):
- not all properties from panel-common are applicable.
- missing optional rotation and backlight properties

Fix this by listing all allowed properties, and do not allow other properties.

Fixes abdd9e3705c8 ("dt-bindings: display: sitronix,st7735r: Convert to DT schema")
Cc Geert Uytterhoeven <[email protected]>
Cc David Lechner <[email protected]>
Cc Rob Herring <[email protected]>
Quoted 3 lines
---
 .../devicetree/bindings/display/sitronix,st7735r.yaml      | 7 +++++++
 1 file changed, 7 insertions(+)
#10 lore raw

PATCH v2 2/5 dt-bindings: display: sitronix,st7735r: Add Okaya RH128128T

In reply to Geert Uytterhoeven

Document support for the Okaya RH128128T display, which is a 128x128 1.44" TFT display driven by a Sitronix ST7715R TFT Controller/Driver. It can be found on e.g. the Renesas YRSK-LCD-PMOD extension board, which comes with various Renesas development kits (e.g. Renesas Starter Kit+ for RZ/A1H[1]).

ST7715R and ST7735R are very similar. Their major difference is that the former is restricted to displays of up to 132x132 pixels, while the latter supports displays up to 132x162 pixels.

[1] https://renesasrulz.com/the_vault/f/archive-forum/4981/upgrading-to-the-renesas-rz-a1h

---
v2:
- Rebase on top of DT schema conversion,
- Add YRSK-LCD-PMOD reference and links.

---
 .../devicetree/bindings/display/sitronix,st7735r.yaml  | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml +8 -2
index 21bccc91f74255e1..8892d79e6e100b79 100644
@@ -10,8 +10,8 @@ maintainers:
   - David Lechner <[email protected]>
 
 description:
-  This binding is for display panels using a Sitronix ST7735R controller in
-  SPI mode.
+  This binding is for display panels using a Sitronix ST7715R or ST7735R
+  controller in SPI mode.
 
 allOf:
   - $ref: panel/panel-common.yaml#
@@ -25,6 +25,12 @@ properties:
           - enum:
               - jianda,jd-t18003-t01
           - const: sitronix,st7735r
+      - description:
+          Okaya 1.44" 128x128 Color TFT LCD (E.g. Renesas YRSK-LCD-PMOD)
+        items:
+          - enum:
+              - okaya,rh128128t
+          - const: sitronix,st7715r
 
   spi-max-frequency:
     maximum: 32000000
Signature · 1 line
2.17.1
Reviewed-by on v2 2/5
#11 lore raw

Re: [PATCH v2 2/5] dt-bindings: display: sitronix,st7735r: Add Okaya RH128128T

Quoted 6 lines · Geert Uytterhoeven

Document support for the Okaya RH128128T display, which is a 128x128 1.44" TFT display driven by a Sitronix ST7715R TFT Controller/Driver. It can be found on e.g. the Renesas YRSK-LCD-PMOD extension board, which comes with various Renesas development kits (e.g. Renesas Starter Kit+ for RZ/A1H[1]).

Quoted 7 lines

ST7715R and ST7735R are very similar. Their major difference is that the former is restricted to displays of up to 132x132 pixels, while the latter supports displays up to 132x162 pixels.

[1] https://renesasrulz.com/the_vault/f/archive-forum/4981/upgrading-to-the-renesas-rz-a1h

Quoted 38 lines

---
v2:
- Rebase on top of DT schema conversion,
- Add YRSK-LCD-PMOD reference and links.

---
 .../devicetree/bindings/display/sitronix,st7735r.yaml  | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml +8 -2
index 21bccc91f74255e1..8892d79e6e100b79 100644
@@ -10,8 +10,8 @@ maintainers:
   - David Lechner <[email protected]>
 
 description:
-  This binding is for display panels using a Sitronix ST7735R controller in
-  SPI mode.
+  This binding is for display panels using a Sitronix ST7715R or ST7735R
+  controller in SPI mode.
 
 allOf:
   - $ref: panel/panel-common.yaml#
@@ -25,6 +25,12 @@ properties:
           - enum:
               - jianda,jd-t18003-t01
           - const: sitronix,st7735r
+      - description:
+          Okaya 1.44" 128x128 Color TFT LCD (E.g. Renesas YRSK-LCD-PMOD)
+        items:
+          - enum:
+              - okaya,rh128128t
+          - const: sitronix,st7715r
 
   spi-max-frequency:
     maximum: 32000000
Signature · 1 line
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#12 lore raw

PATCH v2 3/5 drm/mipi_dbi: Add support for display offsets

In reply to Geert Uytterhoeven

If the resolution of the TFT display is smaller than the maximum resolution supported by the display controller, the display may be connected to the driver output arrays with a horizontal and/or vertical offset, leading to a shifted image.

Add support for specifying these offsets.

---
v2:
- Add Reviewed-by.

---
 drivers/gpu/drm/drm_mipi_dbi.c | 30 ++++++++++++++++++++----------
 include/drm/drm_mipi_dbi.h     | 12 ++++++++++++
 2 files changed, 32 insertions(+), 10 deletions(-)
drivers/gpu/drm/drm_mipi_dbi.c +20 -10
index 16bff1be4b8ac622..27fe81a53c88e338 100644
@@ -238,6 +238,23 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
 }
 EXPORT_SYMBOL(mipi_dbi_buf_copy);
 
+static void mipi_dbi_set_window_address(struct mipi_dbi_dev *dbidev,
+					unsigned int xs, unsigned int xe,
+					unsigned int ys, unsigned int ye)
+{
+	struct mipi_dbi *dbi = &dbidev->dbi;
+
+	xs += dbidev->left_offset;
+	xe += dbidev->left_offset;
+	ys += dbidev->top_offset;
+	ye += dbidev->top_offset;
+
+	mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS, (xs >> 8) & 0xff,
+			 xs & 0xff, (xe >> 8) & 0xff, xe & 0xff);
+	mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS, (ys >> 8) & 0xff,
+			 ys & 0xff, (ye >> 8) & 0xff, ye & 0xff);
+}
+
 static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
 {
 	struct drm_gem_object *gem = drm_gem_fb_get_obj(fb, 0);
@@ -271,12 +288,8 @@ static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
 		tr = cma_obj->vaddr;
 	}
 
-	mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS,
-			 (rect->x1 >> 8) & 0xff, rect->x1 & 0xff,
-			 ((rect->x2 - 1) >> 8) & 0xff, (rect->x2 - 1) & 0xff);
-	mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS,
-			 (rect->y1 >> 8) & 0xff, rect->y1 & 0xff,
-			 ((rect->y2 - 1) >> 8) & 0xff, (rect->y2 - 1) & 0xff);
+	mipi_dbi_set_window_address(dbidev, rect->x1, rect->x2 - 1, rect->y1,
+				    rect->y2 - 1);
 
 	ret = mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START, tr,
 				   width * height * 2);
@@ -366,10 +379,7 @@ static void mipi_dbi_blank(struct mipi_dbi_dev *dbidev)
 
 	memset(dbidev->tx_buf, 0, len);
 
-	mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS, 0, 0,
-			 ((width - 1) >> 8) & 0xFF, (width - 1) & 0xFF);
-	mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS, 0, 0,
-			 ((height - 1) >> 8) & 0xFF, (height - 1) & 0xFF);
+	mipi_dbi_set_window_address(dbidev, 0, width - 1, 0, height - 1);
 	mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START,
 			     (u8 *)dbidev->tx_buf, len);
 
include/drm/drm_mipi_dbi.h +12 -0
index 67c66f5ee591e80f..33f325f5af2b921f 100644
@@ -109,6 +109,18 @@ struct mipi_dbi_dev {
 	 */
 	unsigned int rotation;
 
+	/**
+	 * @left_offset: Horizontal offset of the display relative to the
+	 *               controller's driver array
+	 */
+	unsigned int left_offset;
+
+	/**
+	 * @top_offset: Vertical offset of the display relative to the
+	 *              controller's driver array
+	 */
+	unsigned int top_offset;
+
 	/**
 	 * @backlight: backlight device (optional)
 	 */
Signature · 1 line
2.17.1
#13 lore raw

Re: [PATCH v2 3/5] drm/mipi_dbi: Add support for display offsets

Hi Noralf.

If you could find time to review this patch it would be great. I am reluctant to apply it until you have acked/reviewed it.

Thanks in advance,

Sam

Quoted 97 lines · Geert Uytterhoeven

If the resolution of the TFT display is smaller than the maximum resolution supported by the display controller, the display may be connected to the driver output arrays with a horizontal and/or vertical offset, leading to a shifted image.

Add support for specifying these offsets.

---
v2:
- Add Reviewed-by.

---
 drivers/gpu/drm/drm_mipi_dbi.c | 30 ++++++++++++++++++++----------
 include/drm/drm_mipi_dbi.h     | 12 ++++++++++++
 2 files changed, 32 insertions(+), 10 deletions(-)
drivers/gpu/drm/drm_mipi_dbi.c +20 -10
index 16bff1be4b8ac622..27fe81a53c88e338 100644
@@ -238,6 +238,23 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
 }
 EXPORT_SYMBOL(mipi_dbi_buf_copy);
 
+static void mipi_dbi_set_window_address(struct mipi_dbi_dev *dbidev,
+					unsigned int xs, unsigned int xe,
+					unsigned int ys, unsigned int ye)
+{
+	struct mipi_dbi *dbi = &dbidev->dbi;
+
+	xs += dbidev->left_offset;
+	xe += dbidev->left_offset;
+	ys += dbidev->top_offset;
+	ye += dbidev->top_offset;
+
+	mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS, (xs >> 8) & 0xff,
+			 xs & 0xff, (xe >> 8) & 0xff, xe & 0xff);
+	mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS, (ys >> 8) & 0xff,
+			 ys & 0xff, (ye >> 8) & 0xff, ye & 0xff);
+}
+
 static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
 {
 	struct drm_gem_object *gem = drm_gem_fb_get_obj(fb, 0);
@@ -271,12 +288,8 @@ static void mipi_dbi_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
 		tr = cma_obj->vaddr;
 	}
 
-	mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS,
-			 (rect->x1 >> 8) & 0xff, rect->x1 & 0xff,
-			 ((rect->x2 - 1) >> 8) & 0xff, (rect->x2 - 1) & 0xff);
-	mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS,
-			 (rect->y1 >> 8) & 0xff, rect->y1 & 0xff,
-			 ((rect->y2 - 1) >> 8) & 0xff, (rect->y2 - 1) & 0xff);
+	mipi_dbi_set_window_address(dbidev, rect->x1, rect->x2 - 1, rect->y1,
+				    rect->y2 - 1);
 
 	ret = mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START, tr,
 				   width * height * 2);
@@ -366,10 +379,7 @@ static void mipi_dbi_blank(struct mipi_dbi_dev *dbidev)
 
 	memset(dbidev->tx_buf, 0, len);
 
-	mipi_dbi_command(dbi, MIPI_DCS_SET_COLUMN_ADDRESS, 0, 0,
-			 ((width - 1) >> 8) & 0xFF, (width - 1) & 0xFF);
-	mipi_dbi_command(dbi, MIPI_DCS_SET_PAGE_ADDRESS, 0, 0,
-			 ((height - 1) >> 8) & 0xFF, (height - 1) & 0xFF);
+	mipi_dbi_set_window_address(dbidev, 0, width - 1, 0, height - 1);
 	mipi_dbi_command_buf(dbi, MIPI_DCS_WRITE_MEMORY_START,
 			     (u8 *)dbidev->tx_buf, len);
 
include/drm/drm_mipi_dbi.h +12 -0
index 67c66f5ee591e80f..33f325f5af2b921f 100644
@@ -109,6 +109,18 @@ struct mipi_dbi_dev {
 	 */
 	unsigned int rotation;
 
+	/**
+	 * @left_offset: Horizontal offset of the display relative to the
+	 *               controller's driver array
+	 */
+	unsigned int left_offset;
+
+	/**
+	 * @top_offset: Vertical offset of the display relative to the
+	 *              controller's driver array
+	 */
+	unsigned int top_offset;
+
 	/**
 	 * @backlight: backlight device (optional)
 	 */
Signature · 1 line
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Acked-by on v2 3/5
#14 lore raw

Re: [PATCH v2 3/5] drm/mipi_dbi: Add support for display offsets

In reply to Geert Uytterhoeven

Den 15.01.2020 13.45, skrev Geert Uytterhoeven:

Quoted 10 lines

If the resolution of the TFT display is smaller than the maximum resolution supported by the display controller, the display may be connected to the driver output arrays with a horizontal and/or vertical offset, leading to a shifted image.

Add support for specifying these offsets.

---

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#15 lore raw

PATCH v2 4/5 drm: tiny: st7735r: Prepare for adding support for more displays

In reply to Geert Uytterhoeven

Currently the st7735r driver supports only a single display panel. Prepare for adding support for other display panels by factoring out the display-specific parameters in struct st7735r_cfg.

For now, the following parameters can be configured:
- Display resolution,
- Horizontal/vertical display offsets,
- Read-write versus read-only controllers,
- RGB versus BGR color component ordering.

Rename jd_t18003_t01_pipe_enable() and jd_t18003_t01_pipe_funcs() to st7735r_pipe_enable() resp. st7735r_pipe_funcs(), as they are not really specific to the Jianda JD-T18003-T01 display anymore.

---
v2:
- Split off from "drm: tiny: st7735r: Add support for Okaya

    RH128128T",
  - Replace st7735r_priv.rgb by a pointer to struct st7735r_cfg,
  - Change prefix of jd_t18003_t01_pipe_enable() and
    jd_t18003_t01_pipe_funcs().
---
 drivers/gpu/drm/tiny/st7735r.c | 67 +++++++++++++++++++++++++++-------
 1 file changed, 53 insertions(+), 14 deletions(-)
drivers/gpu/drm/tiny/st7735r.c +53 -14
index 3f4487c716848cf8..a838f237c8d82e3d 100644
@@ -3,6 +3,7 @@
  * DRM driver for Sitronix ST7735R panels
  *
  * Copyright 2017 David Lechner <[email protected]>
+ * Copyright (C) 2019 Glider bvba
  */
 
 #include <linux/backlight.h>
@@ -10,6 +11,7 @@
 #include <linux/dma-buf.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
 #include <linux/property.h>
 #include <linux/spi/spi.h>
 #include <video/mipi_display.h>
@@ -37,12 +39,28 @@
 #define ST7735R_MY	BIT(7)
 #define ST7735R_MX	BIT(6)
 #define ST7735R_MV	BIT(5)
+#define ST7735R_RGB	BIT(3)
+
+struct st7735r_cfg {
+	const struct drm_display_mode mode;
+	unsigned int left_offset;
+	unsigned int top_offset;
+	unsigned int write_only:1;
+	unsigned int rgb:1;		/* RGB (vs. BGR) */
+};
+
+struct st7735r_priv {
+	struct mipi_dbi_dev dbidev;	/* Must be first for .release() */
+	const struct st7735r_cfg *cfg;
+};
 
-static void jd_t18003_t01_pipe_enable(struct drm_simple_display_pipe *pipe,
-				      struct drm_crtc_state *crtc_state,
-				      struct drm_plane_state *plane_state)
+static void st7735r_pipe_enable(struct drm_simple_display_pipe *pipe,
+				struct drm_crtc_state *crtc_state,
+				struct drm_plane_state *plane_state)
 {
 	struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(pipe->crtc.dev);
+	struct st7735r_priv *priv = container_of(dbidev, struct st7735r_priv,
+						 dbidev);
 	struct mipi_dbi *dbi = &dbidev->dbi;
 	int ret, idx;
 	u8 addr_mode;
@@ -87,6 +105,10 @@ static void jd_t18003_t01_pipe_enable(struct drm_simple_display_pipe *pipe,
 		addr_mode = ST7735R_MY | ST7735R_MV;
 		break;
 	}
+
+	if (priv->cfg->rgb)
+		addr_mode |= ST7735R_RGB;
+
 	mipi_dbi_command(dbi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode);
 	mipi_dbi_command(dbi, MIPI_DCS_SET_PIXEL_FORMAT,
 			 MIPI_DCS_PIXEL_FMT_16BIT);
@@ -109,15 +131,19 @@ static void jd_t18003_t01_pipe_enable(struct drm_simple_display_pipe *pipe,
 	drm_dev_exit(idx);
 }
 
-static const struct drm_simple_display_pipe_funcs jd_t18003_t01_pipe_funcs = {
-	.enable		= jd_t18003_t01_pipe_enable,
+static const struct drm_simple_display_pipe_funcs st7735r_pipe_funcs = {
+	.enable		= st7735r_pipe_enable,
 	.disable	= mipi_dbi_pipe_disable,
 	.update		= mipi_dbi_pipe_update,
 	.prepare_fb	= drm_gem_fb_simple_display_pipe_prepare_fb,
 };
 
-static const struct drm_display_mode jd_t18003_t01_mode = {
-	DRM_SIMPLE_MODE(128, 160, 28, 35),
+static const struct st7735r_cfg jd_t18003_t01_cfg = {
+	.mode		= { DRM_SIMPLE_MODE(128, 160, 28, 35) },
+	/* Cannot read from Adafruit 1.8" display via SPI */
+	.write_only	= true,
+};
+
 };
 
 DEFINE_DRM_GEM_CMA_FOPS(st7735r_fops);
@@ -136,13 +162,13 @@ static struct drm_driver st7735r_driver = {
 };
 
 static const struct of_device_id st7735r_of_match[] = {
-	{ .compatible = "jianda,jd-t18003-t01" },
+	{ .compatible = "jianda,jd-t18003-t01", .data = &jd_t18003_t01_cfg },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, st7735r_of_match);
 
 static const struct spi_device_id st7735r_id[] = {
-	{ "jd-t18003-t01", 0 },
+	{ "jd-t18003-t01", (uintptr_t)&jd_t18003_t01_cfg },
 	{ },
 };
 MODULE_DEVICE_TABLE(spi, st7735r_id);
@@ -150,17 +176,26 @@ MODULE_DEVICE_TABLE(spi, st7735r_id);
 static int st7735r_probe(struct spi_device *spi)
 {
 	struct device *dev = &spi->dev;
+	const struct st7735r_cfg *cfg;
 	struct mipi_dbi_dev *dbidev;
+	struct st7735r_priv *priv;
 	struct drm_device *drm;
 	struct mipi_dbi *dbi;
 	struct gpio_desc *dc;
 	u32 rotation = 0;
 	int ret;
 
-	dbidev = kzalloc(sizeof(*dbidev), GFP_KERNEL);
-	if (!dbidev)
+	cfg = of_device_get_match_data(&spi->dev);
+	if (!cfg)
+		cfg = (void *)spi_get_device_id(spi)->driver_data;
+
+	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+	if (!priv)
 		return -ENOMEM;
 
+	dbidev = &priv->dbidev;
+	priv->cfg = cfg;
+
 	dbi = &dbidev->dbi;
 	drm = &dbidev->drm;
 	ret = devm_drm_dev_init(dev, drm, &st7735r_driver);
@@ -193,10 +228,14 @@ static int st7735r_probe(struct spi_device *spi)
 	if (ret)
 		return ret;
 
-	/* Cannot read from Adafruit 1.8" display via SPI */
-	dbi->read_commands = NULL;
+	if (cfg->write_only)
+		dbi->read_commands = NULL;
+
+	dbidev->left_offset = cfg->left_offset;
+	dbidev->top_offset = cfg->top_offset;
 
-	ret = mipi_dbi_dev_init(dbidev, &jd_t18003_t01_pipe_funcs, &jd_t18003_t01_mode, rotation);
+	ret = mipi_dbi_dev_init(dbidev, &st7735r_pipe_funcs, &cfg->mode,
+				rotation);
 	if (ret)
 		return ret;
 
Signature · 6 lines
2.17.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#16 lore raw

PATCH v2 5/5 drm: tiny: st7735r: Add support for Okaya RH128128T

In reply to Geert Uytterhoeven

Add support for the Okaya RH128128T display to the st7735r driver on DT-enabled systems.

The RH128128T is a 128x128 1.44" TFT display driven by a Sitronix ST7715R TFT Controller/Driver. The latter is very similar to the ST7735R, and can be handled by the existing st7735r driver.

---
v2:
- Split in two patches,
- Update Kconfig help text,
- Improve file comment header.

---
 drivers/gpu/drm/tiny/Kconfig   | 8 +++++---
 drivers/gpu/drm/tiny/st7735r.c | 9 ++++++++-
 2 files changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/tiny/Kconfig +5 -3
index a46ac284dd5e9211..a8664211123e7025 100644
@@ -85,14 +85,16 @@ config TINYDRM_ST7586
 	  If M is selected the module will be called st7586.
 
 config TINYDRM_ST7735R
-	tristate "DRM support for Sitronix ST7735R display panels"
+	tristate "DRM support for Sitronix ST7715R/ST7735R display panels"
 	depends on DRM && SPI
 	select DRM_KMS_HELPER
 	select DRM_KMS_CMA_HELPER
 	select DRM_MIPI_DBI
 	select BACKLIGHT_CLASS_DEVICE
 	help
-	  DRM driver Sitronix ST7735R with one of the following LCDs:
-	  * JD-T18003-T01 1.8" 128x160 TFT
+	  DRM driver for Sitronix ST7715R/ST7735R with one of the following
+	  LCDs:
+	  * Jianda JD-T18003-T01 1.8" 128x160 TFT
+	  * Okaya RH128128T 1.44" 128x128 TFT
 
 	  If M is selected the module will be called st7735r.
drivers/gpu/drm/tiny/st7735r.c +8 -1
index a838f237c8d82e3d..32574f1b60716390 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * DRM driver for Sitronix ST7735R panels
+ * DRM driver for display panels connected to a Sitronix ST7715R or ST7735R
+ * display controller in SPI mode.
  *
  * Copyright 2017 David Lechner <[email protected]>
  * Copyright (C) 2019 Glider bvba
@@ -144,6 +145,11 @@ static const struct st7735r_cfg jd_t18003_t01_cfg = {
 	.write_only	= true,
 };
 
+static const struct st7735r_cfg rh128128t_cfg = {
+	.mode		= { DRM_SIMPLE_MODE(128, 128, 25, 26) },
+	.left_offset	= 2,
+	.top_offset	= 3,
+	.rgb		= true,
 };
 
 DEFINE_DRM_GEM_CMA_FOPS(st7735r_fops);
@@ -163,6 +169,7 @@ static struct drm_driver st7735r_driver = {
 
 static const struct of_device_id st7735r_of_match[] = {
 	{ .compatible = "jianda,jd-t18003-t01", .data = &jd_t18003_t01_cfg },
+	{ .compatible = "okaya,rh128128t", .data = &rh128128t_cfg },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, st7735r_of_match);
Signature · 1 line
2.17.1
#17 lore raw
In reply to Geert Uytterhoeven

Hi Geert.

Quoted 35 lines · Geert Uytterhoeven

Hi all,

This patch series adds support for the Okaya RH128128T LCD to the existing ST7735R driver. This is a 128x128 1.4" TFT display driven by a Sitronix ST7715R TFT Controller/Driver. It is used on e.g. the Renesas YRSK-LCD-PMOD extension board, which is shipped with Renesas RSK+RZA1 development boards[1], and with several other Renesas starter kits, for RX, Synergy, and RZ/T1 MCUs and SoCs.

Changes compared to v1[2]:
- Convert DT bindings to DT schema,
- Add YRSK-LCD-PMOD reference and links,
- Add Reviewed-by,
- Split driver preparation and adding actual support in two separate patches,
- Replace st7735r_priv.rgb by a pointer to struct st7735r_cfg,
- Change prefix of jd_t18003_t01_pipe_enable() and

    jd_t18003_t01_pipe_funcs(),

- Update Kconfig help text,
- Improve file comment header.

This has been tested using the r7s72100-rskrza1-pmod-spi.dtso and r7s72100-rskrza1-pmod2-lcd.dtso DT overlays[3].
Note that for using this on RSK+RZA1, there is a dependency on RSPI cs-gpios support (now in linux-next).
With DT overlays, this also depends on DT overlays[4] and gpio-hog overlay support[5].

Thanks!

[1] https://renesasrulz.com/the_vault/f/archive-forum/4981/upgrading-to-the-renesas-rz-a1h
[1] https://lore.kernel.org/dri-devel/[email protected]/
[2] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/log/?h=topic/renesas-overlays
[4] https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git/log/?h=topic/overlays
[5] "[PATCH/RFC 0/2] gpio: of: Add DT overlay support for GPIO hogs"

Quoted 8 lines
    https://lore.kernel.org/lkml/[email protected]/

Geert Uytterhoeven (5):
dt-bindings: display: sitronix,st7735r: Convert to DT schema
dt-bindings: display: sitronix,st7735r: Add Okaya RH128128T drm/mipi_dbi: Add support for display offsets
drm: tiny: st7735r: Prepare for adding support for more displays
drm: tiny: st7735r: Add support for Okaya RH128128T

Thanks, it ended up with a nice small patch adding support for another controller/panel combo to this driver.
All 5 patches applied to drm-misc-next.

Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel