diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2011-03-25 04:24:01 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-05-20 10:52:53 -0400 |
commit | 08a31b960598adef6aa9430c2cab4b5ef4db1ab8 (patch) | |
tree | cfe1e8c542d25dd171af8ef25eecea6404e604d1 /drivers/media | |
parent | 066f7867207b8e13d2062069e0ba7cb3a5bf04b2 (diff) |
[media] V4L: mx3_camera: implement .stop_streaming()
The .stop_streaming() videobuf2 operation has to be implemented to
guarantee, that video buffers are not written to after a STREAMOFF.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/mx3_camera.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index 502e2a40964c..8630c0c9e60a 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c | |||
@@ -400,6 +400,35 @@ static int mx3_videobuf_init(struct vb2_buffer *vb) | |||
400 | return 0; | 400 | return 0; |
401 | } | 401 | } |
402 | 402 | ||
403 | static int mx3_stop_streaming(struct vb2_queue *q) | ||
404 | { | ||
405 | struct soc_camera_device *icd = soc_camera_from_vb2q(q); | ||
406 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | ||
407 | struct mx3_camera_dev *mx3_cam = ici->priv; | ||
408 | struct idmac_channel *ichan = mx3_cam->idmac_channel[0]; | ||
409 | struct dma_chan *chan; | ||
410 | struct mx3_camera_buffer *buf, *tmp; | ||
411 | unsigned long flags; | ||
412 | |||
413 | if (ichan) { | ||
414 | chan = &ichan->dma_chan; | ||
415 | chan->device->device_control(chan, DMA_TERMINATE_ALL, 0); | ||
416 | } | ||
417 | |||
418 | spin_lock_irqsave(&mx3_cam->lock, flags); | ||
419 | |||
420 | mx3_cam->active = NULL; | ||
421 | |||
422 | list_for_each_entry_safe(buf, tmp, &mx3_cam->capture, queue) { | ||
423 | buf->state = CSI_BUF_NEEDS_INIT; | ||
424 | list_del_init(&buf->queue); | ||
425 | } | ||
426 | |||
427 | spin_unlock_irqrestore(&mx3_cam->lock, flags); | ||
428 | |||
429 | return 0; | ||
430 | } | ||
431 | |||
403 | static struct vb2_ops mx3_videobuf_ops = { | 432 | static struct vb2_ops mx3_videobuf_ops = { |
404 | .queue_setup = mx3_videobuf_setup, | 433 | .queue_setup = mx3_videobuf_setup, |
405 | .buf_prepare = mx3_videobuf_prepare, | 434 | .buf_prepare = mx3_videobuf_prepare, |
@@ -408,6 +437,7 @@ static struct vb2_ops mx3_videobuf_ops = { | |||
408 | .buf_init = mx3_videobuf_init, | 437 | .buf_init = mx3_videobuf_init, |
409 | .wait_prepare = soc_camera_unlock, | 438 | .wait_prepare = soc_camera_unlock, |
410 | .wait_finish = soc_camera_lock, | 439 | .wait_finish = soc_camera_lock, |
440 | .stop_streaming = mx3_stop_streaming, | ||
411 | }; | 441 | }; |
412 | 442 | ||
413 | static int mx3_camera_init_videobuf(struct vb2_queue *q, | 443 | static int mx3_camera_init_videobuf(struct vb2_queue *q, |