Devicetree
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Olivier MOYSAN <olivier.moysan@foss.st.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
	"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] dt-bindings: iio: adc: add bindings for stm32 mdf filter
Date: Wed, 14 Oct 2026 23:49:17 +0100	[thread overview]
Message-ID: <20261014-unmade-sphinx-71cb25110d58@spud> (raw)
In-Reply-To: <48e528a5-0c54-4778-bd29-b6f44ae95be7@foss.st.com>

[-- Attachment #1: Type: text/plain, Size: 9728 bytes --]

On Wed, Oct 14, 2026 at 06:51:45PM +0200, Olivier MOYSAN wrote:
> On 10/14/26 17:15, Conor Dooley wrote:
> > On Mon, Oct 12, 2026 at 02:56:04PM +0200, Olivier MOYSAN wrote:
> > > On 10/9/26 21:12, Conor Dooley wrote:
> > > > On Thu, Oct 08, 2026 at 06:37:26PM +0200, Olivier MOYSAN wrote:
> > > > > On 10/8/26 12:11, Conor Dooley wrote:
> > > > > > On Wed, Oct 07, 2026 at 11:01:28AM +0200, Olivier MOYSAN wrote:
> > > > > > > On 10/1/26 20:32, Conor Dooley wrote:
> > > > > > > > 
> > > > > > > > > +
> > > > > > > > > +required:
> > > > > > > > > +  - compatible
> > > > > > > > > +  - reg
> > > > > > > > > +  - ranges
> > > > > > > > > +  - clocks
> > > > > > > > > +  - clock-names
> > > > > > > > > +  - clock-ranges
> > > > > > > > > +  - "#address-cells"
> > > > > > > > > +  - "#size-cells"
> > > > > > > > > +
> > > > > > > > > +additionalProperties: false
> > > > > > > > > +
> > > > > > > > > +patternProperties:
> > > > > > > > > +  "^sitf@[0-9]+$":
> > > > > > > > > +    type: object
> > > > > > > > > +    description: Serial interface child node
> > > > > > > > 
> > > > > > > > Why is this a child node at all?
> > > > > > > > Probably not worth reviewing more without a link to the docs for this
> > > > > > > > device so I can figure out what on earth is going on!
> > > > > > > > 
> > > > > > > 
> > > > > > > The MDF is a digital filter for sigma-delta bitstreams, rather than the
> > > > > > > analog-to-digital converter itself.
> > > > > > > 
> > > > > > > Here is the link to STM32MP25 reference manuel
> > > > > > > https://www.st.com/resource/en/reference_manual/rm0457-stm32mp2325xx-advanced-armbased-3264bit-mpus-stmicroelectronics.pdf
> > > > > > > Chapter 45: Multi-function digital filter (MDF)
> > > > > > > 
> > > > > > > On STMP32MP25 SoC, the MDF provides 8 serial interfaces (SITF) and 8 digital
> > > > > > > filters (DFLT) which can be connected through a multiplexer.
> > > > > > > 
> > > > > > > Below is a schematic view of typical applications targeted by this
> > > > > > > peripheral
> > > > > > > 
> > > > > > > 
> > > > > > > Audio use case:
> > > > > > > 
> > > > > > > 		mdf
> > > > > > >                +-------------------------------------+
> > > > > > > +------+    | +------+    +------+    +------+    |
> > > > > > > | dmic | -> | | sitf | -> | mux  | -> | dflt | -- | -> audio device
> > > > > > > +------+    | +------+    +------+    +------+    |
> > > > > > >                +-------------------------------------+
> > > > > > > 
> > > > > > > For instance, in an audio use case the serial interface can be configured to
> > > > > > > provide the clock to the digital microphone (cck0, cck1 or both) at a common
> > > > > > > predefined rate, and to retrieve the PDM samples.
> > > > > > > The serial interface provides this samples to a digital filter, which
> > > > > > > delivers PCM samples on its output.
> > > > > > > 
> > > > > > > 
> > > > > > > Analog use case:
> > > > > > > 
> > > > > > > 		mdf
> > > > > > >                  +-------------------------------------+
> > > > > > > +--------+    | +------+    +------+    +------+    |
> > > > > > > | sd adc | -> | | sitf | -> | mux  | -> | dflt | -- | -> iio device
> > > > > > > +--------+    | +------+    +------+    +------+    |
> > > > > > >                  +-------------------------------------+
> > > > > > 
> > > > > > 
> > > > > > So, looking at the docs and a brief chat with Jonathan about this
> > > > > > device, I believe you've got things backwards and this is actually the backend,
> > > > > > and the adc should be the one populating the io-backends property
> > > > > > pointing to this device. You should have io-backend-cells, and I assume
> > > > > > that there should be a cell for the adc to select which dlft it is connected
> > > > > > to.
> > > > > > 
> > > > > 
> > > > > There have already been lengthy discussions in the past about a DFSDM
> > > > > peripheral on STM32MP1, which has features similar to those of the MDF and
> > > > > similar implementation constraints. For the DFSDM, a solution based on an
> > > > > IIO backend had been upstreamed. The MDF follows the same architecture. I
> > > > > need to take a little time to dive back into this issue.
> > > > 
> > > > One thing to note there is that you retrofitted the backends onto that
> > > > device, and the original design here is much older (it's a text
> > > > binding).
> > > > 
> > > > 
> > > > > 
> > > > > DFSDM sources:
> > > > > drivers/iio/adc/stm32-dfsdm-adc.c
> > > > > drivers/iio/adc/stm32-dfsdm-core.c
> > > > > 
> > > > > Here is a sample of DFSDM DT
> > > > > 
> > > > > sd_adc0: simple-sd-adc0 {
> > > > > 	compatible = "sd-modulator";
> > > > > 	#io-backend-cells = <0>;
> > > > > 	vref-supply = <&v3v3>;
> > > > 
> > > > Yeah, pretty sure this is wrong (backwards). The backend is the thing
> > > > that gets data from an ADC not the ADC.
> > > > 
> > > 
> > > The backend framework was introduced to implement complex IIO aggregate
> > > devices. The hardwares that were driving this need were analog device ad9467
> > > and ST DFSDM.
> > > 
> > > https://lore.kernel.org/linux-iio/20231204144925.4fe9922f@jic23-huawei/T/#m222f5175273b81dbfe40b7f0daffcdc67d6cb8ff
> > > 
> > >  From drivers/iio/industrialio-backend.c:
> > > 
> > > "The typical architecture is to have one device as the frontend device which
> > > can be "linked" against one or multiple backend devices. All the IIO and
> > > userspace interface is expected to be registers/managed by the frontend
> > > device which will callback into the backends when needed (to get/set some
> > > configuration that it does not directly control)."
> > > 
> > >   *                                    ---------------------
> > >   * ------------------                 | ------------
> > >   * |     ADC        |-----------------| | ADC CORE |
> > >   * | (Frontend/IIO) | Serial Data (eg | |(backend) |-------
> > >   * |                |-----------------| ------------
> > >   * ------------------                 ---------------------
> > > 
> > > The MDF (or DFSDM) use case, follows this topology:
> > > - The SD modulator (ADC core) registers in backend framework
> > > - The MDF registers in IIO framework and exposes the IIO devices
> > >    It also get configuration (ref voltage) from SD modulator, to compute
> > > scaling.
> > > 
> > > I agree that if we consider the terms frontend and backend, the elements in
> > > the data flow do not have the roles that we would naturally expect. However,
> > > if we consider the expected role of the elements using the iio-backend
> > > framework, the usage seems coherent to me.
> > 
> > I didn't even get as far as sd modulators or whatever, if I understand
> > correctly the ADC inputs on this device are fed by the onboard ADC?
> > (https://lore.kernel.org/linux-iio/20261006-adc-stm32mp25-v1-v4-0-d31ec75aecf3@foss.st.com/)
> > In that case, I can't really see how it makes sense for the primary iio
> > device to change when data is fed back through the mdf or taken
> > directly from the ADC itself, particularly given how that would affect
> > the userspace interface.
> > 
> > The "serial" side of this seems in a similar vein to the adi,axi-adc
> > stuff, which when considered with the ADC inputs, really does give me
> > the impression this is backwards.
> 
> Some clarifications about the STM32MP25. This SoC does indeed provide ADCs,
> and these can be connected to the MDF via a dedicated interface. (but not
> the serial interface).
> 
> However, this use case is not supported by the driver. Only sigma-delta
> modulators, external to the SoC and connected via the serial interface, are
> supported. On ST boards, the only available SD modulators are digital
> microphones.

Quite frankly, I don't care what you are choosing to implement in the
driver or what your first-party boards support. The binding must
represent the capabilities of the device, not what subset you deem
relevant at this point in time. I'm not going to ack anything that does
not consider all use cases for the device, especially since I the more I
look the more I am convinced that this is the wrong way to model the
relationship between devices and therefore intentionally ignoring a use case
is likely to be problematic when someone does decide that they want to use
that feature.

> Anyway, if the internal ADC to MDF use case was supported, the issue would
> be the same. The whole ADC + MDF set would be presented at the interface as
> an aggregated device, and the ADC data would not be directly accessible to
> the user.

Of course, that's what I was talking about when I said:
| In that case, I can't really see how it makes sense for the primary iio
| device to change when data is fed back through the mdf or taken
| directly from the ADC itself, particularly given how that would affect
| the userspace interface.

To me, in that ADC to MDF use case, the frontend portion of the aggregate
device presented to userspace needs to be the ADC and the MDF needs to be
the backend, since otherwise the ADC will simultaneously be frontend and
backend, depending on which channel is considered. That makes no sense to me
when the MDF can always be the backend, for all use cases and avoid that
sort of problem entirely.
I've heard no argument as to why the MDF cannot be a backend, just that you
don't want to because the previous device didn't, but copying what was
done before isn't a justification that bears weight if how it was done
before isn't the way it should be done.

Thanks,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-10-14 22:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01 14:56 [PATCH 0/3] iio: adc: stm32: add mdf support for stm32mp2 Olivier Moysan
2026-10-01 14:56 ` [PATCH 1/3] dt-bindings: iio: adc: add bindings for stm32 mdf filter Olivier Moysan
2026-10-01 15:06   ` sashiko-bot
2026-10-01 16:25   ` Rob Herring (Arm)
2026-10-01 18:32   ` Conor Dooley
2026-10-07  9:01     ` Olivier MOYSAN
2026-10-07 13:47       ` Rob Herring
2026-10-07 16:02         ` Olivier MOYSAN
2026-10-08 10:11       ` Conor Dooley
2026-10-08 16:37         ` Olivier MOYSAN
2026-10-09 19:12           ` Conor Dooley
2026-10-12 12:56             ` Olivier MOYSAN
2026-10-14 15:15               ` Conor Dooley
2026-10-14 16:51                 ` Olivier MOYSAN
2026-10-14 22:49                   ` Conor Dooley [this message]
2026-10-15  9:19                     ` Olivier MOYSAN
2026-10-15 12:34                       ` Conor Dooley
2026-10-02  9:22   ` Krzysztof Kozlowski
2026-10-06 15:48     ` Olivier MOYSAN
2026-10-06 15:59       ` Krzysztof Kozlowski
2026-10-02  9:34   ` Krzysztof Kozlowski
2026-10-06 16:04     ` Olivier MOYSAN

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=20261014-unmade-sphinx-71cb25110d58@spud \
    --to=conor@kernel.org \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=olivier.moysan@foss.st.com \
    --cc=robh@kernel.org \
    /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