diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2015-07-09 06:10:16 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-07-17 10:14:54 -0400 |
commit | 5c718bb323aef02ea580073a3640b072fb2f6838 (patch) | |
tree | 5f86dd06a5f58b36ef8cf5020a8b840b5dfa0cba /drivers/media/platform/coda | |
parent | 30a09579b2e238646bca4e7cc443db24d91436d6 (diff) |
[media] coda: avoid calling SEQ_END twice
Allow coda_seq_end_work to be called multiple times, move the setting
of ctx->initialized from coda_start/stop_streaming() into
coda_start_encoding/decoding and coda_seq_end_work, respectively,
and skip the SEQ_END command in coda_seq_end_work if the context is
already deinitialized before.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/platform/coda')
-rw-r--r-- | drivers/media/platform/coda/coda-bit.c | 8 | ||||
-rw-r--r-- | drivers/media/platform/coda/coda-common.c | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c index 0f8dcea065af..ac4dcb1f446a 100644 --- a/drivers/media/platform/coda/coda-bit.c +++ b/drivers/media/platform/coda/coda-bit.c | |||
@@ -999,6 +999,7 @@ static int coda_start_encoding(struct coda_ctx *ctx) | |||
999 | ret = -EFAULT; | 999 | ret = -EFAULT; |
1000 | goto out; | 1000 | goto out; |
1001 | } | 1001 | } |
1002 | ctx->initialized = 1; | ||
1002 | 1003 | ||
1003 | if (dst_fourcc != V4L2_PIX_FMT_JPEG) { | 1004 | if (dst_fourcc != V4L2_PIX_FMT_JPEG) { |
1004 | if (dev->devtype->product == CODA_960) | 1005 | if (dev->devtype->product == CODA_960) |
@@ -1329,6 +1330,9 @@ static void coda_seq_end_work(struct work_struct *work) | |||
1329 | mutex_lock(&ctx->buffer_mutex); | 1330 | mutex_lock(&ctx->buffer_mutex); |
1330 | mutex_lock(&dev->coda_mutex); | 1331 | mutex_lock(&dev->coda_mutex); |
1331 | 1332 | ||
1333 | if (ctx->initialized == 0) | ||
1334 | goto out; | ||
1335 | |||
1332 | v4l2_dbg(1, coda_debug, &dev->v4l2_dev, | 1336 | v4l2_dbg(1, coda_debug, &dev->v4l2_dev, |
1333 | "%d: %s: sent command 'SEQ_END' to coda\n", ctx->idx, | 1337 | "%d: %s: sent command 'SEQ_END' to coda\n", ctx->idx, |
1334 | __func__); | 1338 | __func__); |
@@ -1342,6 +1346,9 @@ static void coda_seq_end_work(struct work_struct *work) | |||
1342 | 1346 | ||
1343 | coda_free_framebuffers(ctx); | 1347 | coda_free_framebuffers(ctx); |
1344 | 1348 | ||
1349 | ctx->initialized = 0; | ||
1350 | |||
1351 | out: | ||
1345 | mutex_unlock(&dev->coda_mutex); | 1352 | mutex_unlock(&dev->coda_mutex); |
1346 | mutex_unlock(&ctx->buffer_mutex); | 1353 | mutex_unlock(&ctx->buffer_mutex); |
1347 | } | 1354 | } |
@@ -1499,6 +1506,7 @@ static int __coda_start_decoding(struct coda_ctx *ctx) | |||
1499 | coda_write(dev, 0, CODA_REG_BIT_BIT_STREAM_PARAM); | 1506 | coda_write(dev, 0, CODA_REG_BIT_BIT_STREAM_PARAM); |
1500 | return -ETIMEDOUT; | 1507 | return -ETIMEDOUT; |
1501 | } | 1508 | } |
1509 | ctx->initialized = 1; | ||
1502 | 1510 | ||
1503 | /* Update kfifo out pointer from coda bitstream read pointer */ | 1511 | /* Update kfifo out pointer from coda bitstream read pointer */ |
1504 | coda_kfifo_sync_from_device(ctx); | 1512 | coda_kfifo_sync_from_device(ctx); |
diff --git a/drivers/media/platform/coda/coda-common.c b/drivers/media/platform/coda/coda-common.c index 3259ea61cd9b..de0e24533727 100644 --- a/drivers/media/platform/coda/coda-common.c +++ b/drivers/media/platform/coda/coda-common.c | |||
@@ -1313,7 +1313,6 @@ static int coda_start_streaming(struct vb2_queue *q, unsigned int count) | |||
1313 | goto err; | 1313 | goto err; |
1314 | } | 1314 | } |
1315 | 1315 | ||
1316 | ctx->initialized = 1; | ||
1317 | return ret; | 1316 | return ret; |
1318 | 1317 | ||
1319 | err: | 1318 | err: |
@@ -1376,7 +1375,6 @@ static void coda_stop_streaming(struct vb2_queue *q) | |||
1376 | mutex_unlock(&ctx->bitstream_mutex); | 1375 | mutex_unlock(&ctx->bitstream_mutex); |
1377 | kfifo_init(&ctx->bitstream_fifo, | 1376 | kfifo_init(&ctx->bitstream_fifo, |
1378 | ctx->bitstream.vaddr, ctx->bitstream.size); | 1377 | ctx->bitstream.vaddr, ctx->bitstream.size); |
1379 | ctx->initialized = 0; | ||
1380 | ctx->runcounter = 0; | 1378 | ctx->runcounter = 0; |
1381 | ctx->aborting = 0; | 1379 | ctx->aborting = 0; |
1382 | } | 1380 | } |
@@ -1767,7 +1765,7 @@ static int coda_release(struct file *file) | |||
1767 | v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); | 1765 | v4l2_m2m_ctx_release(ctx->fh.m2m_ctx); |
1768 | 1766 | ||
1769 | /* In case the instance was not running, we still need to call SEQ_END */ | 1767 | /* In case the instance was not running, we still need to call SEQ_END */ |
1770 | if (ctx->initialized && ctx->ops->seq_end_work) { | 1768 | if (ctx->ops->seq_end_work) { |
1771 | queue_work(dev->workqueue, &ctx->seq_end_work); | 1769 | queue_work(dev->workqueue, &ctx->seq_end_work); |
1772 | flush_work(&ctx->seq_end_work); | 1770 | flush_work(&ctx->seq_end_work); |
1773 | } | 1771 | } |