]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: v4l: vsp1: Fix video output on R8A77970
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Thu, 18 Jan 2018 14:05:51 +0000 (09:05 -0500)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 26 Feb 2018 15:27:28 +0000 (10:27 -0500)
Commit d455b45f8393 ("v4l: vsp1: Add support for new VSP2-BS, VSP2-DL,
and VSP2-D instances") added support for the VSP2-D found in the R-Car
V3M (R8A77970) but the video output that VSP2-D sends to DU has a greenish
garbage-like line repeated every 8 screen rows. It turns out that R-Car
V3M has the LIF0 buffer attribute register that you need to set to a non-
default value in order to get rid of the output artifacts.

Based on the original (and large) patch by Daisuke Matsushita
<daisuke.matsushita.ns@hitachi.com>.

Fixes: d455b45f8393 ("v4l: vsp1: Add support for new VSP2-BS, VSP2-DL and VSP2-D instances")
[Removed braces, added VI6_IP_VERSION_MASK to improve readabiliy]

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/vsp1/vsp1_lif.c
drivers/media/platform/vsp1/vsp1_regs.h

index e6fa16d7fda897d342ef99274d31cef4948a050e..7049207539982d4c81ea972ba9693abbddc13513 100644 (file)
@@ -155,6 +155,18 @@ static void lif_configure(struct vsp1_entity *entity,
                        (obth << VI6_LIF_CTRL_OBTH_SHIFT) |
                        (format->code == 0 ? VI6_LIF_CTRL_CFMT : 0) |
                        VI6_LIF_CTRL_REQSEL | VI6_LIF_CTRL_LIF_EN);
+
+       /*
+        * On R-Car V3M the LIF0 buffer attribute register has to be set to a
+        * non-default value to guarantee proper operation (otherwise artifacts
+        * may appear on the output). The value required by the manual is not
+        * explained but is likely a buffer size or threshold.
+        */
+       if ((entity->vsp1->version & VI6_IP_VERSION_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 = {
index b1912c83a1dae201801c4d249d77a713f20e97ee..dae0c19012972c29ff70222d93545cd3b38dc08a 100644 (file)
 #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
  */
  */
 
 #define VI6_IP_VERSION                 0x3f00
+#define VI6_IP_VERSION_MASK            (0xffff << 0)
 #define VI6_IP_VERSION_MODEL_MASK      (0xff << 8)
 #define VI6_IP_VERSION_MODEL_VSPS_H2   (0x09 << 8)
 #define VI6_IP_VERSION_MODEL_VSPR_H2   (0x0a << 8)