aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMichael Tretter <m.tretter@pengutronix.de>2019-06-18 12:45:08 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-06-24 14:12:07 -0400
commit60c74167fef4d25112ce32030bdbb958a8d01cae (patch)
tree920663502290247ed299198f34c234d31432add1 /drivers/media
parentmedia: cafe-driver: mark an static var as such (diff)
downloadlinux-dev-60c74167fef4d25112ce32030bdbb958a8d01cae.tar.xz
linux-dev-60c74167fef4d25112ce32030bdbb958a8d01cae.zip
media: coda: implement CMD_START to restart decoding
The CMD_START shall be used to start the processing after a drain that was initiated with CMD_STOP. Up until now, a drain on coda could only be finished with a STREAMOFF-STREAMON, which resulted in a reset of the device. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/coda/coda-common.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c
index de64040dad8a..c7dcab4d1f6c 100644
--- a/drivers/media/platform/coda/coda-common.c
+++ b/drivers/media/platform/coda/coda-common.c
@@ -1059,16 +1059,29 @@ static int coda_decoder_cmd(struct file *file, void *fh,
struct v4l2_decoder_cmd *dc)
{
struct coda_ctx *ctx = fh_to_ctx(fh);
+ struct vb2_queue *dst_vq;
int ret;
ret = coda_try_decoder_cmd(file, fh, dc);
if (ret < 0)
return ret;
- /* Set the stream-end flag on this context */
- coda_bit_stream_end_flag(ctx);
- ctx->hold = false;
- v4l2_m2m_try_schedule(ctx->fh.m2m_ctx);
+ switch (dc->cmd) {
+ case V4L2_DEC_CMD_START:
+ dst_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx,
+ V4L2_BUF_TYPE_VIDEO_CAPTURE);
+ vb2_clear_last_buffer_dequeued(dst_vq);
+ ctx->bit_stream_param &= ~CODA_BIT_STREAM_END_FLAG;
+ break;
+ case V4L2_DEC_CMD_STOP:
+ /* Set the stream-end flag on this context */
+ coda_bit_stream_end_flag(ctx);
+ ctx->hold = false;
+ v4l2_m2m_try_schedule(ctx->fh.m2m_ctx);
+ break;
+ default:
+ return -EINVAL;
+ }
return 0;
}