mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
media: rockchip: ispp: stream link enable default
Stream link enable all and async output default. Setting following to enable stream sync output, user need to on/off stream link. echo Y > /sys/module/video_rkispp/parameters/stream_sync Change-Id: Ib8be75862e8770c7c5dd368dfd7c4879f45a807e Signed-off-by: Cai YiWei <cyw@rock-chips.com>
This commit is contained in:
@@ -44,6 +44,10 @@ static int rkisp_ispp_mode = ISP_ISPP_422 | ISP_ISPP_FBC;
|
||||
module_param_named(mode, rkisp_ispp_mode, int, 0644);
|
||||
MODULE_PARM_DESC(mode, "isp->ispp mode: bit0 fbc, bit1 yuv422, bit2 quick");
|
||||
|
||||
static bool rkispp_stream_sync;
|
||||
module_param_named(stream_sync, rkispp_stream_sync, bool, 0644);
|
||||
MODULE_PARM_DESC(stream_sync, "rkispp stream sync output");
|
||||
|
||||
static char rkispp_version[RKISPP_VERNO_LEN];
|
||||
module_param_string(version, rkispp_version, RKISPP_VERNO_LEN, 0444);
|
||||
MODULE_PARM_DESC(version, "version number");
|
||||
@@ -142,7 +146,7 @@ static int rkispp_create_links(struct rkispp_device *ispp_dev)
|
||||
return ret;
|
||||
|
||||
/* output stream links */
|
||||
flags = 0;
|
||||
flags = rkispp_stream_sync ? 0 : MEDIA_LNK_FL_ENABLED;
|
||||
stream = &stream_vdev->stream[STREAM_MB];
|
||||
stream->linked = flags;
|
||||
source = &ispp_dev->ispp_sdev.sd.entity;
|
||||
@@ -169,6 +173,7 @@ static int rkispp_create_links(struct rkispp_device *ispp_dev)
|
||||
return ret;
|
||||
|
||||
stream = &stream_vdev->stream[STREAM_S2];
|
||||
stream->linked = flags;
|
||||
sink = &stream->vnode.vdev.entity;
|
||||
ret = media_create_pad_link(source, RKISPP_PAD_SOURCE,
|
||||
sink, 0, flags);
|
||||
@@ -229,6 +234,7 @@ static int rkispp_enable_sys_clk(struct rkispp_device *ispp_dev)
|
||||
int i, ret = -EINVAL;
|
||||
|
||||
ispp_dev->isp_mode = rkisp_ispp_mode;
|
||||
ispp_dev->stream_sync = rkispp_stream_sync;
|
||||
for (i = 0; i < ispp_dev->clks_num; i++) {
|
||||
ret = clk_prepare_enable(ispp_dev->clks[i]);
|
||||
if (ret < 0)
|
||||
|
||||
@@ -56,5 +56,6 @@ struct rkispp_device {
|
||||
enum rkispp_input inp;
|
||||
u32 isp_mode;
|
||||
wait_queue_head_t sync_onoff;
|
||||
bool stream_sync;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -86,6 +86,10 @@ static int rkispp_subdev_link_setup(struct media_entity *entity,
|
||||
struct rkispp_stream_vdev *vdev;
|
||||
struct rkispp_stream *stream = NULL;
|
||||
|
||||
if (local->index != RKISPP_PAD_SINK &&
|
||||
local->index != RKISPP_PAD_SOURCE)
|
||||
return 0;
|
||||
|
||||
if (!sd)
|
||||
return -ENODEV;
|
||||
ispp_sdev = v4l2_get_subdevdata(sd);
|
||||
@@ -100,6 +104,9 @@ static int rkispp_subdev_link_setup(struct media_entity *entity,
|
||||
dev->inp = INP_ISP;
|
||||
else
|
||||
dev->inp = INP_INVAL;
|
||||
stream->linked = flags & MEDIA_LNK_FL_ENABLED;
|
||||
v4l2_dbg(1, rkispp_debug, &dev->v4l2_dev,
|
||||
"input:%d\n", dev->inp);
|
||||
} else if (!strcmp(remote->entity->name, MB_VDEV_NAME)) {
|
||||
stream = &vdev->stream[STREAM_MB];
|
||||
} else if (!strcmp(remote->entity->name, S0_VDEV_NAME)) {
|
||||
@@ -109,10 +116,12 @@ static int rkispp_subdev_link_setup(struct media_entity *entity,
|
||||
} else if (!strcmp(remote->entity->name, S2_VDEV_NAME)) {
|
||||
stream = &vdev->stream[STREAM_S2];
|
||||
}
|
||||
if (stream)
|
||||
if (stream && dev->stream_sync) {
|
||||
stream->linked = flags & MEDIA_LNK_FL_ENABLED;
|
||||
v4l2_dbg(1, rkispp_debug, &dev->v4l2_dev,
|
||||
"input:%d\n", dev->inp);
|
||||
v4l2_dbg(1, rkispp_debug, &dev->v4l2_dev,
|
||||
"stream:%d linked:%d\n",
|
||||
stream->id, stream->linked);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1415,11 +1415,15 @@ static int start_isp(struct rkispp_device *dev)
|
||||
if (dev->inp != INP_ISP || ispp_sdev->state)
|
||||
return 0;
|
||||
|
||||
/* output stream enable then start isp*/
|
||||
for (i = STREAM_MB; i < STREAM_MAX; i++) {
|
||||
stream = &vdev->stream[i];
|
||||
if (stream->linked && !stream->streaming)
|
||||
return 0;
|
||||
if (dev->stream_sync) {
|
||||
/* output stream enable then start isp */
|
||||
for (i = STREAM_MB; i < STREAM_MAX; i++) {
|
||||
stream = &vdev->stream[i];
|
||||
if (stream->linked && !stream->streaming)
|
||||
return 0;
|
||||
}
|
||||
} else if (atomic_read(&vdev->refcnt) > 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
mode.work_mode = dev->isp_mode;
|
||||
|
||||
Reference in New Issue
Block a user