Skip to contentSkip to conversation

drm: rcar-du: V3U Support

PATCH In review Kieran Bingham 4 participants 13 messages Sep 22, 2021 – Sep 28, 2021

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

v3 cover drm: rcar-du: V3U Support

Extend support for the V3U Display Unit.

The V3U DU support can be tested on a Falcon-V3U making use of the DSI encoder from Laurent.

Patch 1 updates the bindings for the DU to cover the V3U platform.

Patch 2 just cleans up in preparation for patch 6, and patch 3 is required for operation on the V3U, however it is functional and should be correct for the D3 and E3 as well, as they also lack external sync.

Patch 4 is a further clean up to fix the naming of fields identified as incorrect while developing.

Patch 5 splits the RCAR_DU_FEATURE_CRTC_IRQ_CLOCK feature flag into two separate components, allowing the V3U to select RCAR_DU_FEATURE_CRTC_IRQ without RCAR_DU_FEATURE_CRTC_CLOCK.

And finally, Patch 6 enables the V3U and connects it to the MIPI DSI encoder.

Tests have been run and produce images - but there are artifacts visible and some modes are unavailable, which will need further investigations, but can be done on top of this integration.

Kieran Bingham (6):
dt-bindings: display: renesas,du: Provide bindings for r8a779a0
drm: rcar-du: Sort the DU outputs
drm: rcar-du: Only initialise TVM_TVSYNC mode when supported
drm: rcar-du: Fix DIDSR field name
drm: rcar-du: Split CRTC IRQ and Clock features
drm: rcar-du: Add r8a779a0 device support

 .../bindings/display/renesas,du.yaml          | 50 ++++++++++++++
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c        |  9 ++-
 drivers/gpu/drm/rcar-du/rcar_du_crtc.h        |  6 +-
 drivers/gpu/drm/rcar-du/rcar_du_drv.c         | 68 ++++++++++++++-----
 drivers/gpu/drm/rcar-du/rcar_du_drv.h         | 11 +--
 drivers/gpu/drm/rcar-du/rcar_du_group.c       |  6 +-
 drivers/gpu/drm/rcar-du/rcar_du_regs.h        |  9 +--
 7 files changed, 128 insertions(+), 31 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH v3 1/6 dt-bindings: display: renesas,du: Provide bindings for r8a779a0

From: Kieran Bingham <[email protected]>

Extend the Renesas DU display bindings to support the r8a779a0 V3U.

---
v2:
- Collected Laurent's tag
- Remove clock-names requirement
- Specify only a single clock

v3:
- Use clocknames: 'du.0' instead of 'du' to remain consistent

 .../bindings/display/renesas,du.yaml          | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
Documentation/devicetree/bindings/display/renesas,du.yaml +50 -0
index e3ca5389c17d..6db6a3f15395 100644
@@ -39,6 +39,7 @@ properties:
       - renesas,du-r8a77980 # for R-Car V3H compatible DU
       - renesas,du-r8a77990 # for R-Car E3 compatible DU
       - renesas,du-r8a77995 # for R-Car D3 compatible DU
+      - renesas,du-r8a779a0 # for R-Car V3U compatible DU
 
   reg:
     maxItems: 1
@@ -773,6 +774,55 @@ allOf:
         - reset-names
         - renesas,vsps
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - renesas,du-r8a779a0
+    then:
+      properties:
+        clocks:
+          items:
+            - description: Functional clock
+
+        clock-names:
+          maxItems: 1
+          items:
+            - const: du.0
+
+        interrupts:
+          maxItems: 2
+
+        resets:
+          maxItems: 1
+
+        reset-names:
+          items:
+            - const: du.0
+
+        ports:
+          properties:
+            port@0:
+              description: DSI 0
+            port@1:
+              description: DSI 1
+            port@2: false
+            port@3: false
+
+          required:
+            - port@0
+            - port@1
+
+        renesas,vsps:
+          minItems: 2
+
+      required:
+        - interrupts
+        - resets
+        - reset-names
+        - renesas,vsps
+
 additionalProperties: false
 
 examples:
Signature · 1 line
2.30.2
Reviewed-by on v3 1/6
#2 lore raw

Re: [PATCH v3 1/6] dt-bindings: display: renesas,du: Provide bindings for r8a779a0

Hi Kieran,

Quoted 7 lines · Kieran Bingham

From: Kieran Bingham <[email protected]>

Extend the Renesas DU display bindings to support the r8a779a0 V3U.

Quoted 8 lines

---
v2:
- Collected Laurent's tag
- Remove clock-names requirement
- Specify only a single clock

v3:
- Use clocknames: 'du.0' instead of 'du' to remain consistent

Thanks for the update!

Quoted 52 lines
Documentation/devicetree/bindings/display/renesas,du.yaml +39 -0
@@ -39,6 +39,7 @@ properties:
       - renesas,du-r8a77980 # for R-Car V3H compatible DU
       - renesas,du-r8a77990 # for R-Car E3 compatible DU
       - renesas,du-r8a77995 # for R-Car D3 compatible DU
