summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/stm32-adc-core.h
diff options
context:
space:
mode:
authorFabrice Gasnier <fabrice.gasnier@st.com>2019-09-17 14:38:16 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2019-10-09 19:11:26 +0100
commitdcb10920179ab74caf88a6f2afadecfc2743b910 (patch)
treeadae8a51062c3dbea4d81bf84ba1395b279323a1 /drivers/iio/adc/stm32-adc-core.h
parent31922f62bb527d749b99dbc776e514bcba29b7fe (diff)
downloadlinux-stable-dcb10920179ab74caf88a6f2afadecfc2743b910.tar.gz
linux-stable-dcb10920179ab74caf88a6f2afadecfc2743b910.tar.bz2
linux-stable-dcb10920179ab74caf88a6f2afadecfc2743b910.zip
iio: adc: stm32-adc: fix a race when using several adcs with dma and irq
End of conversion may be handled by using IRQ or DMA. There may be a race when two conversions complete at the same time on several ADCs. EOC can be read as 'set' for several ADCs, with: - an ADC configured to use IRQs. EOCIE bit is set. The handler is normally called in this case. - an ADC configured to use DMA. EOCIE bit isn't set. EOC triggers the DMA request instead. It's then automatically cleared by DMA read. But the handler gets called due to status bit is temporarily set (IRQ triggered by the other ADC). So both EOC status bit in CSR and EOCIE control bit must be checked before invoking the interrupt handler (e.g. call ISR only for IRQ-enabled ADCs). Fixes: 2763ea0585c9 ("iio: adc: stm32: add optional dma support") Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc/stm32-adc-core.h')
-rw-r--r--drivers/iio/adc/stm32-adc-core.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/iio/adc/stm32-adc-core.h b/drivers/iio/adc/stm32-adc-core.h
index 94aa2d2577dc..2579d514c2a3 100644
--- a/drivers/iio/adc/stm32-adc-core.h
+++ b/drivers/iio/adc/stm32-adc-core.h
@@ -25,6 +25,7 @@
* --------------------------------------------------------
*/
#define STM32_ADC_MAX_ADCS 3
+#define STM32_ADC_OFFSET 0x100
#define STM32_ADCX_COMN_OFFSET 0x300
/* STM32F4 - Registers for each ADC instance */