Linux Sound subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Olivier Moysan" <olivier.moysan@foss.st.com>
Cc: devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-sound@vger.kernel.org, robh@kernel.org,
	conor+dt@kernel.org, media-ci@linuxtv.org
Subject: Re: [PATCH v2 05/11] iio: adc: stm32-mdf: add digital filter device support
Date: Wed, 18 Nov 2026 15:40:47 +0000	[thread overview]
Message-ID: <sashiko-outbox-221354@kernel.org> (raw)
In-Reply-To: <20261118-upstream_mdf_v2-v2-5-7939d3c3720a@foss.st.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] iio: adc: stm32-mdf: unpropagated rsflt_bypass in
  stm32_mdf_adc_parse_of()
- [Medium] iio: adc: stm32-mdf: unbalanced kclk prepare count for
  filters in suspend
--

commit 7cf0176f9896de83d6274c225f454821ace01160
Author: Olivier Moysan <olivier.moysan@foss.st.com>

iio: adc: stm32-mdf: add digital filter device support

This commit introduces the STM32 MDF digital filter platform driver, regmap
configuration, and device tree parsing for filter parameters and BSMX serial
interface routing.

> diff --git a/drivers/iio/adc/stm32-mdf-adc.c b/drivers/iio/adc/stm32-mdf-adc.c
> new file mode 100644
> index 0000000000000..411af78911c91
> --- /dev/null
> +++ b/drivers/iio/adc/stm32-mdf-adc.c

[ ... ]

> +static int stm32_mdf_adc_parse_of(struct platform_device *pdev, struct stm32_mdf_adc *adc)
> +{

[ ... ]

> +	/*
> +	 * In interleave mode the filters in range [1..n] share their configuration with filter 0.
> +	 * In this case, use config from filter 0, instead of parsing DT.
> +	 */
> +	if (!MDF_IS_FILTER0(adc) && adc->fl_id < adc->mdf->nb_interleave) {
> +		adc->interleaved = true;
> +	} else {
> +		ret = stm32_mdf_get_filters_config(dev, adc);
> +		if (ret)
> +			return ret;
> +
> +		if (MDF_IS_FILTER0(adc) && adc->mdf->nb_interleave) {
> +			/* Filter 0 is the TRGO trigger source in interleave mode */
> +			adc->trgo = true;
> +			adc->interleaved = true;
> +			buf_size = adc->mdf->nb_interleave;
> +		}
> +	}

[Severity: Medium]
Does skipping stm32_mdf_get_filters_config() here leave adc->rsflt_bypass
unset on interleaved filters 1..n?

In commit "iio: adc: stm32-mdf: configure cic filters and sample rates",
stm32_mdf_adc_apply_filters_config() copies datsrc, cicmode, decim_cic,
nbdis, and hpf_cutoff from filter 0 to each interleaved filter, but never
copies adc->rsflt_bypass.  When st,rs-filter-bypass is set on filter 0,
interleaved filters 1..n will leave MDF_DFLTRSFR_RSFLTBYP cleared while
filter 0 bypasses the reshape filter, resulting in mismatched decimation
ratios and gain across the interleaved channels.

[ ... ]

> +static int stm32_mdf_adc_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct stm32_mdf_adc *adc;
> +	struct iio_dev *iio;
> +	struct resource *res;
> +	void __iomem *base;
> +	int ret;
> +
> +	iio = devm_iio_device_alloc(dev, sizeof(*adc));
> +	if (!iio) {
> +		dev_err(dev, "Failed to allocate IIO device\n");
> +		return -ENOMEM;
> +	}
> +	iio->modes = INDIO_DIRECT_MODE;
> +
> +	adc = iio_priv(iio);
> +	adc->mdf = dev_get_drvdata(dev->parent);
> +
> +	platform_set_drvdata(pdev, iio);
> +
> +	base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> +	if (IS_ERR(base))
> +		return dev_err_probe(dev, PTR_ERR(base), "Failed to get resource\n");
> +	adc->phys_addr = res->start;
> +
> +	adc->regmap = stm32_mdf_regmap_init(dev, adc->mdf->kclk, base, &stm32_mdf_regmap_cfg);

[Severity: Medium]
Does attaching adc->mdf->kclk to adc->regmap here leave kclk prepared
across system suspend?

stm32_mdf_regmap_init() calls regmap_mmio_attach_clk(), which prepares
mdf->kclk once for each probed filter.  However, stm32_mdf_core_suspend()
and stm32_mdf_core_resume() only unprepare and re-prepare kclk for the
core regmap and each entry in mdf->sitf_list (and stm32_mdf_adc_suspend()
in commit "iio: adc: stm32-mdf: add dma buffered acquisition support"
does not unprepare it either), preventing mdf->kclk from being unprepared
during system sleep whenever any filter is probed.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118-upstream_mdf_v2-v2-0-7939d3c3720a@foss.st.com?part=5

  reply	other threads:[~2026-11-18 15:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 15:17 [PATCH v2 00/11] iio: adc: stm32: add mdf support for stm32mp2 Olivier Moysan
2026-11-18 15:17 ` [PATCH v2 01/11] dt-bindings: iio: adc: add stm32mp2 mdf filter Olivier Moysan
2026-11-18 15:17 ` [PATCH v2 02/11] iio: adc: stm32-mdf: add core registration Olivier Moysan
2026-11-18 15:45   ` sashiko-bot
2026-11-18 15:17 ` [PATCH v2 03/11] iio: adc: stm32-mdf: add cck clocks provider Olivier Moysan
2026-11-18 15:50   ` sashiko-bot
2026-11-18 15:17 ` [PATCH v2 04/11] iio: adc: stm32-mdf: add serial interfaces support Olivier Moysan
2026-11-18 15:42   ` sashiko-bot
2026-11-18 15:17 ` [PATCH v2 05/11] iio: adc: stm32-mdf: add digital filter device support Olivier Moysan
2026-11-18 15:40   ` sashiko-bot [this message]
2026-11-18 15:17 ` [PATCH v2 06/11] iio: adc: stm32-mdf: configure cic filters and sample rates Olivier Moysan
2026-11-18 15:34   ` sashiko-bot
2026-11-18 15:17 ` [PATCH v2 07/11] iio: adc: stm32-mdf: add direct iio conversion support Olivier Moysan
2026-11-18 15:51   ` sashiko-bot
2026-11-18 15:17 ` [PATCH v2 08/11] iio: adc: stm32-mdf: add dma buffered acquisition support Olivier Moysan
2026-11-18 15:55   ` sashiko-bot
2026-11-18 15:17 ` [PATCH v2 09/11] iio: adc: stm32-mdf: add external timer trigger support Olivier Moysan
2026-11-18 15:37   ` sashiko-bot
2026-11-18 15:17 ` [PATCH v2 10/11] iio: adc: stm32-mdf: add dmic audio filter support Olivier Moysan
2026-11-18 16:06   ` sashiko-bot
2026-11-18 15:17 ` [PATCH v2 11/11] ASoC: stm32: add mdf dai support Olivier Moysan
2026-11-18 16:08   ` sashiko-bot

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=sashiko-outbox-221354@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=media-ci@linuxtv.org \
    --cc=olivier.moysan@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