diff options
| author | Alain Volmat <alain.volmat@foss.st.com> | 2026-01-06 14:34:32 +0300 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2026-03-11 03:05:32 +0300 |
| commit | 4847286b87ccda7bdec8245f35c07203ce9eb0ed (patch) | |
| tree | b6b118cbb47611d519188741833cb1457ba579a2 | |
| parent | 9b6f6208f40dee7e021a97f863cdcdd55c59327c (diff) | |
| download | linux-4847286b87ccda7bdec8245f35c07203ce9eb0ed.tar.xz | |
media: stm32: dcmi: stop the dma transfer on overrun
Ensure to stop the dma transfer whenever receiving a overrun
to avoid having a buffer partially filled with a frame and
partially with the next frame.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
| -rw-r--r-- | drivers/media/platform/st/stm32/stm32-dcmi.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/media/platform/st/stm32/stm32-dcmi.c b/drivers/media/platform/st/stm32/stm32-dcmi.c index 0874974bbad4..20f5b9ab6a1c 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmi.c +++ b/drivers/media/platform/st/stm32/stm32-dcmi.c @@ -402,9 +402,21 @@ static irqreturn_t dcmi_irq_thread(int irq, void *arg) spin_lock_irq(&dcmi->irqlock); if (dcmi->misr & IT_OVR) { + /* Disable capture */ + reg_clear(dcmi->regs, DCMI_CR, CR_CAPTURE); + dcmi->overrun_count++; + if (dcmi->overrun_count > OVERRUN_ERROR_THRESHOLD) dcmi->errors_count++; + + spin_unlock_irq(&dcmi->irqlock); + dmaengine_terminate_sync(dcmi->dma_chan); + + if (dcmi_restart_capture(dcmi)) + dev_err(dcmi->dev, "%s: Cannot restart capture\n", __func__); + + return IRQ_HANDLED; } if (dcmi->misr & IT_ERR) dcmi->errors_count++; |
