diff options
Diffstat (limited to 'drivers/media/video/atmel-isi.c')
-rw-r--r-- | drivers/media/video/atmel-isi.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/media/video/atmel-isi.c b/drivers/media/video/atmel-isi.c index 7b89f00501b..774715d2f84 100644 --- a/drivers/media/video/atmel-isi.c +++ b/drivers/media/video/atmel-isi.c | |||
@@ -249,7 +249,7 @@ static int atmel_isi_wait_status(struct atmel_isi *isi, int wait_reset) | |||
249 | Videobuf operations | 249 | Videobuf operations |
250 | ------------------------------------------------------------------*/ | 250 | ------------------------------------------------------------------*/ |
251 | static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, | 251 | static int queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, |
252 | unsigned int *nplanes, unsigned long sizes[], | 252 | unsigned int *nplanes, unsigned int sizes[], |
253 | void *alloc_ctxs[]) | 253 | void *alloc_ctxs[]) |
254 | { | 254 | { |
255 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); | 255 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); |
@@ -341,7 +341,7 @@ static int buffer_prepare(struct vb2_buffer *vb) | |||
341 | 341 | ||
342 | /* Initialize the dma descriptor */ | 342 | /* Initialize the dma descriptor */ |
343 | desc->p_fbd->fb_address = | 343 | desc->p_fbd->fb_address = |
344 | vb2_dma_contig_plane_paddr(vb, 0); | 344 | vb2_dma_contig_plane_dma_addr(vb, 0); |
345 | desc->p_fbd->next_fbd_address = 0; | 345 | desc->p_fbd->next_fbd_address = 0; |
346 | set_dma_ctrl(desc->p_fbd, ISI_DMA_CTRL_WB); | 346 | set_dma_ctrl(desc->p_fbd, ISI_DMA_CTRL_WB); |
347 | 347 | ||
@@ -404,12 +404,13 @@ static void buffer_queue(struct vb2_buffer *vb) | |||
404 | 404 | ||
405 | if (isi->active == NULL) { | 405 | if (isi->active == NULL) { |
406 | isi->active = buf; | 406 | isi->active = buf; |
407 | start_dma(isi, buf); | 407 | if (vb2_is_streaming(vb->vb2_queue)) |
408 | start_dma(isi, buf); | ||
408 | } | 409 | } |
409 | spin_unlock_irqrestore(&isi->lock, flags); | 410 | spin_unlock_irqrestore(&isi->lock, flags); |
410 | } | 411 | } |
411 | 412 | ||
412 | static int start_streaming(struct vb2_queue *vq) | 413 | static int start_streaming(struct vb2_queue *vq, unsigned int count) |
413 | { | 414 | { |
414 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); | 415 | struct soc_camera_device *icd = soc_camera_from_vb2q(vq); |
415 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); | 416 | struct soc_camera_host *ici = to_soc_camera_host(icd->parent); |
@@ -431,17 +432,26 @@ static int start_streaming(struct vb2_queue *vq) | |||
431 | ret = wait_event_interruptible(isi->vsync_wq, | 432 | ret = wait_event_interruptible(isi->vsync_wq, |
432 | isi->state != ISI_STATE_IDLE); | 433 | isi->state != ISI_STATE_IDLE); |
433 | if (ret) | 434 | if (ret) |
434 | return ret; | 435 | goto err; |
435 | 436 | ||
436 | if (isi->state != ISI_STATE_READY) | 437 | if (isi->state != ISI_STATE_READY) { |
437 | return -EIO; | 438 | ret = -EIO; |
439 | goto err; | ||
440 | } | ||
438 | 441 | ||
439 | spin_lock_irq(&isi->lock); | 442 | spin_lock_irq(&isi->lock); |
440 | isi->state = ISI_STATE_WAIT_SOF; | 443 | isi->state = ISI_STATE_WAIT_SOF; |
441 | isi_writel(isi, ISI_INTDIS, ISI_SR_VSYNC); | 444 | isi_writel(isi, ISI_INTDIS, ISI_SR_VSYNC); |
445 | if (count) | ||
446 | start_dma(isi, isi->active); | ||
442 | spin_unlock_irq(&isi->lock); | 447 | spin_unlock_irq(&isi->lock); |
443 | 448 | ||
444 | return 0; | 449 | return 0; |
450 | err: | ||
451 | isi->active = NULL; | ||
452 | isi->sequence = 0; | ||
453 | INIT_LIST_HEAD(&isi->video_buffer_list); | ||
454 | return ret; | ||
445 | } | 455 | } |
446 | 456 | ||
447 | /* abort streaming and wait for last buffer */ | 457 | /* abort streaming and wait for last buffer */ |