]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
media: i2c: OV5647: ensure clock lane in LP-11 state before streaming on
authorJacob Chen <jacob-chen@iotwrt.com>
Sun, 1 Oct 2017 10:22:37 +0000 (12:22 +0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 27 Oct 2017 14:12:49 +0000 (16:12 +0200)
When I was supporting Rpi Camera Module on the ASUS Tinker board,
I found this driver have some issues with rockchip's mipi-csi driver.
It didn't place clock lane in LP-11 state before performing
D-PHY initialisation.

>From our experience, on some OV sensors,
LP-11 state is not achieved while BIT(5)-0x4800 is cleared.

So let's set BIT(5) and BIT(0) both while not streaming, in order to
coax the clock lane into LP-11 state.

0x4800 : MIPI CTRL 00
BIT(5) : clock lane gate enable
0: continuous
1: none-continuous
BIT(0) : manually set clock lane
0: Not used
1: used

Signed-off-by: Jacob Chen <jacob-chen@iotwrt.com>
Reviewed-by: Luis Oliveira <lolivei@synopsys.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/i2c/ov5647.c

index 95ce90fdb876f0c498de26b48a89ca0f8a28dfb5..247302d01f5367b05d3c90f099a1ef50bb3bba92 100644 (file)
@@ -253,6 +253,10 @@ static int ov5647_stream_on(struct v4l2_subdev *sd)
 {
        int ret;
 
+       ret = ov5647_write(sd, 0x4800, 0x04);
+       if (ret < 0)
+               return ret;
+
        ret = ov5647_write(sd, 0x4202, 0x00);
        if (ret < 0)
                return ret;
@@ -264,6 +268,10 @@ static int ov5647_stream_off(struct v4l2_subdev *sd)
 {
        int ret;
 
+       ret = ov5647_write(sd, 0x4800, 0x25);
+       if (ret < 0)
+               return ret;
+
        ret = ov5647_write(sd, 0x4202, 0x0f);
        if (ret < 0)
                return ret;
@@ -320,7 +328,10 @@ static int __sensor_init(struct v4l2_subdev *sd)
                        return ret;
        }
 
-       return ov5647_write(sd, 0x4800, 0x04);
+       /*
+        * stream off to make the clock lane into LP-11 state.
+        */
+       return ov5647_stream_off(sd);
 }
 
 static int ov5647_sensor_power(struct v4l2_subdev *sd, int on)