Skip to contentSkip to conversation

vsp1: fix video output on R8A77970

PATCH Superseded Sergei Shtylyov 1 participant 2 messages Dec 25, 2017 – Dec 26, 2017 Media (V4L/DVB)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vsp1: fix video output on R8A77970

Laurent has added support for the VSP2-D found on R-Car V3M (R8A77970) but the video output that VSP2-D sends to DU has a greenish garbage-like line repeated every 8 or so screen rows. It turns out that V3M has a teeny LIF register (at least it's documented!) that you need to set to some kind of a magic value for the LIF to work correctly...

Based on the original (and large) patch by Daisuke Matsushita <[email protected]>.

Fixes d455b45f8393 ("v4l: vsp1: Add support for new VSP2-BS, VSP2-DL and VSP2-D instances")

---
This patch is against the 'media_tree.git' repo's 'master' branch.

 drivers/media/platform/vsp1/vsp1_lif.c  |    8 ++++++++
 drivers/media/platform/vsp1/vsp1_regs.h |    5 +++++
 2 files changed, 13 insertions(+)
drivers/media/platform/vsp1/vsp1_lif.c +8 -0
Index: media_tree/drivers/media/platform/vsp1/vsp1_lif.c
===================================================================
@@ -155,6 +155,14 @@ static void lif_configure(struct vsp1_en
 			(obth << VI6_LIF_CTRL_OBTH_SHIFT) |
 			(format->code == 0 ? VI6_LIF_CTRL_CFMT : 0) |
 			VI6_LIF_CTRL_REQSEL | VI6_LIF_CTRL_LIF_EN);
+
+	if ((entity->vsp1->version &
+	    (VI6_IP_VERSION_MODEL_MASK | VI6_IP_VERSION_SOC_MASK)) ==
+	    (VI6_IP_VERSION_MODEL_VSPD_V3 | VI6_IP_VERSION_SOC_V3M)) {
+		vsp1_lif_write(lif, dl, VI6_LIF_LBA,
+			       VI6_LIF_LBA_LBA0 |
+			       (1536 << VI6_LIF_LBA_LBA1_SHIFT));
+	}
 }
 
 static const struct vsp1_entity_operations lif_entity_ops = {
drivers/media/platform/vsp1/vsp1_regs.h +5 -0
Index: media_tree/drivers/media/platform/vsp1/vsp1_regs.h
===================================================================
@@ -693,6 +693,11 @@
 #define VI6_LIF_CSBTH_LBTH_MASK		(0x7ff << 0)
 #define VI6_LIF_CSBTH_LBTH_SHIFT	0
 
+#define VI6_LIF_LBA			0x3b0c
+#define VI6_LIF_LBA_LBA0		(1 << 31)
+#define VI6_LIF_LBA_LBA1_MASK		(0xfff << 16)
+#define VI6_LIF_LBA_LBA1_SHIFT		16
+
 /* -----------------------------------------------------------------------------
  * Security Control Registers
  */
#1 lore raw

Hello!

Quoted 24 lines · Sergei Shtylyov

Laurent has added support for the VSP2-D found on R-Car V3M (R8A77970) but the video output that VSP2-D sends to DU has a greenish garbage-like line repeated every 8 or so screen rows. It turns out that V3M has a teeny LIF register (at least it's documented!) that you need to set to some kind of a magic value for the LIF to work correctly...

Based on the original (and large) patch by Daisuke Matsushita <[email protected]>.

Fixes d455b45f8393 ("v4l: vsp1: Add support for new VSP2-BS, VSP2-DL and VSP2-D instances")

---
This patch is against the 'media_tree.git' repo's 'master' branch.

 drivers/media/platform/vsp1/vsp1_lif.c  |    8 ++++++++
 drivers/media/platform/vsp1/vsp1_regs.h |    5 +++++
 2 files changed, 13 insertions(+)

Index: media_tree/drivers/media/platform/vsp1/vsp1_lif.c
===================================================================

drivers/media/platform/vsp1/vsp1_lif.c static void lif_configure(struct vsp1_en · line 158

Quoted 4 lines
drivers/media/platform/vsp1/vsp1_lif.c +1 -0
@@ -155,6 +155,14 @@ static void lif_configure(struct vsp1_en
 			(obth << VI6_LIF_CTRL_OBTH_SHIFT) |
 			(format->code == 0 ? VI6_LIF_CTRL_CFMT : 0) |
 			VI6_LIF_CTRL_REQSEL | VI6_LIF_CTRL_LIF_EN);
+

I remember I was going to add a comment here but apparently forgot to do
it yesterday... Will repost.

drivers/media/platform/vsp1/vsp1_lif.c static void lif_configure(struct vsp1_en · line 166

Quoted 8 lines
drivers/media/platform/vsp1/vsp1_lif.c +7 -0
+	if ((entity->vsp1->version &
+	    (VI6_IP_VERSION_MODEL_MASK | VI6_IP_VERSION_SOC_MASK)) ==
+	    (VI6_IP_VERSION_MODEL_VSPD_V3 | VI6_IP_VERSION_SOC_V3M)) {
+		vsp1_lif_write(lif, dl, VI6_LIF_LBA,
+			       VI6_LIF_LBA_LBA0 |
+			       (1536 << VI6_LIF_LBA_LBA1_SHIFT));
+	}
 }

[...]

MBR, Sergei