All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Renesas R-Car DU fixes
@ 2016-11-14 16:39 Laurent Pinchart
  2016-11-14 16:39   ` Laurent Pinchart
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Laurent Pinchart @ 2016-11-14 16:39 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-renesas-soc, Koji Matsuoka

Hello,

This series contains four fixes for the R-Car DU driver, all backported or
inspired by the R-Car Gen3 BSP.

Please see individual patches for details.

Koji Matsuoka (3):
  drm: rcar-du: Fix display timing controller parameter
  drm: rcar-du: Fix H/V sync signal polarity configuration
  drm: rcar-du: Fix LVDS start sequence on Gen3

Laurent Pinchart (1):
  drm: rcar-du: Fix dot clock routing configuration

 drivers/gpu/drm/rcar-du/rcar_du_crtc.c    |  6 +++---
 drivers/gpu/drm/rcar-du/rcar_du_group.c   | 22 +++++++++++++---------
 drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c | 15 ++++++++-------
 3 files changed, 24 insertions(+), 19 deletions(-)

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] drm: rcar-du: Fix dot clock routing configuration
  2016-11-14 16:39 [PATCH 0/4] Renesas R-Car DU fixes Laurent Pinchart
@ 2016-11-14 16:39   ` Laurent Pinchart
  2016-11-14 16:39 ` [PATCH 2/4] drm: rcar-du: Fix display timing controller parameter Laurent Pinchart
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2016-11-14 16:39 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-renesas-soc, Koji Matsuoka

Dot clock routing is setup through different registers depending on the
DU generation. The code has been designed for Gen2 and hasn't been
updated since. This works thanks to good reset default value, but isn't
very safe. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_group.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c b/drivers/gpu/drm/rcar-du/rcar_du_group.c
index 33b2fc53da3e..64738fca96d0 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
@@ -105,16 +105,20 @@ static void rcar_du_group_setup(struct rcar_du_group *rgrp)
 	if (rcar_du_has(rgrp->dev, RCAR_DU_FEATURE_EXT_CTRL_REGS)) {
 		rcar_du_group_setup_defr8(rgrp);
 
-		/* Configure input dot clock routing. We currently hardcode the
-		 * configuration to routing DOTCLKINn to DUn.
+		/*
+		 * Configure input dot clock routing. We currently hardcode the
+		 * configuration to routing DOTCLKINn to DUn. Register fields
+		 * depend on the DU generation, but the resulting value is 0 in
+		 * all cases.
+		 *
+		 * On Gen2 a single register in the first group controls dot
+		 * clock selection for all channels, while on Gen3 dot clocks
+		 * are setup through per-group registers, only available when
+		 * the group has two channels.
 		 */
-		rcar_du_group_write(rgrp, DIDSR, DIDSR_CODE |
-				    DIDSR_LCDS_DCLKIN(2) |
-				    DIDSR_LCDS_DCLKIN(1) |
-				    DIDSR_LCDS_DCLKIN(0) |
-				    DIDSR_PDCS_CLK(2, 0) |
-				    DIDSR_PDCS_CLK(1, 0) |
-				    DIDSR_PDCS_CLK(0, 0));
+		if ((rcdu->info->gen < 3 && rgrp->index == 0) ||
+		    (rcdu->info->gen == 3 &&  rgrp->num_crtcs > 1))
+			rcar_du_group_write(rgrp, DIDSR, DIDSR_CODE);
 	}
 
 	if (rcdu->info->gen >= 3)
-- 
Regards,

Laurent Pinchart

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 1/4] drm: rcar-du: Fix dot clock routing configuration
@ 2016-11-14 16:39   ` Laurent Pinchart
  0 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2016-11-14 16:39 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-renesas-soc, Koji Matsuoka

