diff options
author | Hugues Fruchet <hugues.fruchet@st.com> | 2018-06-11 05:52:17 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2018-06-28 07:48:11 -0400 |
commit | fdaf59582c037ca5bd23f23ab28c1c5c384c0520 (patch) | |
tree | cce3a15d14c35e06ad55b6c538f44400c9547cd8 /drivers/media/platform/stm32/stm32-dcmi.c | |
parent | 49bcc1746ffbf94f41840718c5fab1a8d56c82d8 (diff) |
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>
Diffstat (limited to 'drivers/media/platform/stm32/stm32-dcmi.c')
-rw-r--r-- | drivers/media/platform/stm32/stm32-dcmi.c | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c index 5d866ac69d5c..db49db78e00d 100644 --- a/drivers/media/platform/stm32/stm32-dcmi.c +++ b/drivers/media/platform/stm32/stm32-dcmi.c | |||
@@ -86,7 +86,6 @@ enum state { | |||
86 | STOPPED = 0, | 86 | STOPPED = 0, |
87 | WAIT_FOR_BUFFER, | 87 | WAIT_FOR_BUFFER, |
88 | RUNNING, | 88 | RUNNING, |
89 | STOPPING, | ||
90 | }; | 89 | }; |
91 | 90 | ||
92 | #define MIN_WIDTH 16U | 91 | #define MIN_WIDTH 16U |
@@ -431,18 +430,6 @@ static irqreturn_t dcmi_irq_thread(int irq, void *arg) | |||
431 | 430 | ||
432 | spin_lock_irq(&dcmi->irqlock); | 431 | spin_lock_irq(&dcmi->irqlock); |
433 | 432 | ||
434 | /* Stop capture is required */ | ||
435 | if (dcmi->state == STOPPING) { | ||
436 | reg_clear(dcmi->regs, DCMI_IER, IT_FRAME | IT_OVR | IT_ERR); | ||
437 | |||
438 | dcmi->state = STOPPED; | ||
439 | |||
440 | complete(&dcmi->complete); | ||
441 | |||
442 | spin_unlock_irq(&dcmi->irqlock); | ||
443 | return IRQ_HANDLED; | ||
444 | } | ||
445 | |||
446 | if ((dcmi->misr & IT_OVR) || (dcmi->misr & IT_ERR)) { | 433 | if ((dcmi->misr & IT_OVR) || (dcmi->misr & IT_ERR)) { |
447 | dcmi->errors_count++; | 434 | dcmi->errors_count++; |
448 | if (dcmi->misr & IT_OVR) | 435 | if (dcmi->misr & IT_OVR) |
@@ -700,8 +687,6 @@ static void dcmi_stop_streaming(struct vb2_queue *vq) | |||
700 | { | 687 | { |
701 | struct stm32_dcmi *dcmi = vb2_get_drv_priv(vq); | 688 | struct stm32_dcmi *dcmi = vb2_get_drv_priv(vq); |
702 | struct dcmi_buf *buf, *node; | 689 | struct dcmi_buf *buf, *node; |
703 | unsigned long time_ms = msecs_to_jiffies(TIMEOUT_MS); | ||
704 | long timeout; | ||
705 | int ret; | 690 | int ret; |
706 | 691 | ||
707 | /* Disable stream on the sub device */ | 692 | /* Disable stream on the sub device */ |
@@ -711,13 +696,6 @@ static void dcmi_stop_streaming(struct vb2_queue *vq) | |||
711 | __func__, ret); | 696 | __func__, ret); |
712 | 697 | ||
713 | spin_lock_irq(&dcmi->irqlock); | 698 | spin_lock_irq(&dcmi->irqlock); |
714 | dcmi->state = STOPPING; | ||
715 | spin_unlock_irq(&dcmi->irqlock); | ||
716 | |||
717 | timeout = wait_for_completion_interruptible_timeout(&dcmi->complete, | ||
718 | time_ms); | ||
719 | |||
720 | spin_lock_irq(&dcmi->irqlock); | ||
721 | 699 | ||
722 | /* Disable interruptions */ | 700 | /* Disable interruptions */ |
723 | reg_clear(dcmi->regs, DCMI_IER, IT_FRAME | IT_OVR | IT_ERR); | 701 | reg_clear(dcmi->regs, DCMI_IER, IT_FRAME | IT_OVR | IT_ERR); |
@@ -725,12 +703,6 @@ static void dcmi_stop_streaming(struct vb2_queue *vq) | |||
725 | /* Disable DCMI */ | 703 | /* Disable DCMI */ |
726 | reg_clear(dcmi->regs, DCMI_CR, CR_ENABLE); | 704 | reg_clear(dcmi->regs, DCMI_CR, CR_ENABLE); |
727 | 705 | ||
728 | if (!timeout) { | ||
729 | dev_err(dcmi->dev, "%s: Timeout during stop streaming\n", | ||
730 | __func__); | ||
731 | dcmi->state = STOPPED; | ||
732 | } | ||
733 | |||
734 | /* Return all queued buffers to vb2 in ERROR state */ | 706 | /* Return all queued buffers to vb2 in ERROR state */ |
735 | list_for_each_entry_safe(buf, node, &dcmi->buffers, list) { | 707 | list_for_each_entry_safe(buf, node, &dcmi->buffers, list) { |
736 | list_del_init(&buf->list); | 708 | list_del_init(&buf->list); |
@@ -738,6 +710,7 @@ static void dcmi_stop_streaming(struct vb2_queue *vq) | |||
738 | } | 710 | } |
739 | 711 | ||
740 | dcmi->active = NULL; | 712 | dcmi->active = NULL; |
713 | dcmi->state = STOPPED; | ||
741 | 714 | ||
742 | spin_unlock_irq(&dcmi->irqlock); | 715 | spin_unlock_irq(&dcmi->irqlock); |
743 | 716 | ||