summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2012-03-16 23:14:50 +0100
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-03-20 02:15:12 +0100
commit49df19ebcc60fd46f2587774cd6e224007af1116 (patch)
tree22091196fc706c8d2e2d4d557f63ad5d41b9632c /drivers/media
parent[media] em28xx: Unused macro cleanup (diff)
downloadlinux-49df19ebcc60fd46f2587774cd6e224007af1116.tar.xz
linux-49df19ebcc60fd46f2587774cd6e224007af1116.zip
[media] marvell-cam: ensure that the camera stops when requested
The controller stop/restart logic could possibly restart DMA after the driver things things have stopped, with suitably ugly results. Make sure that we only restart the hardware if we're supposed to be streaming. Signed-off-by: Jonathan Corbet <corbet@lwn.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/marvell-ccic/mcam-core.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/media/video/marvell-ccic/mcam-core.c b/drivers/media/video/marvell-ccic/mcam-core.c
index 37d20e73908a..35cd89d3e676 100644
--- a/drivers/media/video/marvell-ccic/mcam-core.c
+++ b/drivers/media/video/marvell-ccic/mcam-core.c
@@ -556,6 +556,11 @@ static void mcam_dma_sg_done(struct mcam_camera *cam, int frame)
struct mcam_vb_buffer *buf = cam->vb_bufs[0];
/*
+ * If we're no longer supposed to be streaming, don't do anything.
+ */
+ if (cam->state != S_STREAMING)
+ return;
+ /*
* Very Bad Not Good Things happen if you don't clear
* C1_DESC_ENA before making any descriptor changes.
*/
@@ -922,7 +927,7 @@ static void mcam_vb_buf_queue(struct vb2_buffer *vb)
spin_lock_irqsave(&cam->dev_lock, flags);
start = (cam->state == S_BUFWAIT) && !list_empty(&cam->buffers);
list_add(&mvb->queue, &cam->buffers);
- if (test_bit(CF_SG_RESTART, &cam->flags))
+ if (cam->state == S_STREAMING && test_bit(CF_SG_RESTART, &cam->flags))
mcam_sg_restart(cam);
spin_unlock_irqrestore(&cam->dev_lock, flags);
if (start)