+      - renesas,du-r8a779a0 # for R-Car V3U compatible DU
 
   reg:
     maxItems: 1
@@ -773,6 +774,55 @@ allOf:
         - reset-names
         - renesas,vsps
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - renesas,du-r8a779a0
+    then:
+      properties:
+        clocks:
+          items:
+            - description: Functional clock
+
+        clock-names:
+          maxItems: 1
+          items:
+            - const: du.0
+
+        interrupts:
+          maxItems: 2
+
+        resets:
+          maxItems: 1
+
+        reset-names:
+          items:
+            - const: du.0
+
+        ports:
+          properties:
+            port@0:
+              description: DSI 0
+            port@1:
+              description: DSI 1
+            port@2: false
+            port@3: false
+
+          required:
+            - port@0

Documentation/devicetree/bindings/display/renesas,du.yaml allOf: · line 824

Quoted 10 lines
Documentation/devicetree/bindings/display/renesas,du.yaml +10 -0
+            - port@1
+
+        renesas,vsps:
+          minItems: 2
+
+      required:
+        - interrupts
+        - resets
+        - reset-names
+        - renesas,vsps

clock-names, for consistency?

Documentation/devicetree/bindings/display/renesas,du.yaml allOf: · line 828

Quoted 4 lines
Documentation/devicetree/bindings/display/renesas,du.yaml +1 -0
+
 additionalProperties: false
 
 examples:

With the above fixed:

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
#3 lore raw

PATCH 1/1 dt-bindings: display: renesas,du: Provide bindings for r8a779a0

In reply to Kieran Bingham

From: Kieran Bingham <[email protected]>

Extend the Renesas DU display bindings to support the r8a779a0 V3U.

---
v2:
- Collected Laurent's tag
- Remove clock-names requirement
- Specify only a single clock

v3:
- Use clocknames: 'du.0' instead of 'du' to remain consistent

v3.1:
- Require clock-names
- Collect Geert's tag

 .../bindings/display/renesas,du.yaml          | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
Documentation/devicetree/bindings/display/renesas,du.yaml +51 -0
index e3ca5389c17d..13efea574584 100644
@@ -39,6 +39,7 @@ properties:
       - renesas,du-r8a77980 # for R-Car V3H compatible DU
       - renesas,du-r8a77990 # for R-Car E3 compatible DU
       - renesas,du-r8a77995 # for R-Car D3 compatible DU
+      - renesas,du-r8a779a0 # for R-Car V3U compatible DU
 
   reg:
     maxItems: 1
@@ -773,6 +774,56 @@ allOf:
         - reset-names
         - renesas,vsps
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - renesas,du-r8a779a0
+    then:
+      properties:
+        clocks:
+          items:
+            - description: Functional clock
+
+        clock-names:
+          maxItems: 1
+          items:
+            - const: du.0
+
+        interrupts:
+          maxItems: 2
+
+        resets:
+          maxItems: 1
+
+        reset-names:
+          items:
+            - const: du.0
+
+        ports:
+          properties:
+            port@0:
+              description: DSI 0
+            port@1:
+              description: DSI 1
+            port@2: false
+            port@3: false
+
+          required:
+            - port@0
+            - port@1
+
+        renesas,vsps:
+          minItems: 2
+
+      required:
+        - clock-names
+        - interrupts
+        - resets
+        - reset-names
+        - renesas,vsps
+
 additionalProperties: false
 
 examples:
Signature · 1 line
2.30.2
maintainer Reviewed-by on v1 1/1
#4 lore raw

Re: [PATCH v3.1] dt-bindings: display: renesas,du: Provide bindings for r8a779a0

Quoted 17 lines · Kieran Bingham

From: Kieran Bingham <[email protected]>

Extend the Renesas DU display bindings to support the r8a779a0 V3U.

---
v2:
- Collected Laurent's tag
- Remove clock-names requirement
- Specify only a single clock

v3:
- Use clocknames: 'du.0' instead of 'du' to remain consistent

Quoted 7 lines

v3.1:
- Require clock-names
- Collect Geert's tag

 .../bindings/display/renesas,du.yaml          | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)
#5 lore raw

Re: [PATCH v3.1] dt-bindings: display: renesas,du: Provide bindings for r8a779a0

Quoted 18 lines · Rob Herring
Quoted 17 lines · Kieran Bingham

From: Kieran Bingham <[email protected]>

Extend the Renesas DU display bindings to support the r8a779a0 V3U.

---
v2:
- Collected Laurent's tag
- Remove clock-names requirement
- Specify only a single clock

v3:
- Use clocknames: 'du.0' instead of 'du' to remain consistent

Quoted 8 lines
Quoted 6 lines

v3.1:
- Require clock-names
- Collect Geert's tag

 .../bindings/display/renesas,du.yaml          | 51 +++++++++++++++++++
 1 file changed, 51 insertions(+)

