mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Olivier MOYSAN <olivier.moysan@foss.st.com>
To: Conor Dooley <conor@kernel.org>
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>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Philipp Stanner" <phasta@kernel.org>,
	"Arnaud Pouliquen" <arnaud.pouliquen@foss.st.com>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Fabrice Gasnier" <fabrice.gasnier@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, linux-media@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
	linux-sound@vger.kernel.org
Subject: Re: [PATCH v2 01/11] dt-bindings: iio: adc: add stm32mp2 mdf filter
Date: Wed, 25 Nov 2026 16:58:22 +0100	[thread overview]
Message-ID: <a11d734e-3c08-405b-86ac-96cc10bd6a34@foss.st.com> (raw)
In-Reply-To: <20261123-barbecue-trickily-4ae8d9f01b3d@spud>

Hi Conor,

On 11/23/26 18:30, Conor Dooley wrote:
> With an eye to accepting something of this nature, rather than a rework,
> I have some initial questions before suggesting some remodeling of what
> is here.
> 
> On Wed, Nov 18, 2026 at 04:17:46PM +0100, Olivier Moysan wrote:
>> Add bindings that describes STM32 MDF settings to support
>> digital filtering for Pulse Density Modulation (PDM) microphones
>> and analog sigma delta modulators, on STM32MP2 SoCs.
>>
>> Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
>> ---
>>   .../bindings/iio/adc/st,stm32mp25-mdf.yaml         | 341 +++++++++++++++++++++
>>   1 file changed, 341 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/iio/adc/st,stm32mp25-mdf.yaml b/Documentation/devicetree/bindings/iio/adc/st,stm32mp25-mdf.yaml
>> new file mode 100644
>> index 000000000000..e4925a38012d
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/iio/adc/st,stm32mp25-mdf.yaml
>> @@ -0,0 +1,341 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/iio/adc/st,stm32mp25-mdf.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: STMicroelectronics STM32 Multi-function Digital Filter (MDF) ADC
>> +
>> +maintainers:
>> +  - Olivier Moysan <olivier.moysan@foss.st.com>
>> +
>> +description: |
>> +  STM32 MDF ADC is a sigma delta analog-to-digital converter dedicated to
>> +  interface external sigma delta modulators to STM32 micro controllers.
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - st,stm32mp23-mdf
>> +      - st,stm32mp25-mdf
>> +
>> +  reg:
>> +    minItems: 1
>> +    maxItems: 2
>> +
>> +  clocks:
>> +    maxItems: 1
>> +
>> +  "#clock-cells":
>> +    enum: [0, 1]
>> +
>> +  clock-output-names:
>> +    description: |
>> +      CCK0 and CCK1 are optional output clocks, which share the same clock frequency,
>> +      but can be gated independently to save power.
>> +    minItems: 1
>> +    items:
>> +      - enum: [cck0, cck1]
>> +      - const: cck1
>> +
>> +  "#address-cells":
>> +    const: 1
>> +
>> +  "#size-cells":
>> +    const: 1
>> +
>> +  ranges: true
>> +
>> +  resets:
>> +    maxItems: 1
>> +
>> +  access-controllers:
>> +    maxItems: 1
>> +
>> +  power-domains:
>> +    maxItems: 1
>> +
>> +  st,interleave:
>> +    description: |
>> +      Number of interleaved filters, starting from filter 0. For a value N,
>> +      filters 0 through N - 1 participate in interleaving. Their samples are
>> +      multiplexed into a single channel and retrieved through the device
>> +      associated with filter 0. Filters 1 through N - 1 must be enabled and
>> +      inherit their configuration from filter 0. If absent, interleaving is
>> +      disabled.
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +    minimum: 2
>> +    maximum: 8
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - ranges
>> +  - clocks
>> +  - "#address-cells"
>> +  - "#size-cells"
>> +
>> +additionalProperties: false
>> +
>> +patternProperties:
>> +  "^sitf@[0-9]+$":
>> +    type: object
>> +    description: |
>> +      Serial interface configuration, managed by the MDF core. Pin control
>> +      states for the serial interface pins belong to the MDF parent node.
>> +
>> +    properties:
>> +      reg:
>> +        description: Specify the SITF serial interface instance
>> +        maxItems: 1
>> +
>> +      clocks:
>> +        description: |
>> +          Serial interface clock (optional depending on interface mode)
>> +        maxItems: 1
>> +
>> +      st,sitf-mode:
>> +        description: |
>> +          Select serial interface protocol
>> +          - spi: SPI mode
>> +          - lf_spi: low frequency SPI mode for low power applications
>> +        $ref: /schemas/types.yaml#/definitions/string
>> +        enum:
>> +          - spi
>> +          - lf_spi
>> +
>> +    required:
>> +      - reg
>> +      - st,sitf-mode
>> +
>> +    additionalProperties: false
>> +
>> +  "^filter@[0-9]+$":
>> +    type: object
>> +    description: Digital filter path child node
>> +
>> +    properties:
>> +      compatible:
>> +        enum:
>> +          - st,stm32mp25-mdf-dmic
>> +          - st,stm32mp25-mdf-adc
> 
> These two compatibles don't represent different hardware, just different
> roles from the same hardware, right?
> 

