media: vim2m: support requests
Add support for requests to vim2m. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
144bd0ee30
commit
86b93b2c95
@ -379,8 +379,16 @@ static void device_run(void *priv)
|
|||||||
src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
|
src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx);
|
||||||
dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
|
dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx);
|
||||||
|
|
||||||
|
/* Apply request controls if any */
|
||||||
|
v4l2_ctrl_request_setup(src_buf->vb2_buf.req_obj.req,
|
||||||
|
&ctx->hdl);
|
||||||
|
|
||||||
device_process(ctx, src_buf, dst_buf);
|
device_process(ctx, src_buf, dst_buf);
|
||||||
|
|
||||||
|
/* Complete request controls if any */
|
||||||
|
v4l2_ctrl_request_complete(src_buf->vb2_buf.req_obj.req,
|
||||||
|
&ctx->hdl);
|
||||||
|
|
||||||
/* Run delayed work, which simulates a hardware irq */
|
/* Run delayed work, which simulates a hardware irq */
|
||||||
schedule_delayed_work(&dev->work_run, msecs_to_jiffies(ctx->transtime));
|
schedule_delayed_work(&dev->work_run, msecs_to_jiffies(ctx->transtime));
|
||||||
}
|
}
|
||||||
@ -808,12 +816,21 @@ static void vim2m_stop_streaming(struct vb2_queue *q)
|
|||||||
vbuf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
|
vbuf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
|
||||||
if (vbuf == NULL)
|
if (vbuf == NULL)
|
||||||
return;
|
return;
|
||||||
|
v4l2_ctrl_request_complete(vbuf->vb2_buf.req_obj.req,
|
||||||
|
&ctx->hdl);
|
||||||
spin_lock_irqsave(&ctx->dev->irqlock, flags);
|
spin_lock_irqsave(&ctx->dev->irqlock, flags);
|
||||||
v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR);
|
v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR);
|
||||||
spin_unlock_irqrestore(&ctx->dev->irqlock, flags);
|
spin_unlock_irqrestore(&ctx->dev->irqlock, flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vim2m_buf_request_complete(struct vb2_buffer *vb)
|
||||||
|
{
|
||||||
|
struct vim2m_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
|
||||||
|
|
||||||
|
v4l2_ctrl_request_complete(vb->req_obj.req, &ctx->hdl);
|
||||||
|
}
|
||||||
|
|
||||||
static const struct vb2_ops vim2m_qops = {
|
static const struct vb2_ops vim2m_qops = {
|
||||||
.queue_setup = vim2m_queue_setup,
|
.queue_setup = vim2m_queue_setup,
|
||||||
.buf_prepare = vim2m_buf_prepare,
|
.buf_prepare = vim2m_buf_prepare,
|
||||||
@ -822,6 +839,7 @@ static const struct vb2_ops vim2m_qops = {
|
|||||||
.stop_streaming = vim2m_stop_streaming,
|
.stop_streaming = vim2m_stop_streaming,
|
||||||
.wait_prepare = vb2_ops_wait_prepare,
|
.wait_prepare = vb2_ops_wait_prepare,
|
||||||
.wait_finish = vb2_ops_wait_finish,
|
.wait_finish = vb2_ops_wait_finish,
|
||||||
|
.buf_request_complete = vim2m_buf_request_complete,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)
|
static int queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)
|
||||||
@ -988,6 +1006,11 @@ static const struct v4l2_m2m_ops m2m_ops = {
|
|||||||
.job_abort = job_abort,
|
.job_abort = job_abort,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct media_device_ops m2m_media_ops = {
|
||||||
|
.req_validate = vb2_request_validate,
|
||||||
|
.req_queue = vb2_m2m_request_queue,
|
||||||
|
};
|
||||||
|
|
||||||
static int vim2m_probe(struct platform_device *pdev)
|
static int vim2m_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct vim2m_dev *dev;
|
struct vim2m_dev *dev;
|
||||||
@ -1036,6 +1059,7 @@ static int vim2m_probe(struct platform_device *pdev)
|
|||||||
dev->mdev.dev = &pdev->dev;
|
dev->mdev.dev = &pdev->dev;
|
||||||
strlcpy(dev->mdev.model, "vim2m", sizeof(dev->mdev.model));
|
strlcpy(dev->mdev.model, "vim2m", sizeof(dev->mdev.model));
|
||||||
media_device_init(&dev->mdev);
|
media_device_init(&dev->mdev);
|
||||||
|
dev->mdev.ops = &m2m_media_ops;
|
||||||
dev->v4l2_dev.mdev = &dev->mdev;
|
dev->v4l2_dev.mdev = &dev->mdev;
|
||||||
|
|
||||||
ret = v4l2_m2m_register_media_controller(dev->m2m_dev,
|
ret = v4l2_m2m_register_media_controller(dev->m2m_dev,
|
||||||
|
Loading…
Reference in New Issue
Block a user