drm: rcar-du: V3U Support
Subsystems (3)
v2 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 just cleans up in preparation for patch 5, and patch 2 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 3 is a further clean up to fix the naming of fields identified as incorrect while developing.
Patch 4 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 5 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 (5):
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
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 | 8 +-- 6 files changed, 77 insertions(+), 31 deletions(-)
Signature · 1 line
2.30.2
PATCH v2 1/5 drm: rcar-du: Sort the DU outputs
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
@@ -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
PATCH v2 2/5 drm: rcar-du: Only initialise TVM_TVSYNC mode when supported
In reply to Kieran BinghamThe 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
@@ -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
PATCH v2 3/5 drm: rcar-du: Fix DIDSR field name
In reply to Kieran BinghamThe 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
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
@@ -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
@@ -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
Re: [PATCH v2 3/5] drm: rcar-du: Fix DIDSR field name
Hi Kieran,
Thank you for the patch.
Quoted 7 lines · 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.
Signed-off-by Kieran Bingham <[email protected]>
Quoted 44 lines
---
v2:
- New patchdrivers/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@@ -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@@ -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 · 3 lines
Regards, Laurent Pinchart
PATCH v2 4/5 drm: rcar-du: Split CRTC IRQ and Clock features
In reply to Kieran BinghamNot 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
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
@@ -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
@@ -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
Re: [PATCH v2 4/5] drm: rcar-du: Split CRTC IRQ and Clock features
Hi Kieran,
Thank you for the patch.
Quoted 8 lines · 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.
Signed-off-by Kieran Bingham <[email protected]>
Quoted 215 lines
---
v2:
- New patchdrivers/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@@ -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@@ -36,7 +36,8 @@static const struct rcar_du_device_info rzg1_du_r8a7743_info = { .gen =2 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_INTERLACED |RCAR_DU_FEATURE_TVM_SYNC , .channels_mask =BIT (1 ) |BIT (0 ),@@ -58,7 +59,8 @@ static const struct rcar_du_device_info rzg1_du_r8a7743_info = {static const struct rcar_du_device_info rzg1_du_r8a7745_info = { .gen =2 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_INTERLACED |RCAR_DU_FEATURE_TVM_SYNC , .channels_mask =BIT (1 ) |BIT (0 ),@@ -79,7 +81,8 @@ static const struct rcar_du_device_info rzg1_du_r8a7745_info = {static const struct rcar_du_device_info rzg1_du_r8a77470_info = { .gen =2 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_INTERLACED |RCAR_DU_FEATURE_TVM_SYNC , .channels_mask =BIT (1 ) |BIT (0 ),@@ -105,7 +108,8 @@ static const struct rcar_du_device_info rzg1_du_r8a77470_info = {static const struct rcar_du_device_info rcar_du_r8a774a1_info = { .gen =3 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_VSP1_SOURCE |RCAR_DU_FEATURE_INTERLACED |RCAR_DU_FEATURE_TVM_SYNC ,@@ -134,7 +138,8 @@ static const struct rcar_du_device_info rcar_du_r8a774a1_info = {static const struct rcar_du_device_info rcar_du_r8a774b1_info = { .gen =3 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_VSP1_SOURCE |RCAR_DU_FEATURE_INTERLACED |RCAR_DU_FEATURE_TVM_SYNC ,@@ -163,7 +168,8 @@ static const struct rcar_du_device_info rcar_du_r8a774b1_info = {static const struct rcar_du_device_info rcar_du_r8a774c0_info = { .gen =3 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_VSP1_SOURCE , .channels_mask =BIT (1 ) |BIT (0 ), .routes = {@@ -189,7 +195,8 @@ static const struct rcar_du_device_info rcar_du_r8a774c0_info = {static const struct rcar_du_device_info rcar_du_r8a774e1_info = { .gen =3 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_VSP1_SOURCE |RCAR_DU_FEATURE_INTERLACED |RCAR_DU_FEATURE_TVM_SYNC ,@@ -239,7 +246,8 @@ static const struct rcar_du_device_info rcar_du_r8a7779_info = {static const struct rcar_du_device_info rcar_du_r8a7790_info = { .gen =2 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_INTERLACED |RCAR_DU_FEATURE_TVM_SYNC , .quirks =RCAR_DU_QUIRK_ALIGN_128B ,@@ -269,7 +277,8 @@ static const struct rcar_du_device_info rcar_du_r8a7790_info = {/* M2-W (r8a7791) and M2-N (r8a7793) are identical */ static const struct rcar_du_device_info rcar_du_r8a7791_info = { .gen =2 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_INTERLACED |RCAR_DU_FEATURE_TVM_SYNC , .channels_mask =BIT (1 ) |BIT (0 ),@@ -292,7 +301,8 @@ static const struct rcar_du_device_info rcar_du_r8a7791_info = {static const struct rcar_du_device_info rcar_du_r8a7792_info = { .gen =2 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_INTERLACED |RCAR_DU_FEATURE_TVM_SYNC , .channels_mask =BIT (1 ) |BIT (0 ),@@ -311,7 +321,8 @@ static const struct rcar_du_device_info rcar_du_r8a7792_info = {static const struct rcar_du_device_info rcar_du_r8a7794_info = { .gen =2 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_INTERLACED |RCAR_DU_FEATURE_TVM_SYNC , .channels_mask =BIT (1 ) |BIT (0 ),@@ -333,7 +344,8 @@ static const struct rcar_du_device_info rcar_du_r8a7794_info = {static const struct rcar_du_device_info rcar_du_r8a7795_info = { .gen =3 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_VSP1_SOURCE |RCAR_DU_FEATURE_INTERLACED |RCAR_DU_FEATURE_TVM_SYNC ,@@ -366,7 +378,8 @@ static const struct rcar_du_device_info rcar_du_r8a7795_info = {static const struct rcar_du_device_info rcar_du_r8a7796_info = { .gen =3 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_VSP1_SOURCE |RCAR_DU_FEATURE_INTERLACED |RCAR_DU_FEATURE_TVM_SYNC ,@@ -395,7 +408,8 @@ static const struct rcar_du_device_info rcar_du_r8a7796_info = {static const struct rcar_du_device_info rcar_du_r8a77965_info = { .gen =3 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_VSP1_SOURCE |RCAR_DU_FEATURE_INTERLACED |RCAR_DU_FEATURE_TVM_SYNC ,@@ -424,7 +438,8 @@ static const struct rcar_du_device_info rcar_du_r8a77965_info = {static const struct rcar_du_device_info rcar_du_r8a77970_info = { .gen =3 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_VSP1_SOURCE |RCAR_DU_FEATURE_INTERLACED |RCAR_DU_FEATURE_TVM_SYNC ,@@ -448,7 +463,8 @@ static const struct rcar_du_device_info rcar_du_r8a77970_info = {static const struct rcar_du_device_info rcar_du_r8a7799x_info = { .gen =3 , - .features =RCAR_DU_FEATURE_CRTC_IRQ_CLOCK + .features =RCAR_DU_FEATURE_CRTC_IRQ + |RCAR_DU_FEATURE_CRTC_CLOCK |RCAR_DU_FEATURE_VSP1_SOURCE , .channels_mask =BIT (1 ) |BIT (0 ), .routes = {drivers/gpu/drm/rcar-du/rcar_du_drv.h +5
-4@@ -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 · 3 lines
Regards, Laurent Pinchart
PATCH v2 5/5 drm: rcar-du: Add r8a779a0 device support
In reply to Kieran BinghamFrom: 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.
---
I can add a macro named DIDSR_LDCS_DSI0 duplicating DIDSR_LDCS_LVDS0 if it's deemed better.
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 ++ 4 files changed, 26 insertions(+)
drivers/gpu/drm/rcar-du/rcar_du_crtc.h +2 -0
@@ -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
@@ -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
@@ -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
@@ -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_LVDS0 (i);else didsr |=DIDSR_LDCS_DCLKIN (i) |DIDSR_PDCS_CLK (i,0 );
Signature · 1 line
2.30.2
Re: [PATCH v2 5/5] drm: rcar-du: Add r8a779a0 device support
Hi Kieran,
Thank you for the patch.
Quoted 10 lines · Kieran Bingham
From: Kieran Bingham <[email protected]>
Extend the
rcar_du_device_infostructure andrcar_du_outputenum 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.
Quoted 6 lines
Signed-off-by Kieran Bingham <[email protected]>---
I can add a macro named
DIDSR_LDCS_DSI0duplicatingDIDSR_LDCS_LVDS0if it's deemed better.
I think I'd like that a bit better if you don't mind. I'd name the macro DIDSR_LDCS_DSI though, as there's a single option (you can't pick one DSI encoder or the other as the clock source, it's DSI0 for DU0 and DSI1 for DU1).
Quoted 56 lines
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 ++ 4 files changed, 26 insertions(+)drivers/gpu/drm/rcar-du/rcar_du_crtc.h +2
-0@@ -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 +19
-0@@ -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 },
drivers/gpu/drm/rcar-du/rcar_du_drv.c static const struct of_device_id rcar_du_of_table[] = { · line 535
Quoted 4 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +1
-0@@ -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 },
While this looks good, the DT bindings need a v3, so I can't include this series in a pull request just yet :-( Could you please group the DT bindings and driver patches in a single series for v3 ?
Quoted 36 lines
drivers/gpu/drm/rcar-du/rcar_du_drv.c +0
-0{ } };drivers/gpu/drm/rcar-du/rcar_du_drv.h +2
-0@@ -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@@ -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_LVDS0 (i);else didsr |=DIDSR_LDCS_DCLKIN (i) |DIDSR_PDCS_CLK (i,0 );
Signature · 3 lines
Regards, Laurent Pinchart