[media] s5p-fimc: Reinitialize the pipeline properly after VIDIOC_STREAMOFF
authorSylwester Nawrocki <s.nawrocki@samsung.com>
Fri, 16 Mar 2012 14:47:51 +0000 (11:47 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 10 Apr 2012 18:22:47 +0000 (15:22 -0300)
This patch prevents blocking on DQBUF at a video capture node in some
conditions, after STREAOMOFF/STREAMON sequence. The ST_CAPT_SUSPEND
flag should not be set during normal stream off, otherwise the
capture engine is not properly enabled at stream on.

Reported-by: Bernard Debbasch <b.debbasch@ssi.samsung.com>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/s5p-fimc/fimc-capture.c

index b06efd2083287bc74b0f779fabdc159a41414437..a080f0c91e3529fc42f9eebfa061d652c5fa99fb 100644 (file)
@@ -83,7 +83,9 @@ static int fimc_capture_state_cleanup(struct fimc_dev *fimc, bool suspend)
 
        fimc->state &= ~(1 << ST_CAPT_RUN | 1 << ST_CAPT_SHUT |
                         1 << ST_CAPT_STREAM | 1 << ST_CAPT_ISP_STREAM);
-       if (!suspend)
+       if (suspend)
+               fimc->state |= (1 << ST_CAPT_SUSPENDED);
+       else
                fimc->state &= ~(1 << ST_CAPT_PEND | 1 << ST_CAPT_SUSPENDED);
 
        /* Release unused buffers */
@@ -99,7 +101,6 @@ static int fimc_capture_state_cleanup(struct fimc_dev *fimc, bool suspend)
                else
                        vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
        }
-       set_bit(ST_CAPT_SUSPENDED, &fimc->state);
 
        fimc_hw_reset(fimc);
        cap->buf_index = 0;