Re: [PATCH v2 05/14] iio: adc: stm32-adc: rework internal channels data
From: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Date: 2026-09-24 10:03:09
Also in:
linux-arm-kernel, linux-iio, lkml
On 9/23/26 17:39, Fabrice Gasnier wrote:
Diversity in internal channels data array lead to have zeroed data. To facilitate addition of new internal channels, without touching all array initializers, only focus on exiting channels on each supported ADC variant (e.g. each SoC). This also allows to get rid of static_assert() checks. No functional change intended.
[ snip ]
quoted hunk ↗ jump to hunk
-static const unsigned int stm32_adc_min_ts_mp1[] = { 100, 100, 100, 4300, 9800 }; -static_assert(ARRAY_SIZE(stm32_adc_min_ts_mp1) == STM32_ADC_INT_CH_NB); +static const unsigned int stm32_adc_min_ts_mp1[STM32_ADC_INT_CH_NB] = { + [STM32_ADC_INT_CH_VDDCORE] = 100, + [STM32_ADC_INT_CH_VREFINT] = 4300, + [STM32_ADC_INT_CH_VBAT] = 9800 +};
Hi all, Oops, I just figured out I've mixed changes with a fix here. So, I just have sent a separate fix for that [1]. It's been noticed by sashiko [2]. I'll wait a bit before sending a V3, to leave time to review other patches.
quoted hunk ↗ jump to hunk
static const struct stm32_adc_cfg stm32mp1_adc_cfg = { .regs = &stm32mp1_adc_regspec,@@ -2760,8 +2756,13 @@ static const struct stm32_adc_cfg stm32mp1_adc_cfg = { .vref_charac_mv = 3300, }; -static const unsigned int stm32_adc_min_ts_mp13[] = { 100, 0, 0, 4300, 9800 }; -static_assert(ARRAY_SIZE(stm32_adc_min_ts_mp13) == STM32_ADC_INT_CH_NB); +static const unsigned int stm32_adc_min_ts_mp13[STM32_ADC_INT_CH_NB] = { + [STM32_ADC_INT_CH_VDDCORE] = 1000, + [STM32_ADC_INT_CH_VDDCPU] = 1000, + [STM32_ADC_INT_CH_VDDQ_DDR] = 1000, + [STM32_ADC_INT_CH_VREFINT] = 4300, + [STM32_ADC_INT_CH_VBAT] = 9800 +};
Same here. [1] https://lore.kernel.org/linux-iio/20260924-adc-fix-sampling-v1-1-13814954d8d7@foss.st.com/ (local) [2] https://sashiko.dev/#/message/20260923155115.20E4E1F00893%40smtp.kernel.org BR, Fabrice
static const struct stm32_adc_cfg stm32mp13_adc_cfg = {
.regs = &stm32mp13_adc_regspec,