Yes, both compatibles refer to the same MDF filter hardware. They 
distinguish two uses of that filter: IIO data acquisition and digital 
microphone audio capture through ASoC framework.

>> +
>> +      reg:
>> +        description: Specify the MDF filter instance
>> +        maxItems: 1
>> +
>> +      interrupts:
>> +        maxItems: 1
>> +
>> +      dmas:
>> +        maxItems: 1
>> +
>> +      dma-names:
>> +        items:
>> +          - const: rx
>> +
>> +      "#io-channel-cells":
>> +        const: 1
>> +
>> +      '#address-cells':
>> +        const: 1
>> +
>> +      '#size-cells':
>> +        const: 0
>> +
>> +      st,cic-mode:
>> +        description: |
>> +          Cascaded-integrator-comb (CIC) filter configuration
>> +          - 0: MCIC & ACIC filters in FastSinc mode
>> +          - [1-3]: MCIC & ACIC filters in Sinc mode order 1 to 3
>> +          - [4-5]: Single CIC filter in Sinc mode order 4 to 5
>> +          For audio purpose it is recommended to use CIC Sinc4 or Sinc5
>> +          This property is mandatory for filter 0 or filters not used in interleave mode.
>> +        $ref: /schemas/types.yaml#/definitions/uint32
>> +        minimum: 0
>> +        maximum: 5
>> +
>> +      st,delay:
>> +        description: Filter delay in samples
>> +        $ref: /schemas/types.yaml#/definitions/uint32
>> +        maximum: 127
>> +
>> +      st,rs-filter-bypass:
>> +        description: Bypass RSFLT reshaping filter.
>> +        $ref: /schemas/types.yaml#/definitions/flag
>> +
>> +      st,hpf-filter-cutoff-bp:
>> +        description: |
>> +          High Pass Filter (HPF) cut-off frequency expressed as a fraction of the PCM sampling rate.
>> +          Cut-off frequency = st,hpf-filter-cutoff-bp x Fpcm / 10000.
>> +          If this property is not defined the HPF is disabled.
>> +        enum: [625, 1250, 2500, 9500]
>> +
>> +      st,sync:
>> +        description:
>> +          Synchronize to another filter.
>> +          Must contain the phandle of the filter providing the synchronization.
>> +        allOf:
>> +          - $ref: /schemas/types.yaml#/definitions/phandle-array
>> +          - maxItems: 1
>> +
> 
>> +      st,sitf:
>> +        $ref: /schemas/types.yaml#/definitions/phandle-array
>> +        items:
>> +          - items:
>> +              - description: Phandle of the serial interface connected to the digital filter
>> +              - description: |
>> +                  The phandle's argument selects the bitstream on the falling or rising edge
>> +                  of the serial interface clock:
>> +                  - 0: rising edge
>> +                  - 1: falling edge
>> +                enum: [0, 1]
>> +                default: 0
>> +        description:
>> +          Should be phandle/bitstream pair.
> 
> Can this ever be more than a single phandle?
>

