diff --git a/drivers/media/platform/rockchip/cif/capture.c b/drivers/media/platform/rockchip/cif/capture.c index 38db22f64557..6638a20f7e6d 100644 --- a/drivers/media/platform/rockchip/cif/capture.c +++ b/drivers/media/platform/rockchip/cif/capture.c @@ -2345,6 +2345,7 @@ static int rkcif_start_streaming(struct vb2_queue *queue, unsigned int count) struct rkcif_sensor_info *sensor_info = dev->active_sensor; struct rkcif_sensor_info *terminal_sensor = &dev->terminal_sensor; struct rkmodule_hdr_cfg hdr_cfg; + int rkmodule_stream_seq = RKMODULE_START_STREAM_DEFAULT; int ret; mutex_lock(&dev->stream_lock); @@ -2380,6 +2381,13 @@ static int rkcif_start_streaming(struct vb2_queue *queue, unsigned int count) if (ret) terminal_sensor->fi.interval = (struct v4l2_fract) {1, 30}; + ret = v4l2_subdev_call(terminal_sensor->sd, + core, ioctl, + RKMODULE_GET_START_STREAM_SEQ, + &rkmodule_stream_seq); + if (ret) + rkmodule_stream_seq = RKMODULE_START_STREAM_DEFAULT; + rkcif_sync_crop_info(stream); } @@ -2414,7 +2422,8 @@ static int rkcif_start_streaming(struct vb2_queue *queue, unsigned int count) * can be rising or fallling after powering on cif. * To keep the coherence of edge, open sensor in advance. */ - if (sensor_info->mbus.type == V4L2_MBUS_PARALLEL) { + if (sensor_info->mbus.type == V4L2_MBUS_PARALLEL || + rkmodule_stream_seq == RKMODULE_START_STREAM_FRONT) { ret = dev->pipe.set_stream(&dev->pipe, true); if (ret < 0) goto runtime_put; @@ -2443,7 +2452,8 @@ static int rkcif_start_streaming(struct vb2_queue *queue, unsigned int count) goto pipe_stream_off; } - if (sensor_info->mbus.type != V4L2_MBUS_PARALLEL) { + if (sensor_info->mbus.type != V4L2_MBUS_PARALLEL && + rkmodule_stream_seq != RKMODULE_START_STREAM_FRONT) { ret = dev->pipe.set_stream(&dev->pipe, true); if (ret < 0) goto stop_stream; diff --git a/include/uapi/linux/rk-camera-module.h b/include/uapi/linux/rk-camera-module.h index 0daf9cd26047..2b554eb0bc09 100644 --- a/include/uapi/linux/rk-camera-module.h +++ b/include/uapi/linux/rk-camera-module.h @@ -66,6 +66,9 @@ #define RKMODULE_GET_VC_HOTPLUG_INFO \ _IOR('V', BASE_VIDIOC_PRIVATE + 13, struct rkmodule_vc_hotplug_info) +#define RKMODULE_GET_START_STREAM_SEQ \ + _IOR('V', BASE_VIDIOC_PRIVATE + 14, __u32) + /** * struct rkmodule_base_inf - module base information * @@ -355,4 +358,16 @@ struct rkmodule_vc_hotplug_info { __u8 detect_status; } __attribute__ ((packed)); + +/* sensor start stream sequence + * RKMODULE_START_STREAM_DEFAULT: by default + * RKMODULE_START_STREAM_BEHIND : sensor start stream should be behind the controller + * RKMODULE_START_STREAM_FRONT : sensor start stream should be in front of the controller + */ +enum rkmodule_start_stream_seq { + RKMODULE_START_STREAM_DEFAULT = 0, + RKMODULE_START_STREAM_BEHIND, + RKMODULE_START_STREAM_FRONT, +}; + #endif /* _UAPI_RKMODULE_CAMERA_H */