Skip to content

Commit 64e6a22

Browse files
Fabrice Gasnierfourmone
authored andcommitted
iio: adc: stm32: fix pcsel before disabling adc vdda supply
Some I/Os are connected to ADC input channels, when the corresponding bit in PCSEL register are set on STM32H7 and STM32MP15. This is done in the prepare routine of stm32-adc driver. There are constraints here, as PCSEL shouldn't be set when VDDA supply is disabled. Enabling/disabling of VDDA supply in done via stm32-adc-core runtime PM routines (before/after ADC is enabled/disabled). Currently, PCSEL remains set when disabling ADC. Later on, PM runtime can disable the VDDA supply. This creates some conditions on I/Os that can start to leak current. So PCSEL needs to be cleared when disabling the ADC. Fixes: 95e339b ("iio: adc: stm32: add support for STM32H7") Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Change-Id: I8fcc94255380866a9b27f16925206d39a8bcd6d9 Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/linux-stm32/+/224865 Reviewed-by: CITOOLS <MDG-smet-aci-reviews@list.st.com> Reviewed-by: CIBUILD <MDG-smet-aci-builds@list.st.com> Reviewed-by: Olivier MOYSAN <olivier.moysan@foss.st.com> Tested-by: Olivier MOYSAN <olivier.moysan@foss.st.com>
1 parent 453d395 commit 64e6a22

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/iio/adc/stm32-adc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,7 @@ static void stm32h7_adc_unprepare(struct iio_dev *indio_dev)
11071107
{
11081108
struct stm32_adc *adc = iio_priv(indio_dev);
11091109

1110+
stm32_adc_writel(adc, STM32H7_ADC_PCSEL, 0);
11101111
stm32h7_adc_disable(indio_dev);
11111112
stm32_adc_int_ch_disable(adc);
11121113
stm32h7_adc_enter_pwr_down(adc);

0 commit comments

Comments
 (0)