From 04232d021f9f6ae40a63281af05bd8bec6898acd Mon Sep 17 00:00:00 2001 From: Sandor Yu Date: Wed, 18 Nov 2015 11:43:59 +0800 Subject: [PATCH] MLK-11832: MIPI CSI: Adjust mipi csi sensor power up process 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 (cherry picked from commit 26d81b416be6e3af203d1254a3116dbcf39a5605) --- drivers/media/platform/mxc/subdev/mxc_mipi_csi.c | 2 ++ drivers/media/platform/mxc/subdev/ov5640_mipi.c | 15 ++++++++++----- drivers/media/platform/mxc/subdev/ov5647_mipi.c | 14 ++++++++++---- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/drivers/media/platform/mxc/subdev/mxc_mipi_csi.c b/drivers/media/platform/mxc/subdev/mxc_mipi_csi.c index b677a472a523..a1ed48a9507a 100644 --- a/drivers/media/platform/mxc/subdev/mxc_mipi_csi.c +++ b/drivers/media/platform/mxc/subdev/mxc_mipi_csi.c @@ -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) diff --git a/drivers/media/platform/mxc/subdev/ov5640_mipi.c b/drivers/media/platform/mxc/subdev/ov5640_mipi.c index de68d4c39925..135eefa550a7 100644 --- a/drivers/media/platform/mxc/subdev/ov5640_mipi.c +++ b/drivers/media/platform/mxc/subdev/ov5640_mipi.c @@ -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: @@ -1757,9 +1752,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, .s_mbus_fmt = ov5640_s_fmt, .g_mbus_fmt = ov5640_g_fmt, diff --git a/drivers/media/platform/mxc/subdev/ov5647_mipi.c b/drivers/media/platform/mxc/subdev/ov5647_mipi.c index 9b493bfc27fc..09334d51e040 100644 --- a/drivers/media/platform/mxc/subdev/ov5647_mipi.c +++ b/drivers/media/platform/mxc/subdev/ov5647_mipi.c @@ -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: @@ -1503,9 +1499,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, .s_mbus_fmt = ov5647_s_fmt, .g_mbus_fmt = ov5647_g_fmt,