From: sashiko-bot@kernel.org
To: "Fabrice Gasnier" <fabrice.gasnier@foss.st.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v2 07/14] iio: adc: stm32-adc: add support for stm32mp25
Date: Wed, 23 Sep 2026 16:14:05 +0000 [thread overview]
Message-ID: <20260923161405.CFD371F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260923-adc-stm32mp25-v1-v2-7-46bc019537c6@foss.st.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] iio: adc: stm32-adc: DIFSEL and CFGR writes fail silently when ADEN=1
--
commit 100a3f1abe7bc0887c43d25f1c79c051b323c2a8
Author: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
iio: adc: stm32-adc: add support for stm32mp25
This commit adds support for the ADC on the STM32MP25 SoC. It introduces new
hardware configurations, trigger lists, and a dedicated software calibration
procedure for the new SoC.
> diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
> index eecdc4cce1b4b..a5bffc09898ba 100644
> --- a/drivers/iio/adc/stm32-adc.c
> +++ b/drivers/iio/adc/stm32-adc.c
[ ... ]
> @@ -1304,6 +1437,184 @@ static void stm32h7_adc_unprepare(struct iio_dev *indio_dev)
> stm32h7_adc_enter_pwr_down(adc);
> }
>
> +/*
> + * STM32MP25 offset calibration software procedure. Basically the calibration routine is
[ ... ]
> +static int stm32mp25_adc_calib(struct iio_dev *indio_dev)
> +{
> + struct stm32_adc *adc = iio_priv(indio_dev);
> + bool add_offset = false;
> + bool diff_below_zero;
> + u32 average, calfact;
> + int ret;
> +
> + stm32_adc_set_bits(adc, STM32H7_ADC_CR, STM32H7_ADCAL);
> + /* Use default resolution (e.g. 12 bits) */
> + stm32_adc_clr_bits(adc, STM32H7_ADC_CFGR, STM32MP25_RES_MASK);
[Severity: High]
Does this clear the resolution bits correctly?
Since stm32h7_adc_enable() was already called in stm32mp25_adc_prepare(), ADEN
is set to 1. On STM32 ADCs, configuration registers like CFGR are locked by
hardware when the ADC is enabled, so this write might be silently ignored.
This could cause calibration to run at the wrong resolution if a non-default
resolution was configured by the user.
[ ... ]
> +static int stm32mp25_adc_prepare(struct iio_dev *indio_dev)
> +{
> + struct stm32_adc *adc = iio_priv(indio_dev);
> + int ret;
> +
> + ret = stm32h7_adc_exit_pwr_down(indio_dev);
> + if (ret)
> + return ret;
> +
> + /* Must enable the ADC before running software-assisted calibration */
> + ret = stm32h7_adc_enable(indio_dev);
> + if (ret)
> + goto pwr_dwn;
> +
> + /* Always run offset calibration */
> + ret = stm32mp25_adc_calib(indio_dev);
> + if (ret)
> + goto adc_dis;
> +
> + stm32_adc_int_ch_enable(indio_dev);
> +
> + stm32_adc_writel(adc, adc->cfg->regs->difsel.reg, adc->difsel);
[Severity: High]
Will this configuration of differential channels be silently ignored?
The ADC is already enabled (ADEN=1) from the earlier call to
stm32h7_adc_enable(). Hardware locking prevents writes to DIFSEL while the
ADC is enabled, which would leave the channels configured as single-ended.
> +
> + if (adc->cfg->has_presel)
> + stm32_adc_writel(adc, STM32H7_ADC_PCSEL, adc->pcsel);
> +
> + return 0;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260923-adc-stm32mp25-v1-v2-0-46bc019537c6@foss.st.com?part=7
next prev parent reply other threads:[~2026-09-23 16:14 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 15:39 [PATCH v2 00/14] iio: adc: stm32: add support for stm32mp23 and stm32mp25 Fabrice Gasnier
2026-09-23 15:39 ` [PATCH v2 01/14] dt-bindings: iio: adc: stm32-adc: " Fabrice Gasnier
2026-09-23 15:39 ` [PATCH v2 02/14] iio: adc: stm32-adc: core: manage clock prescaler diversity Fabrice Gasnier
2026-09-27 18:57 ` Jonathan Cameron
2026-09-23 15:39 ` [PATCH v2 03/14] iio: adc: stm32-adc: core: configurable number of interrupts Fabrice Gasnier
2026-09-23 15:39 ` [PATCH v2 04/14] iio: adc: stm32-adc: manage characterization voltage diversity Fabrice Gasnier
2026-09-23 15:39 ` [PATCH v2 05/14] iio: adc: stm32-adc: rework internal channels data Fabrice Gasnier
2026-09-23 15:51 ` sashiko-bot
2026-09-24 10:02 ` Fabrice Gasnier
2026-09-24 20:53 ` Andy Shevchenko
2026-09-23 15:39 ` [PATCH v2 06/14] iio: adc: stm32-adc: add vreg enable option to manage diversity Fabrice Gasnier
2026-09-23 15:39 ` [PATCH v2 07/14] iio: adc: stm32-adc: add support for stm32mp25 Fabrice Gasnier
2026-09-23 16:14 ` sashiko-bot [this message]
2026-09-24 21:01 ` Andy Shevchenko
2026-09-29 16:48 ` Fabrice Gasnier
2026-09-30 8:33 ` Andy Shevchenko
2026-09-30 8:44 ` Fabrice Gasnier
2026-09-30 8:55 ` Andy Shevchenko
2026-09-23 15:39 ` [PATCH v2 08/14] iio: adc: stm32-adc: add support for stm32mp23 Fabrice Gasnier
2026-09-23 15:39 ` [PATCH v2 09/14] iio: adc: stm32: add support for vddgpu on stm32mp23 and stm32mp25 Fabrice Gasnier
2026-09-27 19:03 ` Jonathan Cameron
2026-09-23 15:39 ` [PATCH v2 10/14] arm64: dts: st: add vrefint calibration on stm32mp23 Fabrice Gasnier
2026-09-23 15:39 ` [PATCH v2 11/14] arm64: dts: st: add vrefint calibration on stm32mp25 Fabrice Gasnier
2026-09-23 15:39 ` [PATCH v2 12/14] arm64: dts: st: add ADC nodes on stm32mp231 Fabrice Gasnier
2026-09-23 15:39 ` [PATCH v2 13/14] arm64: dts: st: add ADC nodes on stm32mp251 Fabrice Gasnier
2026-09-23 15:39 ` [PATCH v2 14/14] arm64: dts: st: add ADC support on stm32mp257f-ev1 board Fabrice Gasnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260923161405.CFD371F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=fabrice.gasnier@foss.st.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox