media: cif: add stream sequence conifg strategy

Change-Id: If6dca4ca1243f218f3e429a6628aae56a35d9058
Signed-off-by: Vicent Chi <vicent.chi@rock-chips.com>
This commit is contained in:
Vicent Chi
2021-01-14 16:55:00 +08:00
committed by Tao Huang
parent 936357d72a
commit 38df211534
2 changed files with 27 additions and 2 deletions

View File

@@ -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;

View File

@@ -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 */