Dot clock routing is setup through different registers depending on the
DU generation. The code has been designed for Gen2 and hasn't been
updated since. This works thanks to good reset default value, but isn't
very safe. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_group.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c b/drivers/gpu/drm/rcar-du/rcar_du_group.c
index 33b2fc53da3e..64738fca96d0 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_group.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c
@@ -105,16 +105,20 @@ static void rcar_du_group_setup(struct rcar_du_group *rgrp)
 	if (rcar_du_has(rgrp->dev, RCAR_DU_FEATURE_EXT_CTRL_REGS)) {
 		rcar_du_group_setup_defr8(rgrp);
 
-		/* Configure input dot clock routing. We currently hardcode the
-		 * configuration to routing DOTCLKINn to DUn.
+		/*
+		 * Configure input dot clock routing. We currently hardcode the
+		 * configuration to routing DOTCLKINn to DUn. Register fields
+		 * depend on the DU generation, but the resulting value is 0 in
+		 * all cases.
+		 *
+		 * On Gen2 a single register in the first group controls dot
+		 * clock selection for all channels, while on Gen3 dot clocks
+		 * are setup through per-group registers, only available when
+		 * the group has two channels.
 		 */
-		rcar_du_group_write(rgrp, DIDSR, DIDSR_CODE |
-				    DIDSR_LCDS_DCLKIN(2) |
-				    DIDSR_LCDS_DCLKIN(1) |
-				    DIDSR_LCDS_DCLKIN(0) |
-				    DIDSR_PDCS_CLK(2, 0) |
-				    DIDSR_PDCS_CLK(1, 0) |
-				    DIDSR_PDCS_CLK(0, 0));
+		if ((rcdu->info->gen < 3 && rgrp->index == 0) ||
+		    (rcdu->info->gen == 3 &&  rgrp->num_crtcs > 1))
+			rcar_du_group_write(rgrp, DIDSR, DIDSR_CODE);
 	}
 
 	if (rcdu->info->gen >= 3)
-- 
Regards,

Laurent Pinchart

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] drm: rcar-du: Fix display timing controller parameter
  2016-11-14 16:39 [PATCH 0/4] Renesas R-Car DU fixes Laurent Pinchart
  2016-11-14 16:39   ` Laurent Pinchart
@ 2016-11-14 16:39 ` Laurent Pinchart
  2016-11-14 16:39 ` [PATCH 3/4] drm: rcar-du: Fix H/V sync signal polarity configuration Laurent Pinchart
  2016-11-14 16:39 ` [PATCH 4/4] drm: rcar-du: Fix LVDS start sequence on Gen3 Laurent Pinchart
  3 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2016-11-14 16:39 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-renesas-soc, Koji Matsuoka

From: Koji Matsuoka <koji.matsuoka.xm@renesas.com>

There is a bug in the setting of the DES (Display Enable Signal)
register. This current setting occurs 1 dot left shift. The DES
register should be set minus one value about the specifying value
with H/W specification. This patch corrects it.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index 7316fc7fa0bd..aca26eed93b1 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -172,7 +172,7 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
 					mode->crtc_vsync_start - 1);
 	rcar_du_crtc_write(rcrtc, VCR,  mode->crtc_vtotal - 1);
 
-	rcar_du_crtc_write(rcrtc, DESR,  mode->htotal - mode->hsync_start);
+	rcar_du_crtc_write(rcrtc, DESR,  mode->htotal - mode->hsync_start - 1);
 	rcar_du_crtc_write(rcrtc, DEWR,  mode->hdisplay);
 }
 
-- 
Regards,

Laurent Pinchart

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] drm: rcar-du: Fix H/V sync signal polarity configuration
  2016-11-14 16:39 [PATCH 0/4] Renesas R-Car DU fixes Laurent Pinchart
  2016-11-14 16:39   ` Laurent Pinchart
  2016-11-14 16:39 ` [PATCH 2/4] drm: rcar-du: Fix display timing controller parameter Laurent Pinchart
@ 2016-11-14 16:39 ` Laurent Pinchart
  2016-11-14 16:39 ` [PATCH 4/4] drm: rcar-du: Fix LVDS start sequence on Gen3 Laurent Pinchart
  3 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2016-11-14 16:39 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-renesas-soc, Koji Matsuoka

From: Koji Matsuoka <koji.matsuoka.xm@renesas.com>

The VSL and HSL bits in the DSMR register set the corresponding
horizontal and vertical sync signal polarity to active high. The code
got it the wrong way around, fix it.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index aca26eed93b1..a2ec6d8796a0 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -149,8 +149,8 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)
 	rcar_du_group_write(rcrtc->group, rcrtc->index % 2 ? OTAR2 : OTAR, 0);
 
 	/* Signal polarities */
