MLK-11832: MIPI CSI: Adjust mipi csi sensor power up process
authorSandor Yu <R01008@freescale.com>
Wed, 18 Nov 2015 03:43:59 +0000 (11:43 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 19:49:14 +0000 (14:49 -0500)
Add s_stream interface for MIPI CSI and ov5647/ov5640 drivers.
Enable MIPI CSI sensor after MIPI CSI DPHY CLK enable
in case MIPI DPHY miss MIPI CSI sensor signal.

Signed-off-by: Sandor Yu <R01008@freescale.com>
(cherry picked from commit 26d81b416be6e3af203d1254a3116dbcf39a5605)

drivers/media/platform/mxc/subdev/mxc_mipi_csi.c
drivers/media/platform/mxc/subdev/ov5640_mipi.c
drivers/media/platform/mxc/subdev/ov5647_mipi.c

index db09ba0..9ba6e1b 100644 (file)
@@ -664,8 +664,10 @@ static int mipi_csis_s_stream(struct v4l2_subdev *mipi_sd, int enable)
                        goto unlock;
                }
                mipi_csis_start_stream(state);
+               v4l2_subdev_call(state->sensor_sd, video, s_stream, true);
                state->flags |= ST_STREAMING;
        } else {
+               v4l2_subdev_call(state->sensor_sd, video, s_stream, false);
                mipi_csis_stop_stream(state);
                state->flags &= ~ST_STREAMING;
                if (debug > 0)
index ca3bc52..62af8e5 100644 (file)
@@ -871,7 +871,6 @@ static void OV5640_stream_off(void)
        ov5640_write_reg(0x4202, 0x0f);
 }
 
-
 static int OV5640_get_sysclk(void)
 {
         /* calculate sysclk */
@@ -1304,8 +1303,6 @@ static int ov5640_change_mode_exposure_calc(enum ov5640_frame_rate frame_rate,
        }
        OV5640_set_shutter(cap_shutter);
 
-       OV5640_stream_on();
-
 err:
        return retval;
 }
@@ -1345,8 +1342,6 @@ static int ov5640_change_mode_direct(enum ov5640_frame_rate frame_rate,
        if (retval < 0)
                goto err;
 
-       OV5640_stream_on();
-
        OV5640_turn_on_AE_AG(1);
 
 err:
@@ -1756,9 +1751,19 @@ static int init_device(void)
        return ret;
 }
 
+static int ov5640_s_stream(struct v4l2_subdev *sd, int enable)
+{
+       if (enable)
+               OV5640_stream_on();
+       else
+               OV5640_stream_off();
+       return 0;
+}
+
 static struct v4l2_subdev_video_ops ov5640_subdev_video_ops = {
        .g_parm = ov5640_g_parm,
        .s_parm = ov5640_s_parm,
+       .s_stream = ov5640_s_stream,
 };
 
 static const struct v4l2_subdev_pad_ops ov5640_subdev_pad_ops = {
index 453478f..258213a 100644 (file)
@@ -1047,8 +1047,6 @@ static int ov5647_change_mode_exposure_calc(enum ov5647_frame_rate frame_rate,
        }
        ov5647_set_shutter(cap_shutter);
 
-       ov5647_stream_on();
-
 err:
        return retval;
 }
@@ -1088,8 +1086,6 @@ static int ov5647_change_mode_direct(enum ov5647_frame_rate frame_rate,
        if (retval < 0)
                goto err;
 
-       ov5647_stream_on();
-
        ov5647_turn_on_AE_AG(1);
 
 err:
@@ -1501,9 +1497,19 @@ static int init_device(void)
        return ret;
 }
 
+static int ov5647_s_stream(struct v4l2_subdev *sd, int enable)
+{
+       if (enable)
+               ov5647_stream_on();
+       else
+               ov5647_stream_off();
+       return 0;
+}
+
 static struct v4l2_subdev_video_ops ov5647_subdev_video_ops = {
        .g_parm = ov5647_g_parm,
        .s_parm = ov5647_s_parm,
+       .s_stream = ov5647_s_stream,
 };
 
 static const struct v4l2_subdev_pad_ops ov5647_subdev_pad_ops = {