Each MDF filter selects a single bitstream from one serial interface. 
The property contains only one phandle plus one argument that selects 
the rising or falling clock edge.

>> +
>> +      mdf-dai:
>> +        type: object
>> +        description: Audio interface for the MDF filter
>> +
>> +        properties:
>> +          compatible:
>> +            const: st,stm32mp25-mdf-dai
>> +
>> +          "#sound-dai-cells":
>> +            const: 0
>> +
>> +          io-channels:
>> +            description:
>> +              From common IIO binding. Used to pipe external sigma delta
>> +              modulator or internal ADC output to MDF channel.
>> +
>> +          power-domains:
>> +            maxItems: 1
>> +
>> +          port:
>> +            $ref: /schemas/sound/audio-graph-port.yaml#
>> +            unevaluatedProperties: false
>> +
>> +        required:
>> +          - compatible
>> +          - "#sound-dai-cells"
>> +          - io-channels
>> +
>> +        additionalProperties: false
>> +
>> +    required:
>> +      - compatible
>> +      - reg
>> +      - interrupts
>> +      - dmas
>> +      - dma-names
>> +      - "#io-channel-cells"
>> +      - "#address-cells"
>> +      - "#size-cells"
>> +      - st,sitf
>> +
>> +    patternProperties:
>> +      "^channel@([0-7])$":
>> +        type: object
>> +        $ref: adc.yaml
>> +        description: Represents the external channel which is connected to the MDF.
>> +
>> +        properties:
>> +          reg:
>> +            maximum: 7
>> +
>> +          io-backends:
>> +            description:
>> +              Used to pipe external sigma delta modulator or internal ADC backend to MDF
>> +              channel.
>> +            maxItems: 1
>> +
>> +        required:
>> +          - reg
>> +
>> +        unevaluatedProperties: false
>> +
>> +    allOf:
>> +      - if:
>> +          properties:
>> +            compatible:
>> +              contains:
>> +                const: st,stm32mp25-mdf-adc
>> +
>> +        then:
>> +          patternProperties:
>> +            "^channel@[0-7]$":
>> +              required:
>> +                - io-backends
>> +          properties:
>> +            mdf-dai: false
>> +
>> +    unevaluatedProperties: false
>> +
>> +examples:
>> +  - |
>> +    #include <dt-bindings/clock/st,stm32mp25-rcc.h>
>> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
>> +    mdf1: filter@504d0000 {
>> +      compatible = "st,stm32mp25-mdf";
>> +      ranges = <0 0x504d0000 0x1000>;
>> +      reg = <0x504d0000 0x8>, <0x504d0ff0 0x10>;
>> +      #address-cells = <1>;
>> +      #size-cells = <1>;
>> +      clocks = <&rcc CK_KER_MDF1>;
>> +      #clock-cells = <1>;
>> +      clock-output-names = "cck0", "cck1";
>> +
>> +      sitf5: sitf@300 {
>> +        reg = <0x300 0x4>;
>> +        st,sitf-mode = "spi";
>> +        clocks = <&mdf1 0>;
>> +        assigned-clocks = <&mdf1 0>;
>> +        assigned-clock-rates = <2048000>;
>> +      };
>> +
>> +      filter0: filter@84 {
>> +        compatible = "st,stm32mp25-mdf-dmic";
>> +        reg = <0x84 0x70>;
>> +        #io-channel-cells = <1>;
>> +        interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;
>> +        dmas = <&hpdma 63 0x63 0x12 0>;
>> +        dma-names = "rx";
>> +        st,cic-mode = <5>;
>> +        st,sitf = <&sitf5 0>;
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +
>> +        channel@0 {
>> +          reg = <0>;
>> +        };
>> +
>> +        mdf-dai {
>> +          compatible = "st,stm32mp25-mdf-dai";
>> +          #sound-dai-cells = <0>;
>> +          io-channels = <&filter0 0>;
>> +        };
>> +      };
>> +
>> +      filter@104 {
>> +        compatible = "st,stm32mp25-mdf-adc";
>> +        reg = <0x104 0x70>;
>> +        #io-channel-cells = <1>;
>> +        interrupts = <GIC_SPI 185 IRQ_TYPE_LEVEL_HIGH>;
>> +        dmas = <&hpdma 64 0x63 0x12 0>;
>> +        dma-names = "rx";
>> +        st,cic-mode = <2>;
>> +        st,sitf = <&sitf5 1>;
> 
> Is this a realistic example, with multiple devices connected to the same
> sitf? I assume it is technically possible, given what I have seen in the
> docs but would anyone do this in reality?
> 

Yes, sharing the same SITF clock and data line for stereo audio capture 
is a realistic use case. The microphones drive the data line on opposite 
clock edges, so two MDF filters can capture the two channels 
independently. This use case is documented here:
https://wiki.st.com/stm32mpu/wiki/MDF_device_tree_configuration#MDF_audio_example

What is probably not realistic in the example, is to mix audio and 
analog use cases (through st,stm32mp25-mdf-dmic and 
st,stm32mp25-mdf-adc). This was done to shorten the example. Maybe it 
would be worth splitting the audio and analog use cases.

Regards
Olivier

> Cheers,
> Conor.
> 
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +
>> +        channel@1 {
>> +          reg = <1>;
>> +          settling-time-us = <1000>;
>> +          io-backends = <&sd_adc1>;
>> +        };
>> +      };
>> +    };
>> +
>> +...
>>
>> -- 
>> 2.43.0
>>


  reply	other threads:[~2026-11-25 15:58 UTC|newest]

