Skip to content

Commit

Permalink
[media] marvell-cam: ensure that the camera stops when requested
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jonathan Corbet authored and Mauro Carvalho Chehab committed Mar 20, 2012
1 parent 7e4964f commit 49df19e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/media/video/marvell-ccic/mcam-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,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.
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 49df19e

Please sign in to comment.