mirror of
https://github.com/torvalds/linux.git
synced 2026-06-01 11:03:43 +02:00
media: staging: rkisp1: cap: serialize start/stop stream
In order to support simultaneous streaming from both capture devices, start/stop vb2 calls need to be serialized to allow multiple concurrent calls. Signed-off-by: Helen Koike <helen.koike@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
60e915354c
commit
e4b0326c4d
|
|
@ -880,6 +880,8 @@ static void rkisp1_vb2_stop_streaming(struct vb2_queue *queue)
|
|||
struct rkisp1_device *rkisp1 = cap->rkisp1;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&cap->rkisp1->stream_lock);
|
||||
|
||||
rkisp1_stream_stop(cap);
|
||||
media_pipeline_stop(&node->vdev.entity);
|
||||
ret = rkisp1_pipeline_sink_walk(&node->vdev.entity, NULL,
|
||||
|
|
@ -896,6 +898,8 @@ static void rkisp1_vb2_stop_streaming(struct vb2_queue *queue)
|
|||
dev_err(rkisp1->dev, "power down failed error:%d\n", ret);
|
||||
|
||||
rkisp1_dummy_buf_destroy(cap);
|
||||
|
||||
mutex_unlock(&cap->rkisp1->stream_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -940,6 +944,8 @@ rkisp1_vb2_start_streaming(struct vb2_queue *queue, unsigned int count)
|
|||
struct media_entity *entity = &cap->vnode.vdev.entity;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&cap->rkisp1->stream_lock);
|
||||
|
||||
ret = rkisp1_dummy_buf_create(cap);
|
||||
if (ret)
|
||||
goto err_ret_buffers;
|
||||
|
|
@ -969,6 +975,8 @@ rkisp1_vb2_start_streaming(struct vb2_queue *queue, unsigned int count)
|
|||
goto err_pipe_disable;
|
||||
}
|
||||
|
||||
mutex_unlock(&cap->rkisp1->stream_lock);
|
||||
|
||||
return 0;
|
||||
|
||||
err_pipe_disable:
|
||||
|
|
@ -982,6 +990,7 @@ rkisp1_vb2_start_streaming(struct vb2_queue *queue, unsigned int count)
|
|||
rkisp1_dummy_buf_destroy(cap);
|
||||
err_ret_buffers:
|
||||
rkisp1_return_all_buffers(cap, VB2_BUF_STATE_QUEUED);
|
||||
mutex_unlock(&cap->rkisp1->stream_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -240,6 +240,7 @@ struct rkisp1_debug {
|
|||
* @rkisp1_capture: capture video device
|
||||
* @stats: ISP statistics output device
|
||||
* @params: ISP input parameters device
|
||||
* @stream_lock: lock to serialize start/stop streaming in capture devices.
|
||||
*/
|
||||
struct rkisp1_device {
|
||||
void __iomem *base_addr;
|
||||
|
|
@ -259,6 +260,7 @@ struct rkisp1_device {
|
|||
struct rkisp1_params params;
|
||||
struct media_pipeline pipe;
|
||||
struct vb2_alloc_ctx *alloc_ctx;
|
||||
struct mutex stream_lock;
|
||||
struct rkisp1_debug debug;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -472,6 +472,8 @@ static int rkisp1_probe(struct platform_device *pdev)
|
|||
dev_set_drvdata(dev, rkisp1);
|
||||
rkisp1->dev = dev;
|
||||
|
||||
mutex_init(&rkisp1->stream_lock);
|
||||
|
||||
rkisp1->base_addr = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(rkisp1->base_addr))
|
||||
return PTR_ERR(rkisp1->base_addr);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user