media: stm32-dcmi: revisit stop streaming ops

Do not wait for interrupt completion when stopping streaming,
stopping sensor and disabling interruptions are enough.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
Hugues Fruchet 2018-06-11 05:52:17 -04:00 committed by Mauro Carvalho Chehab
parent 49bcc1746f
commit fdaf59582c
1 changed files with 1 additions and 28 deletions

View File

@ -86,7 +86,6 @@ enum state {
STOPPED = 0, STOPPED = 0,
WAIT_FOR_BUFFER, WAIT_FOR_BUFFER,
RUNNING, RUNNING,
STOPPING,
}; };
#define MIN_WIDTH 16U #define MIN_WIDTH 16U
@ -431,18 +430,6 @@ static irqreturn_t dcmi_irq_thread(int irq, void *arg)
spin_lock_irq(&dcmi->irqlock); spin_lock_irq(&dcmi->irqlock);
/* Stop capture is required */
if (dcmi->state == STOPPING) {
reg_clear(dcmi->regs, DCMI_IER, IT_FRAME | IT_OVR | IT_ERR);
dcmi->state = STOPPED;
complete(&dcmi->complete);
spin_unlock_irq(&dcmi->irqlock);
return IRQ_HANDLED;
}
if ((dcmi->misr & IT_OVR) || (dcmi->misr & IT_ERR)) { if ((dcmi->misr & IT_OVR) || (dcmi->misr & IT_ERR)) {
dcmi->errors_count++; dcmi->errors_count++;
if (dcmi->misr & IT_OVR) if (dcmi->misr & IT_OVR)
@ -700,8 +687,6 @@ static void dcmi_stop_streaming(struct vb2_queue *vq)
{ {
struct stm32_dcmi *dcmi = vb2_get_drv_priv(vq); struct stm32_dcmi *dcmi = vb2_get_drv_priv(vq);
struct dcmi_buf *buf, *node; struct dcmi_buf *buf, *node;
unsigned long time_ms = msecs_to_jiffies(TIMEOUT_MS);
long timeout;
int ret; int ret;
/* Disable stream on the sub device */ /* Disable stream on the sub device */
@ -710,13 +695,6 @@ static void dcmi_stop_streaming(struct vb2_queue *vq)
dev_err(dcmi->dev, "%s: Failed to stop streaming, subdev streamoff error (%d)\n", dev_err(dcmi->dev, "%s: Failed to stop streaming, subdev streamoff error (%d)\n",
__func__, ret); __func__, ret);
spin_lock_irq(&dcmi->irqlock);
dcmi->state = STOPPING;
spin_unlock_irq(&dcmi->irqlock);
timeout = wait_for_completion_interruptible_timeout(&dcmi->complete,
time_ms);
spin_lock_irq(&dcmi->irqlock); spin_lock_irq(&dcmi->irqlock);
/* Disable interruptions */ /* Disable interruptions */
@ -725,12 +703,6 @@ static void dcmi_stop_streaming(struct vb2_queue *vq)
/* Disable DCMI */ /* Disable DCMI */
reg_clear(dcmi->regs, DCMI_CR, CR_ENABLE); reg_clear(dcmi->regs, DCMI_CR, CR_ENABLE);
if (!timeout) {
dev_err(dcmi->dev, "%s: Timeout during stop streaming\n",
__func__);
dcmi->state = STOPPED;
}
/* Return all queued buffers to vb2 in ERROR state */ /* Return all queued buffers to vb2 in ERROR state */
list_for_each_entry_safe(buf, node, &dcmi->buffers, list) { list_for_each_entry_safe(buf, node, &dcmi->buffers, list) {
list_del_init(&buf->list); list_del_init(&buf->list);
@ -738,6 +710,7 @@ static void dcmi_stop_streaming(struct vb2_queue *vq)
} }
dcmi->active = NULL; dcmi->active = NULL;
dcmi->state = STOPPED;
spin_unlock_irq(&dcmi->irqlock); spin_unlock_irq(&dcmi->irqlock);