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 <[email protected]> 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/[email protected]?part=5
