diff options
-rw-r--r-- | board/samus_pd/board.h | 1 | ||||
-rw-r--r-- | chip/stm32/adc-stm32f0.c | 16 | ||||
-rw-r--r-- | include/config.h | 3 |
3 files changed, 17 insertions, 3 deletions
diff --git a/board/samus_pd/board.h b/board/samus_pd/board.h index da536d16e0..627fc087c2 100644 --- a/board/samus_pd/board.h +++ b/board/samus_pd/board.h @@ -17,6 +17,7 @@ /* Optional features */ #define CONFIG_ADC +#undef CONFIG_ADC_WATCHDOG #define CONFIG_BOARD_PRE_INIT #define CONFIG_CHARGE_MANAGER #define CONFIG_CHARGE_RAMP diff --git a/chip/stm32/adc-stm32f0.c b/chip/stm32/adc-stm32f0.c index 6fdabc0789..c6e1d94b62 100644 --- a/chip/stm32/adc-stm32f0.c +++ b/chip/stm32/adc-stm32f0.c @@ -18,9 +18,6 @@ struct mutex adc_lock; -static int watchdog_ain_id; -static int watchdog_delay_ms; - static const struct dma_option dma_adc_option = { STM32_DMAC_ADC, (void *)&STM32_ADC_DR, STM32_DMA_CCR_MSIZE_32_BIT | STM32_DMA_CCR_PSIZE_32_BIT, @@ -35,6 +32,11 @@ static void adc_configure(int ain_id) STM32_ADC_CFGR1 &= ~0x1; } +#ifdef CONFIG_ADC_WATCHDOG + +static int watchdog_ain_id; +static int watchdog_delay_ms; + static void adc_continuous_read(int ain_id) { adc_configure(ain_id); @@ -193,6 +195,14 @@ int adc_set_watchdog_delay(int delay_ms) return EC_SUCCESS; } +#else /* CONFIG_ADC_WATCHDOG */ + +static int adc_watchdog_enabled(void) { return 0; } +static int adc_enable_watchdog_no_lock(void) { return 0; } +static int adc_disable_watchdog_no_lock(void) { return 0; } + +#endif /* CONFIG_ADC_WATCHDOG */ + int adc_read_channel(enum adc_channel ch) { const struct adc_t *adc = adc_channels + ch; diff --git a/include/config.h b/include/config.h index e3215500a9..1a11f2f015 100644 --- a/include/config.h +++ b/include/config.h @@ -54,6 +54,9 @@ /* ADC sample time selection. The value is chip-dependent. */ #undef CONFIG_ADC_SAMPLE_TIME +/* Include the ADC analog watchdog feature in the ADC code */ +#define CONFIG_ADC_WATCHDOG + /* * Some ALS modules may be connected to the EC. We need the command, and * specific drivers for each module. |