aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/coda/coda-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/platform/coda/coda-common.c')
-rw-r--r--drivers/media/platform/coda/coda-common.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index 8e6fe0200117..58f65486de33 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -724,35 +724,30 @@ static int coda_qbuf(struct file *file, void *priv,
724} 724}
725 725
726static bool coda_buf_is_end_of_stream(struct coda_ctx *ctx, 726static bool coda_buf_is_end_of_stream(struct coda_ctx *ctx,
727 struct v4l2_buffer *buf) 727 struct vb2_buffer *buf)
728{ 728{
729 struct vb2_queue *src_vq; 729 struct vb2_queue *src_vq;
730 730
731 src_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT); 731 src_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
732 732
733 return ((ctx->bit_stream_param & CODA_BIT_STREAM_END_FLAG) && 733 return ((ctx->bit_stream_param & CODA_BIT_STREAM_END_FLAG) &&
734 (buf->sequence == (ctx->qsequence - 1))); 734 (buf->v4l2_buf.sequence == (ctx->qsequence - 1)));
735} 735}
736 736
737static int coda_dqbuf(struct file *file, void *priv, 737void coda_m2m_buf_done(struct coda_ctx *ctx, struct vb2_buffer *buf,
738 struct v4l2_buffer *buf) 738 enum vb2_buffer_state state)
739{ 739{
740 struct coda_ctx *ctx = fh_to_ctx(priv); 740 const struct v4l2_event eos_event = {
741 int ret; 741 .type = V4L2_EVENT_EOS
742 };
742 743
743 ret = v4l2_m2m_dqbuf(file, ctx->fh.m2m_ctx, buf); 744 if (coda_buf_is_end_of_stream(ctx, buf)) {
744 745 buf->v4l2_buf.flags |= V4L2_BUF_FLAG_LAST;
745 /* If this is the last capture buffer, emit an end-of-stream event */
746 if (buf->type == V4L2_BUF_TYPE_VIDEO_CAPTURE &&
747 coda_buf_is_end_of_stream(ctx, buf)) {
748 const struct v4l2_event eos_event = {
749 .type = V4L2_EVENT_EOS
750 };
751 746
752 v4l2_event_queue_fh(&ctx->fh, &eos_event); 747 v4l2_event_queue_fh(&ctx->fh, &eos_event);
753 } 748 }
754 749
755 return ret; 750 v4l2_m2m_buf_done(buf, state);
756} 751}
757 752
758static int coda_g_selection(struct file *file, void *fh, 753static int coda_g_selection(struct file *file, void *fh,
@@ -865,7 +860,7 @@ static const struct v4l2_ioctl_ops coda_ioctl_ops = {
865 860
866 .vidioc_qbuf = coda_qbuf, 861 .vidioc_qbuf = coda_qbuf,
867 .vidioc_expbuf = v4l2_m2m_ioctl_expbuf, 862 .vidioc_expbuf = v4l2_m2m_ioctl_expbuf,
868 .vidioc_dqbuf = coda_dqbuf, 863 .vidioc_dqbuf = v4l2_m2m_ioctl_dqbuf,
869 .vidioc_create_bufs = v4l2_m2m_ioctl_create_bufs, 864 .vidioc_create_bufs = v4l2_m2m_ioctl_create_bufs,
870 865
871 .vidioc_streamon = v4l2_m2m_ioctl_streamon, 866 .vidioc_streamon = v4l2_m2m_ioctl_streamon,
@@ -2160,9 +2155,9 @@ static int coda_probe(struct platform_device *pdev)
2160 } 2155 }
2161 2156
2162 /* Get IRAM pool from device tree or platform data */ 2157 /* Get IRAM pool from device tree or platform data */
2163 pool = of_get_named_gen_pool(np, "iram", 0); 2158 pool = of_gen_pool_get(np, "iram", 0);
2164 if (!pool && pdata) 2159 if (!pool && pdata)
2165 pool = dev_get_gen_pool(pdata->iram_dev); 2160 pool = gen_pool_get(pdata->iram_dev);
2166 if (!pool) { 2161 if (!pool) {
2167 dev_err(&pdev->dev, "iram pool not available\n"); 2162 dev_err(&pdev->dev, "iram pool not available\n");
2168 return -ENOMEM; 2163 return -ENOMEM;