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>
 
        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 */
                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;