Thread overview: 19+ 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-23 17:30   ` Conor Dooley
2026-11-25 15:58     ` Olivier MOYSAN [this message]
2026-11-18 15:17 ` [PATCH v2 02/11] iio: adc: stm32-mdf: add core registration Olivier Moysan
2026-11-19  9:44   ` Andy Shevchenko
2026-11-20 21:17   ` kernel test robot
2026-11-18 15:17 ` [PATCH v2 03/11] iio: adc: stm32-mdf: add cck clocks provider Olivier Moysan
2026-11-18 15:17 ` [PATCH v2 04/11] iio: adc: stm32-mdf: add serial interfaces support Olivier Moysan
2026-11-18 15:17 ` [PATCH v2 05/11] iio: adc: stm32-mdf: add digital filter device support Olivier Moysan
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:17 ` [PATCH v2 07/11] iio: adc: stm32-mdf: add direct iio conversion support Olivier Moysan
2026-11-18 15:17 ` [PATCH v2 08/11] iio: adc: stm32-mdf: add dma buffered acquisition support Olivier Moysan
2026-11-21  1:51   ` kernel test robot
2026-11-18 15:17 ` [PATCH v2 09/11] iio: adc: stm32-mdf: add external timer trigger support Olivier Moysan
2026-11-18 15:17 ` [PATCH v2 10/11] iio: adc: stm32-mdf: add dmic audio filter support Olivier Moysan
2026-11-18 15:17 ` [PATCH v2 11/11] ASoC: stm32: add mdf dai support Olivier Moysan
2026-11-19 18:37 ` [PATCH v2 00/11] iio: adc: stm32: add mdf support for stm32mp2 Conor Dooley
2026-11-23 17:11   ` 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=a11d734e-3c08-405b-86ac-96cc10bd6a34@foss.st.com \
    --to=olivier.moysan@foss.st.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andy@kernel.org \
    --cc=arnaud.pouliquen@foss.st.com \
    --cc=broonie@kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=conor+dt@kernel.org \
    --cc=conor@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fabrice.gasnier@foss.st.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=p.zabel@pengutronix.de \
    --cc=perex@perex.cz \
    --cc=phasta@kernel.org \
    --cc=robh@kernel.org \
    --cc=sumit.semwal@linaro.org \
    --cc=tiwai@suse.com \
    /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

all inboxes | Powered by JetHome®