Thank you Rob, that was the missing piece for a pull request :-)

Signature · 3 lines
Regards,

Laurent Pinchart
#6 lore raw

PATCH v3 2/6 drm: rcar-du: Sort the DU outputs

In reply to Kieran Bingham

From: Kieran Bingham <[email protected]>

Sort the DU outputs alphabetically, with the exception of the final entry which is there as a sentinal.

---
v2:
- Collect tag

 drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_crtc.h +2 -2
index 5f2940c42225..440e6b4fbb58 100644
@@ -96,10 +96,10 @@ struct rcar_du_crtc_state {
 enum rcar_du_output {
 	RCAR_DU_OUTPUT_DPAD0,
 	RCAR_DU_OUTPUT_DPAD1,
-	RCAR_DU_OUTPUT_LVDS0,
-	RCAR_DU_OUTPUT_LVDS1,
 	RCAR_DU_OUTPUT_HDMI0,
 	RCAR_DU_OUTPUT_HDMI1,
+	RCAR_DU_OUTPUT_LVDS0,
+	RCAR_DU_OUTPUT_LVDS1,
 	RCAR_DU_OUTPUT_TCON,
 	RCAR_DU_OUTPUT_MAX,
 };
Signature · 1 line
2.30.2
#7 lore raw

PATCH v3 3/6 drm: rcar-du: Only initialise TVM_TVSYNC mode when supported

In reply to Kieran Bingham

The R-Car DU as found on the D3, E3, and V3U do not have support for an external synchronisation method.

In these cases, the dsysr cached register should not be initialised in DSYSR_TVM_TVSYNC, but instead should be left clear to configure as DSYSR_TVM_MASTER by default.

---
v2:
- Remove parenthesis

 drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/rcar-du/rcar_du_crtc.c +4 -1
index ea7e39d03545..a0f837e8243a 100644
@@ -1243,7 +1243,10 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int swindex,
 	rcrtc->group = rgrp;
 	rcrtc->mmio_offset = mmio_offsets[hwindex];
 	rcrtc->index = hwindex;
-	rcrtc->dsysr = (rcrtc->index % 2 ? 0 : DSYSR_DRES) | DSYSR_TVM_TVSYNC;
+	rcrtc->dsysr = rcrtc->index % 2 ? 0 : DSYSR_DRES;
+
+	if (rcar_du_has(rcdu, RCAR_DU_FEATURE_TVM_SYNC))
+		rcrtc->dsysr |= DSYSR_TVM_TVSYNC;
 
 	if (rcar_du_has(rcdu, RCAR_DU_FEATURE_VSP1_SOURCE))
 		primary = &rcrtc->vsp->planes[rcrtc->vsp_pipe].plane;
Signature · 1 line
2.30.2
#8 lore raw

PATCH v3 4/6 drm: rcar-du: Fix DIDSR field name

In reply to Kieran Bingham

The DIDSR fields named LDCS were incorrectly defined as LCDS. Both the Gen2 and Gen3 documentation refer to the fields as the "LVDS Dot Clock Select".

Correct the definitions.

---
v2:
- New patch

v3:
- Collect tag

 drivers/gpu/drm/rcar-du/rcar_du_group.c | 4 ++--
 drivers/gpu/drm/rcar-du/rcar_du_regs.h  | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_group.c +2 -2
index 88a783ceb3e9..a984eef265d2 100644
@@ -122,10 +122,10 @@ static void rcar_du_group_setup_didsr(struct rcar_du_group *rgrp)
 	didsr = DIDSR_CODE;
 	for (i = 0; i < num_crtcs; ++i, ++rcrtc) {
 		if (rcdu->info->lvds_clk_mask & BIT(rcrtc->index))
-			didsr |= DIDSR_LCDS_LVDS0(i)
+			didsr |= DIDSR_LDCS_LVDS0(i)
 			      |  DIDSR_PDCS_CLK(i, 0);
 		else
-			didsr |= DIDSR_LCDS_DCLKIN(i)
+			didsr |= DIDSR_LDCS_DCLKIN(i)
 			      |  DIDSR_PDCS_CLK(i, 0);
 	}
 
drivers/gpu/drm/rcar-du/rcar_du_regs.h +4 -4
index fb9964949368..fb7c467aa484 100644
@@ -257,10 +257,10 @@
 
 #define DIDSR			0x20028
 #define DIDSR_CODE		(0x7790 << 16)
-#define DIDSR_LCDS_DCLKIN(n)	(0 << (8 + (n) * 2))
-#define DIDSR_LCDS_LVDS0(n)	(2 << (8 + (n) * 2))
-#define DIDSR_LCDS_LVDS1(n)	(3 << (8 + (n) * 2))
-#define DIDSR_LCDS_MASK(n)	(3 << (8 + (n) * 2))
+#define DIDSR_LDCS_DCLKIN(n)	(0 << (8 + (n) * 2))
+#define DIDSR_LDCS_LVDS0(n)	(2 << (8 + (n) * 2))
+#define DIDSR_LDCS_LVDS1(n)	(3 << (8 + (n) * 2))
+#define DIDSR_LDCS_MASK(n)	(3 << (8 + (n) * 2))
 #define DIDSR_PDCS_CLK(n, clk)	(clk << ((n) * 2))
 #define DIDSR_PDCS_MASK(n)	(3 << ((n) * 2))
 
Signature · 1 line
2.30.2
#9 lore raw

PATCH v3 5/6 drm: rcar-du: Split CRTC IRQ and Clock features

In reply to Kieran Bingham

Not all platforms require both per-crtc IRQ and per-crtc clock management. In preparation for suppporting such platforms, split the feature macro to be able to specify both features independently.

The other features are incremented accordingly, to keep the two crtc features adjacent.

---
v2:
- New patch

v3:
- Collect tag

 drivers/gpu/drm/rcar-du/rcar_du_crtc.c |  4 +--
 drivers/gpu/drm/rcar-du/rcar_du_drv.c  | 48 +++++++++++++++++---------
 drivers/gpu/drm/rcar-du/rcar_du_drv.h  |  9 ++---
 3 files changed, 39 insertions(+), 22 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_crtc.c +2 -2
index a0f837e8243a..5672830ca184 100644
@@ -1206,7 +1206,7 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int swindex,
 	int ret;
 
 	/* Get the CRTC clock and the optional external clock. */
-	if (rcar_du_has(rcdu, RCAR_DU_FEATURE_CRTC_IRQ_CLOCK)) {
+	if (rcar_du_has(rcdu, RCAR_DU_FEATURE_CRTC_CLOCK)) {
 		sprintf(clk_name, "du.%u", hwindex);
 		name = clk_name;
 	} else {
@@ -1272,7 +1272,7 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int swindex,
 	drm_crtc_helper_add(crtc, &crtc_helper_funcs);
 
 	/* Register the interrupt handler. */
-	if (rcar_du_has(rcdu, RCAR_DU_FEATURE_CRTC_IRQ_CLOCK)) {
+	if (rcar_du_has(rcdu, RCAR_DU_FEATURE_CRTC_IRQ)) {
 		/* The IRQ's are associated with the CRTC (sw)index. */
 		irq = platform_get_irq(pdev, swindex);
 		irqflags = 0;
drivers/gpu/drm/rcar-du/rcar_du_drv.c +32 -16

144 lines not on this page · raw message

drivers/gpu/drm/rcar-du/rcar_du_drv.h +5 -4
index 02ca2d0e1b55..5fe9152454ff 100644
@@ -26,10 +26,11 @@ struct drm_bridge;
 struct drm_property;
 struct rcar_du_device;
 
-#define RCAR_DU_FEATURE_CRTC_IRQ_CLOCK	BIT(0)	/* Per-CRTC IRQ and clock */
-#define RCAR_DU_FEATURE_VSP1_SOURCE	BIT(1)	/* Has inputs from VSP1 */
-#define RCAR_DU_FEATURE_INTERLACED	BIT(2)	/* HW supports interlaced */
-#define RCAR_DU_FEATURE_TVM_SYNC	BIT(3)	/* Has TV switch/sync modes */
+#define RCAR_DU_FEATURE_CRTC_IRQ	BIT(0)	/* Per-CRTC IRQ */
+#define RCAR_DU_FEATURE_CRTC_CLOCK	BIT(1)	/* Per-CRTC clock */
+#define RCAR_DU_FEATURE_VSP1_SOURCE	BIT(2)	/* Has inputs from VSP1 */
+#define RCAR_DU_FEATURE_INTERLACED	BIT(3)	/* HW supports interlaced */
+#define RCAR_DU_FEATURE_TVM_SYNC	BIT(4)	/* Has TV switch/sync modes */
 
 #define RCAR_DU_QUIRK_ALIGN_128B	BIT(0)	/* Align pitches to 128 bytes */
 
Signature · 1 line
2.30.2
#10 lore raw

PATCH v3 6/6 drm: rcar-du: Add r8a779a0 device support

In reply to Kieran Bingham

From: Kieran Bingham <[email protected]>

Extend the rcar_du_device_info structure and rcar_du_output enum to support DSI outputs and utilise these additions to provide support for the R8A779A0 V3U platform.

While the DIDSR register field is now named "DSI/CSI-2-TX-IF0 Dot Clock Select" the existing define LVDS0 is used, and is directly compatible from other DU variants.

---

v3:
- Introduce DIDSR_LDCS_DSI macro

v2:
- No longer requires a direct interface with the DSI encoder
- Use correct field naming (LDCS)
- Remove per-crtc clock feature.

 drivers/gpu/drm/rcar-du/rcar_du_crtc.h  |  2 ++
 drivers/gpu/drm/rcar-du/rcar_du_drv.c   | 20 ++++++++++++++++++++
 drivers/gpu/drm/rcar-du/rcar_du_drv.h   |  2 ++
 drivers/gpu/drm/rcar-du/rcar_du_group.c |  2 ++
 drivers/gpu/drm/rcar-du/rcar_du_regs.h  |  1 +
 5 files changed, 27 insertions(+)
drivers/gpu/drm/rcar-du/rcar_du_crtc.h +2 -0
index 440e6b4fbb58..26e79b74898c 100644
@@ -96,6 +96,8 @@ struct rcar_du_crtc_state {
 enum rcar_du_output {
 	RCAR_DU_OUTPUT_DPAD0,
 	RCAR_DU_OUTPUT_DPAD1,
+	RCAR_DU_OUTPUT_DSI0,
+	RCAR_DU_OUTPUT_DSI1,
 	RCAR_DU_OUTPUT_HDMI0,
 	RCAR_DU_OUTPUT_HDMI1,
 	RCAR_DU_OUTPUT_LVDS0,
drivers/gpu/drm/rcar-du/rcar_du_drv.c +20 -0
index 8a094d5b9c77..8b4c8851b6bc 100644
@@ -489,6 +489,25 @@ static const struct rcar_du_device_info rcar_du_r8a7799x_info = {
 	.lvds_clk_mask =  BIT(1) | BIT(0),
 };
 
+static const struct rcar_du_device_info rcar_du_r8a779a0_info = {
+	.gen = 3,
+	.features = RCAR_DU_FEATURE_CRTC_IRQ
+		  | RCAR_DU_FEATURE_VSP1_SOURCE,
+	.channels_mask = BIT(1) | BIT(0),
+	.routes = {
+		/* R8A779A0 has two MIPI DSI outputs. */
+		[RCAR_DU_OUTPUT_DSI0] = {
+			.possible_crtcs = BIT(0),
+			.port = 0,
+		},
+		[RCAR_DU_OUTPUT_DSI1] = {
+			.possible_crtcs = BIT(1),
+			.port = 1,
+		},
+	},
+	.dsi_clk_mask =  BIT(1) | BIT(0),
+};
+
 static const struct of_device_id rcar_du_of_table[] = {
 	{ .compatible = "renesas,du-r8a7742", .data = &rcar_du_r8a7790_info },
 	{ .compatible = "renesas,du-r8a7743", .data = &rzg1_du_r8a7743_info },
@@ -513,6 +532,7 @@ static const struct of_device_id rcar_du_of_table[] = {
 	{ .compatible = "renesas,du-r8a77980", .data = &rcar_du_r8a77970_info },
 	{ .compatible = "renesas,du-r8a77990", .data = &rcar_du_r8a7799x_info },
 	{ .compatible = "renesas,du-r8a77995", .data = &rcar_du_r8a7799x_info },
+	{ .compatible = "renesas,du-r8a779a0", .data = &rcar_du_r8a779a0_info },
 	{ }
 };
 
drivers/gpu/drm/rcar-du/rcar_du_drv.h +2 -0
index 5fe9152454ff..cf98d43d72d0 100644
@@ -57,6 +57,7 @@ struct rcar_du_output_routing {
  * @routes: array of CRTC to output routes, indexed by output (RCAR_DU_OUTPUT_*)
  * @num_lvds: number of internal LVDS encoders
  * @dpll_mask: bit mask of DU channels equipped with a DPLL
+ * @dsi_clk_mask: bitmask of channels that can use the DSI clock as dot clock
  * @lvds_clk_mask: bitmask of channels that can use the LVDS clock as dot clock
  */
 struct rcar_du_device_info {
@@ -67,6 +68,7 @@ struct rcar_du_device_info {
 	struct rcar_du_output_routing routes[RCAR_DU_OUTPUT_MAX];
 	unsigned int num_lvds;
 	unsigned int dpll_mask;
+	unsigned int dsi_clk_mask;
 	unsigned int lvds_clk_mask;
 };
 
drivers/gpu/drm/rcar-du/rcar_du_group.c +2 -0
index a984eef265d2..8665a1dd2186 100644
@@ -124,6 +124,8 @@ static void rcar_du_group_setup_didsr(struct rcar_du_group *rgrp)
 		if (rcdu->info->lvds_clk_mask & BIT(rcrtc->index))
 			didsr |= DIDSR_LDCS_LVDS0(i)
 			      |  DIDSR_PDCS_CLK(i, 0);
+		else if (rcdu->info->dsi_clk_mask & BIT(rcrtc->index))
+			didsr |= DIDSR_LDCS_DSI(i);
 		else
 			didsr |= DIDSR_LDCS_DCLKIN(i)
 			      |  DIDSR_PDCS_CLK(i, 0);
drivers/gpu/drm/rcar-du/rcar_du_regs.h +1 -0
index fb7c467aa484..9484215b51e2 100644
@@ -258,6 +258,7 @@
 #define DIDSR			0x20028
 #define DIDSR_CODE		(0x7790 << 16)
 #define DIDSR_LDCS_DCLKIN(n)	(0 << (8 + (n) * 2))
+#define DIDSR_LDCS_DSI(n)	(2 << (8 + (n) * 2))
 #define DIDSR_LDCS_LVDS0(n)	(2 << (8 + (n) * 2))
 #define DIDSR_LDCS_LVDS1(n)	(3 << (8 + (n) * 2))
 #define DIDSR_LDCS_MASK(n)	(3 << (8 + (n) * 2))
Signature · 1 line
2.30.2
#11 lore raw

Re: [PATCH v3 6/6] drm: rcar-du: Add r8a779a0 device support

Hi Kieran,

Thank you for the patch.

Quoted 9 lines · Kieran Bingham

From: Kieran Bingham <[email protected]>

Extend the rcar_du_device_info structure and rcar_du_output enum to support DSI outputs and utilise these additions to provide support for the R8A779A0 V3U platform.

While the DIDSR register field is now named "DSI/CSI-2-TX-IF0 Dot Clock Select" the existing define LVDS0 is used, and is directly compatible from other DU variants.

That's not true anymore :-) The paragraph can simply be dropped.

Quoted 108 lines

---

v3:
- Introduce DIDSR_LDCS_DSI macro

v2:
- No longer requires a direct interface with the DSI encoder
- Use correct field naming (LDCS)
- Remove per-crtc clock feature.

 drivers/gpu/drm/rcar-du/rcar_du_crtc.h  |  2 ++
 drivers/gpu/drm/rcar-du/rcar_du_drv.c   | 20 ++++++++++++++++++++
 drivers/gpu/drm/rcar-du/rcar_du_drv.h   |  2 ++
 drivers/gpu/drm/rcar-du/rcar_du_group.c |  2 ++
 drivers/gpu/drm/rcar-du/rcar_du_regs.h  |  1 +
 5 files changed, 27 insertions(+)
drivers/gpu/drm/rcar-du/rcar_du_crtc.h +2 -0
index 440e6b4fbb58..26e79b74898c 100644
@@ -96,6 +96,8 @@ struct rcar_du_crtc_state {
 enum rcar_du_output {
 	RCAR_DU_OUTPUT_DPAD0,
 	RCAR_DU_OUTPUT_DPAD1,
+	RCAR_DU_OUTPUT_DSI0,
+	RCAR_DU_OUTPUT_DSI1,
 	RCAR_DU_OUTPUT_HDMI0,
 	RCAR_DU_OUTPUT_HDMI1,
 	RCAR_DU_OUTPUT_LVDS0,
drivers/gpu/drm/rcar-du/rcar_du_drv.c +20 -0
index 8a094d5b9c77..8b4c8851b6bc 100644
@@ -489,6 +489,25 @@ static const struct rcar_du_device_info rcar_du_r8a7799x_info = {
 	.lvds_clk_mask =  BIT(1) | BIT(0),
 };
 
+static const struct rcar_du_device_info rcar_du_r8a779a0_info = {
+	.gen = 3,
+	.features = RCAR_DU_FEATURE_CRTC_IRQ
+		  | RCAR_DU_FEATURE_VSP1_SOURCE,
+	.channels_mask = BIT(1) | BIT(0),
+	.routes = {
+		/* R8A779A0 has two MIPI DSI outputs. */
+		[RCAR_DU_OUTPUT_DSI0] = {
+			.possible_crtcs = BIT(0),
+			.port = 0,
+		},
+		[RCAR_DU_OUTPUT_DSI1] = {
+			.possible_crtcs = BIT(1),
+			.port = 1,
+		},
+	},
+	.dsi_clk_mask =  BIT(1) | BIT(0),
+};
+
 static const struct of_device_id rcar_du_of_table[] = {
 	{ .compatible = "renesas,du-r8a7742", .data = &rcar_du_r8a7790_info },
 	{ .compatible = "renesas,du-r8a7743", .data = &rzg1_du_r8a7743_info },
@@ -513,6 +532,7 @@ static const struct of_device_id rcar_du_of_table[] = {
 	{ .compatible = "renesas,du-r8a77980", .data = &rcar_du_r8a77970_info },
 	{ .compatible = "renesas,du-r8a77990", .data = &rcar_du_r8a7799x_info },
 	{ .compatible = "renesas,du-r8a77995", .data = &rcar_du_r8a7799x_info },
+	{ .compatible = "renesas,du-r8a779a0", .data = &rcar_du_r8a779a0_info },
 	{ }
 };
 
drivers/gpu/drm/rcar-du/rcar_du_drv.h +2 -0
index 5fe9152454ff..cf98d43d72d0 100644
@@ -57,6 +57,7 @@ struct rcar_du_output_routing {
  * @routes: array of CRTC to output routes, indexed by output (RCAR_DU_OUTPUT_*)
  * @num_lvds: number of internal LVDS encoders
  * @dpll_mask: bit mask of DU channels equipped with a DPLL
+ * @dsi_clk_mask: bitmask of channels that can use the DSI clock as dot clock
  * @lvds_clk_mask: bitmask of channels that can use the LVDS clock as dot clock
  */
 struct rcar_du_device_info {
@@ -67,6 +68,7 @@ struct rcar_du_device_info {
 	struct rcar_du_output_routing routes[RCAR_DU_OUTPUT_MAX];
 	unsigned int num_lvds;
 	unsigned int dpll_mask;
+	unsigned int dsi_clk_mask;
 	unsigned int lvds_clk_mask;
 };
 
drivers/gpu/drm/rcar-du/rcar_du_group.c +2 -0
index a984eef265d2..8665a1dd2186 100644
@@ -124,6 +124,8 @@ static void rcar_du_group_setup_didsr(struct rcar_du_group *rgrp)
 		if (rcdu->info->lvds_clk_mask & BIT(rcrtc->index))
 			didsr |= DIDSR_LDCS_LVDS0(i)
 			      |  DIDSR_PDCS_CLK(i, 0);
+		else if (rcdu->info->dsi_clk_mask & BIT(rcrtc->index))
+			didsr |= DIDSR_LDCS_DSI(i);
 		else
 			didsr |= DIDSR_LDCS_DCLKIN(i)
 			      |  DIDSR_PDCS_CLK(i, 0);
drivers/gpu/drm/rcar-du/rcar_du_regs.h +0 -0
index fb7c467aa484..9484215b51e2 100644

drivers/gpu/drm/rcar-du/rcar_du_regs.h line 261

Quoted 4 lines
drivers/gpu/drm/rcar-du/rcar_du_regs.h +1 -0
@@ -258,6 +258,7 @@
 #define DIDSR			0x20028
 #define DIDSR_CODE		(0x7790 << 16)
 #define DIDSR_LDCS_DCLKIN(n)	(0 << (8 + (n) * 2))
+#define DIDSR_LDCS_DSI(n)	(2 << (8 + (n) * 2))

I'd add a /* V3U only */ comment at the end.

I can address those two small issues when applying.

Quoted 3 lines
drivers/gpu/drm/rcar-du/rcar_du_regs.h +0 -0
 #define DIDSR_LDCS_LVDS0(n)	(2 << (8 + (n) * 2))
 #define DIDSR_LDCS_LVDS1(n)	(3 << (8 + (n) * 2))
 #define DIDSR_LDCS_MASK(n)	(3 << (8 + (n) * 2))
Signature · 3 lines
Regards,

Laurent Pinchart
#12 lore raw

Re: [PATCH v3 6/6] drm: rcar-du: Add r8a779a0 device support

Quoted 11 lines · Laurent Pinchart

Hi Kieran,

Thank you for the patch.

Quoted 6 lines · Kieran Bingham

From: Kieran Bingham <[email protected]>

Extend the rcar_du_device_info structure and rcar_du_output enum to support DSI outputs and utilise these additions to provide support for the R8A779A0 V3U platform.

Quoted 6 lines
Quoted 3 lines

While the DIDSR register field is now named "DSI/CSI-2-TX-IF0 Dot Clock Select" the existing define LVDS0 is used, and is directly compatible from other DU variants.

That's not true anymore :-) The paragraph can simply be dropped.

Agreed.

Quoted 115 lines
Quoted 108 lines

---

v3:
- Introduce DIDSR_LDCS_DSI macro

v2:
- No longer requires a direct interface with the DSI encoder
- Use correct field naming (LDCS)
- Remove per-crtc clock feature.

 drivers/gpu/drm/rcar-du/rcar_du_crtc.h  |  2 ++
 drivers/gpu/drm/rcar-du/rcar_du_drv.c   | 20 ++++++++++++++++++++
 drivers/gpu/drm/rcar-du/rcar_du_drv.h   |  2 ++
 drivers/gpu/drm/rcar-du/rcar_du_group.c |  2 ++
 drivers/gpu/drm/rcar-du/rcar_du_regs.h  |  1 +
 5 files changed, 27 insertions(+)
drivers/gpu/drm/rcar-du/rcar_du_crtc.h +2 -0
index 440e6b4fbb58..26e79b74898c 100644
@@ -96,6 +96,8 @@ struct rcar_du_crtc_state {
 enum rcar_du_output {
 	RCAR_DU_OUTPUT_DPAD0,
 	RCAR_DU_OUTPUT_DPAD1,
+	RCAR_DU_OUTPUT_DSI0,
+	RCAR_DU_OUTPUT_DSI1,
 	RCAR_DU_OUTPUT_HDMI0,
 	RCAR_DU_OUTPUT_HDMI1,
 	RCAR_DU_OUTPUT_LVDS0,
drivers/gpu/drm/rcar-du/rcar_du_drv.c +20 -0
index 8a094d5b9c77..8b4c8851b6bc 100644
@@ -489,6 +489,25 @@ static const struct rcar_du_device_info rcar_du_r8a7799x_info = {
 	.lvds_clk_mask =  BIT(1) | BIT(0),
 };
 
+static const struct rcar_du_device_info rcar_du_r8a779a0_info = {
+	.gen = 3,
+	.features = RCAR_DU_FEATURE_CRTC_IRQ
+		  | RCAR_DU_FEATURE_VSP1_SOURCE,
+	.channels_mask = BIT(1) | BIT(0),
+	.routes = {
+		/* R8A779A0 has two MIPI DSI outputs. */
+		[RCAR_DU_OUTPUT_DSI0] = {
+			.possible_crtcs = BIT(0),
+			.port = 0,
+		},
+		[RCAR_DU_OUTPUT_DSI1] = {
+			.possible_crtcs = BIT(1),
+			.port = 1,
+		},
+	},
+	.dsi_clk_mask =  BIT(1) | BIT(0),
+};
+
 static const struct of_device_id rcar_du_of_table[] = {
 	{ .compatible = "renesas,du-r8a7742", .data = &rcar_du_r8a7790_info },
 	{ .compatible = "renesas,du-r8a7743", .data = &rzg1_du_r8a7743_info },
@@ -513,6 +532,7 @@ static const struct of_device_id rcar_du_of_table[] = {
 	{ .compatible = "renesas,du-r8a77980", .data = &rcar_du_r8a77970_info },
 	{ .compatible = "renesas,du-r8a77990", .data = &rcar_du_r8a7799x_info },
 	{ .compatible = "renesas,du-r8a77995", .data = &rcar_du_r8a7799x_info },
+	{ .compatible = "renesas,du-r8a779a0", .data = &rcar_du_r8a779a0_info },
 	{ }
 };
 
drivers/gpu/drm/rcar-du/rcar_du_drv.h +2 -0
index 5fe9152454ff..cf98d43d72d0 100644
@@ -57,6 +57,7 @@ struct rcar_du_output_routing {
  * @routes: array of CRTC to output routes, indexed by output (RCAR_DU_OUTPUT_*)
  * @num_lvds: number of internal LVDS encoders
  * @dpll_mask: bit mask of DU channels equipped with a DPLL
+ * @dsi_clk_mask: bitmask of channels that can use the DSI clock as dot clock
  * @lvds_clk_mask: bitmask of channels that can use the LVDS clock as dot clock
  */
 struct rcar_du_device_info {
@@ -67,6 +68,7 @@ struct rcar_du_device_info {
 	struct rcar_du_output_routing routes[RCAR_DU_OUTPUT_MAX];
 	unsigned int num_lvds;
 	unsigned int dpll_mask;
+	unsigned int dsi_clk_mask;
 	unsigned int lvds_clk_mask;
 };
 
drivers/gpu/drm/rcar-du/rcar_du_group.c +2 -0
index a984eef265d2..8665a1dd2186 100644
@@ -124,6 +124,8 @@ static void rcar_du_group_setup_didsr(struct rcar_du_group *rgrp)
 		if (rcdu->info->lvds_clk_mask & BIT(rcrtc->index))
 			didsr |= DIDSR_LDCS_LVDS0(i)
 			      |  DIDSR_PDCS_CLK(i, 0);
+		else if (rcdu->info->dsi_clk_mask & BIT(rcrtc->index))
+			didsr |= DIDSR_LDCS_DSI(i);
 		else
 			didsr |= DIDSR_LDCS_DCLKIN(i)
 			      |  DIDSR_PDCS_CLK(i, 0);
drivers/gpu/drm/rcar-du/rcar_du_regs.h +0 -0
index fb7c467aa484..9484215b51e2 100644

drivers/gpu/drm/rcar-du/rcar_du_regs.h line 261

Quoted 4 lines
drivers/gpu/drm/rcar-du/rcar_du_regs.h +1 -0
@@ -258,6 +258,7 @@
 #define DIDSR			0x20028
 #define DIDSR_CODE		(0x7790 << 16)
 #define DIDSR_LDCS_DCLKIN(n)	(0 << (8 + (n) * 2))
+#define DIDSR_LDCS_DSI(n)	(2 << (8 + (n) * 2))

I'd add a /* V3U only */ comment at the end.

Quoted 1 line

I can address those two small issues when applying.

Thanks

Quoted 5 lines
Quoted 4 lines
drivers/gpu/drm/rcar-du/rcar_du_regs.h +0 -0
 #define DIDSR_LDCS_LVDS0(n)	(2 << (8 + (n) * 2))
 #define DIDSR_LDCS_LVDS1(n)	(3 << (8 + (n) * 2))
 #define DIDSR_LDCS_MASK(n)	(3 << (8 + (n) * 2))