-	value = ((mode->flags & DRM_MODE_FLAG_PVSYNC) ? 0 : DSMR_VSL)
-	      | ((mode->flags & DRM_MODE_FLAG_PHSYNC) ? 0 : DSMR_HSL)
+	value = ((mode->flags & DRM_MODE_FLAG_PVSYNC) ? DSMR_VSL : 0)
+	      | ((mode->flags & DRM_MODE_FLAG_PHSYNC) ? DSMR_HSL : 0)
 	      | DSMR_DIPM_DISP | DSMR_CSPM;
 	rcar_du_crtc_write(rcrtc, DSMR, value);
 
-- 
Regards,

Laurent Pinchart

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] drm: rcar-du: Fix LVDS start sequence on Gen3
  2016-11-14 16:39 [PATCH 0/4] Renesas R-Car DU fixes Laurent Pinchart
                   ` (2 preceding siblings ...)
  2016-11-14 16:39 ` [PATCH 3/4] drm: rcar-du: Fix H/V sync signal polarity configuration Laurent Pinchart
@ 2016-11-14 16:39 ` Laurent Pinchart
  3 siblings, 0 replies; 6+ messages in thread
From: Laurent Pinchart @ 2016-11-14 16:39 UTC (permalink / raw)
  To: dri-devel; +Cc: linux-renesas-soc, Koji Matsuoka

From: Koji Matsuoka <koji.matsuoka.xm@renesas.com>

According to the latest revision of the datasheet, the LVDS I/O pins
must be enabled before starting the PLL. Fix it.

Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c b/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c
index b74105a80a6e..e3a4985f6f3f 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c
@@ -104,7 +104,14 @@ static void rcar_du_lvdsenc_start_gen3(struct rcar_du_lvdsenc *lvds,
 
 	rcar_lvds_write(lvds, LVDPLLCR, pllcr);
 
-	/* Turn the PLL on, set it to LVDS normal mode, wait for the startup
+	/* Turn all the channels on. */
+	rcar_lvds_write(lvds, LVDCR1,
+			LVDCR1_CHSTBY_GEN3(3) | LVDCR1_CHSTBY_GEN3(2) |
+			LVDCR1_CHSTBY_GEN3(1) | LVDCR1_CHSTBY_GEN3(0) |
+			LVDCR1_CLKSTBY_GEN3);
+
+	/*
+	 * Turn the PLL on, set it to LVDS normal mode, wait for the startup
 	 * delay and turn the output on.
 	 */
 	lvdcr0 = LVDCR0_PLLON;
@@ -117,12 +124,6 @@ static void rcar_du_lvdsenc_start_gen3(struct rcar_du_lvdsenc *lvds,
 
 	lvdcr0 |= LVDCR0_LVRES;
 	rcar_lvds_write(lvds, LVDCR0, lvdcr0);
-
-	/* Turn all the channels on. */
-	rcar_lvds_write(lvds, LVDCR1,
-			LVDCR1_CHSTBY_GEN3(3) | LVDCR1_CHSTBY_GEN3(2) |
-			LVDCR1_CHSTBY_GEN3(1) | LVDCR1_CHSTBY_GEN3(0) |
-			LVDCR1_CLKSTBY_GEN3);
 }
 
 static int rcar_du_lvdsenc_start(struct rcar_du_lvdsenc *lvds,
-- 
Regards,

Laurent Pinchart

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-14 16:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-14 16:39 [PATCH 0/4] Renesas R-Car DU fixes Laurent Pinchart
2016-11-14 16:39 ` [PATCH 1/4] drm: rcar-du: Fix dot clock routing configuration Laurent Pinchart
2016-11-14 16:39   ` Laurent Pinchart
2016-11-14 16:39 ` [PATCH 2/4] drm: rcar-du: Fix display timing controller parameter Laurent Pinchart
2016-11-14 16:39 ` [PATCH 3/4] drm: rcar-du: Fix H/V sync signal polarity configuration Laurent Pinchart
2016-11-14 16:39 ` [PATCH 4/4] drm: rcar-du: Fix LVDS start sequence on Gen3 Laurent Pinchart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.