xref: /linux/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml (revision 3d21a46093352f7802b9c66c7cce35cd02a50e53)
111183ac0SOlivier Moysan# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
211183ac0SOlivier Moysan%YAML 1.2
311183ac0SOlivier Moysan---
404dbd865SRob Herring$id: http://devicetree.org/schemas/iio/adc/st,stm32-dfsdm-adc.yaml#
511183ac0SOlivier Moysan$schema: http://devicetree.org/meta-schemas/core.yaml#
611183ac0SOlivier Moysan
711183ac0SOlivier Moysantitle: STMicroelectronics STM32 DFSDM ADC device driver
811183ac0SOlivier Moysan
911183ac0SOlivier Moysanmaintainers:
1011183ac0SOlivier Moysan  - Fabrice Gasnier <fabrice.gasnier@st.com>
1111183ac0SOlivier Moysan  - Olivier Moysan <olivier.moysan@st.com>
1211183ac0SOlivier Moysan
1311183ac0SOlivier Moysandescription: |
1411183ac0SOlivier Moysan  STM32 DFSDM ADC is a sigma delta analog-to-digital converter dedicated to
1511183ac0SOlivier Moysan  interface external sigma delta modulators to STM32 micro controllers.
1611183ac0SOlivier Moysan  It is mainly targeted for:
1711183ac0SOlivier Moysan  - Sigma delta modulators (motor control, metering...)
1811183ac0SOlivier Moysan  - PDM microphones (audio digital microphone)
1911183ac0SOlivier Moysan
2011183ac0SOlivier Moysan  It features up to 8 serial digital interfaces (SPI or Manchester) and
2111183ac0SOlivier Moysan  up to 4 filters on stm32h7 or 6 filters on stm32mp1.
2211183ac0SOlivier Moysan
2311183ac0SOlivier Moysan  Each child node matches with a filter instance.
2411183ac0SOlivier Moysan
2511183ac0SOlivier Moysanproperties:
2611183ac0SOlivier Moysan  compatible:
2711183ac0SOlivier Moysan    enum:
2811183ac0SOlivier Moysan      - st,stm32h7-dfsdm
2911183ac0SOlivier Moysan      - st,stm32mp1-dfsdm
3011183ac0SOlivier Moysan
3111183ac0SOlivier Moysan  reg:
3211183ac0SOlivier Moysan    maxItems: 1
3311183ac0SOlivier Moysan
3411183ac0SOlivier Moysan  clocks:
3511183ac0SOlivier Moysan    items:
3611183ac0SOlivier Moysan      - description:
3711183ac0SOlivier Moysan          Internal clock used for DFSDM digital processing and control blocks.
3811183ac0SOlivier Moysan          dfsdm clock can also feed CLKOUT, when CLKOUT is used.
3911183ac0SOlivier Moysan      - description: audio clock can be used as an alternate to feed CLKOUT.
4011183ac0SOlivier Moysan    minItems: 1
4111183ac0SOlivier Moysan    maxItems: 2
4211183ac0SOlivier Moysan
4311183ac0SOlivier Moysan  clock-names:
4411183ac0SOlivier Moysan    items:
4511183ac0SOlivier Moysan      - const: dfsdm
4611183ac0SOlivier Moysan      - const: audio
4711183ac0SOlivier Moysan    minItems: 1
4811183ac0SOlivier Moysan    maxItems: 2
4911183ac0SOlivier Moysan
5011183ac0SOlivier Moysan  "#address-cells":
5111183ac0SOlivier Moysan    const: 1
5211183ac0SOlivier Moysan
5311183ac0SOlivier Moysan  "#size-cells":
5411183ac0SOlivier Moysan    const: 0
5511183ac0SOlivier Moysan
5611183ac0SOlivier Moysan  spi-max-frequency:
5711183ac0SOlivier Moysan    description:
5811183ac0SOlivier Moysan      SPI clock OUT frequency (Hz). Requested only for SPI master mode.
5911183ac0SOlivier Moysan      This clock must be set according to the "clock" property.
6011183ac0SOlivier Moysan      Frequency must be a multiple of the rcc clock frequency.
6111183ac0SOlivier Moysan      If not, SPI CLKOUT frequency will not be accurate.
6211183ac0SOlivier Moysan    maximum: 20000000
6311183ac0SOlivier Moysan
6411183ac0SOlivier Moysanrequired:
6511183ac0SOlivier Moysan  - compatible
6611183ac0SOlivier Moysan  - reg
6711183ac0SOlivier Moysan  - clocks
6811183ac0SOlivier Moysan  - clock-names
6911183ac0SOlivier Moysan  - "#address-cells"
7011183ac0SOlivier Moysan  - "#size-cells"
7111183ac0SOlivier Moysan
727f464532SRob HerringadditionalProperties: false
737f464532SRob Herring
7411183ac0SOlivier MoysanpatternProperties:
7511183ac0SOlivier Moysan  "^filter@[0-9]+$":
7611183ac0SOlivier Moysan    type: object
7711183ac0SOlivier Moysan    description: child node
7811183ac0SOlivier Moysan
7911183ac0SOlivier Moysan    properties:
8011183ac0SOlivier Moysan      compatible:
8111183ac0SOlivier Moysan        enum:
8211183ac0SOlivier Moysan          - st,stm32-dfsdm-adc
8311183ac0SOlivier Moysan          - st,stm32-dfsdm-dmic
8411183ac0SOlivier Moysan
8511183ac0SOlivier Moysan      reg:
8611183ac0SOlivier Moysan        description: Specifies the DFSDM filter instance used.
8711183ac0SOlivier Moysan        maxItems: 1
8811183ac0SOlivier Moysan
8911183ac0SOlivier Moysan      interrupts:
9011183ac0SOlivier Moysan        maxItems: 1
9111183ac0SOlivier Moysan
9211183ac0SOlivier Moysan      st,adc-channels:
9311183ac0SOlivier Moysan        description: |
9411183ac0SOlivier Moysan          List of single-ended channels muxed for this ADC.
9511183ac0SOlivier Moysan          On stm32h7 and stm32mp1:
9611183ac0SOlivier Moysan          - For st,stm32-dfsdm-adc: up to 8 channels numbered from 0 to 7.
9711183ac0SOlivier Moysan          - For st,stm32-dfsdm-dmic: 1 channel numbered from 0 to 7.
98*3d21a460SRob Herring        $ref: /schemas/types.yaml#/definitions/uint32-array
99*3d21a460SRob Herring        items:
10011183ac0SOlivier Moysan          minimum: 0
10111183ac0SOlivier Moysan          maximum: 7
10211183ac0SOlivier Moysan
10311183ac0SOlivier Moysan      st,adc-channel-names:
10411183ac0SOlivier Moysan        description: List of single-ended channel names.
105*3d21a460SRob Herring        $ref: /schemas/types.yaml#/definitions/string-array
10611183ac0SOlivier Moysan
10711183ac0SOlivier Moysan      st,filter-order:
10811183ac0SOlivier Moysan        description: |
10911183ac0SOlivier Moysan          SinC filter order from 0 to 5.
11011183ac0SOlivier Moysan          - 0: FastSinC
11111183ac0SOlivier Moysan          - [1-5]: order 1 to 5.
11211183ac0SOlivier Moysan          For audio purpose it is recommended to use order 3 to 5.
113*3d21a460SRob Herring        $ref: /schemas/types.yaml#/definitions/uint32
114*3d21a460SRob Herring        items:
11511183ac0SOlivier Moysan          minimum: 0
11611183ac0SOlivier Moysan          maximum: 5
11711183ac0SOlivier Moysan
11811183ac0SOlivier Moysan      "#io-channel-cells":
11911183ac0SOlivier Moysan        const: 1
12011183ac0SOlivier Moysan
12111183ac0SOlivier Moysan      st,adc-channel-types:
12211183ac0SOlivier Moysan        description: |
12311183ac0SOlivier Moysan          Single-ended channel input type.
12411183ac0SOlivier Moysan          - "SPI_R": SPI with data on rising edge (default)
12511183ac0SOlivier Moysan          - "SPI_F": SPI with data on falling edge
12611183ac0SOlivier Moysan          - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1
12711183ac0SOlivier Moysan          - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0
12811183ac0SOlivier Moysan        items:
12911183ac0SOlivier Moysan          enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]
130*3d21a460SRob Herring        $ref: /schemas/types.yaml#/definitions/non-unique-string-array
13111183ac0SOlivier Moysan
13211183ac0SOlivier Moysan      st,adc-channel-clk-src:
13311183ac0SOlivier Moysan        description: |
13411183ac0SOlivier Moysan          Conversion clock source.
13511183ac0SOlivier Moysan          - "CLKIN": external SPI clock (CLKIN x)
13611183ac0SOlivier Moysan          - "CLKOUT": internal SPI clock (CLKOUT) (default)
13711183ac0SOlivier Moysan          - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
13811183ac0SOlivier Moysan          - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
13911183ac0SOlivier Moysan        items:
14011183ac0SOlivier Moysan          enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]
141*3d21a460SRob Herring        $ref: /schemas/types.yaml#/definitions/non-unique-string-array
14211183ac0SOlivier Moysan
14311183ac0SOlivier Moysan      st,adc-alt-channel:
14411183ac0SOlivier Moysan        description:
14511183ac0SOlivier Moysan          Must be defined if two sigma delta modulators are
14611183ac0SOlivier Moysan          connected on same SPI input.
14711183ac0SOlivier Moysan          If not set, channel n is connected to SPI input n.
14811183ac0SOlivier Moysan          If set, channel n is connected to SPI input n + 1.
14911183ac0SOlivier Moysan        type: boolean
15011183ac0SOlivier Moysan
15111183ac0SOlivier Moysan      st,filter0-sync:
15211183ac0SOlivier Moysan        description:
15311183ac0SOlivier Moysan          Set to 1 to synchronize with DFSDM filter instance 0.
15411183ac0SOlivier Moysan          Used for multi microphones synchronization.
15511183ac0SOlivier Moysan        type: boolean
15611183ac0SOlivier Moysan
15711183ac0SOlivier Moysan      dmas:
15811183ac0SOlivier Moysan        maxItems: 1
15911183ac0SOlivier Moysan
16011183ac0SOlivier Moysan      dma-names:
16111183ac0SOlivier Moysan        items:
16211183ac0SOlivier Moysan          - const: rx
16311183ac0SOlivier Moysan
16411183ac0SOlivier Moysan    required:
16511183ac0SOlivier Moysan      - compatible
16611183ac0SOlivier Moysan      - reg
16711183ac0SOlivier Moysan      - interrupts
16811183ac0SOlivier Moysan      - st,adc-channels
16911183ac0SOlivier Moysan      - st,adc-channel-names
17011183ac0SOlivier Moysan      - st,filter-order
17111183ac0SOlivier Moysan      - "#io-channel-cells"
17211183ac0SOlivier Moysan
17311183ac0SOlivier Moysan    allOf:
17411183ac0SOlivier Moysan      - if:
17511183ac0SOlivier Moysan          properties:
17611183ac0SOlivier Moysan            compatible:
17711183ac0SOlivier Moysan              contains:
17811183ac0SOlivier Moysan                const: st,stm32-dfsdm-adc
17911183ac0SOlivier Moysan
18011183ac0SOlivier Moysan      - then:
18111183ac0SOlivier Moysan          properties:
18211183ac0SOlivier Moysan            st,adc-channels:
18311183ac0SOlivier Moysan              minItems: 1
18411183ac0SOlivier Moysan              maxItems: 8
18511183ac0SOlivier Moysan
18611183ac0SOlivier Moysan            st,adc-channel-names:
18711183ac0SOlivier Moysan              minItems: 1
18811183ac0SOlivier Moysan              maxItems: 8
18911183ac0SOlivier Moysan
19011183ac0SOlivier Moysan            st,adc-channel-types:
19111183ac0SOlivier Moysan              minItems: 1
19211183ac0SOlivier Moysan              maxItems: 8
19311183ac0SOlivier Moysan
19411183ac0SOlivier Moysan            st,adc-channel-clk-src:
19511183ac0SOlivier Moysan              minItems: 1
19611183ac0SOlivier Moysan              maxItems: 8
19711183ac0SOlivier Moysan
19811183ac0SOlivier Moysan            io-channels:
19911183ac0SOlivier Moysan              description:
20011183ac0SOlivier Moysan                From common IIO binding. Used to pipe external sigma delta
20111183ac0SOlivier Moysan                modulator or internal ADC output to DFSDM channel.
20211183ac0SOlivier Moysan                This is not required for "st,stm32-dfsdm-pdm" compatibility as
20311183ac0SOlivier Moysan                PDM microphone is binded in Audio DT node.
20411183ac0SOlivier Moysan
20511183ac0SOlivier Moysan          required:
20611183ac0SOlivier Moysan            - io-channels
20711183ac0SOlivier Moysan
20811183ac0SOlivier Moysan      - if:
20911183ac0SOlivier Moysan          properties:
21011183ac0SOlivier Moysan            compatible:
21111183ac0SOlivier Moysan              contains:
21211183ac0SOlivier Moysan                const: st,stm32-dfsdm-dmic
21311183ac0SOlivier Moysan
21411183ac0SOlivier Moysan      - then:
21511183ac0SOlivier Moysan          properties:
21611183ac0SOlivier Moysan            st,adc-channels:
21711183ac0SOlivier Moysan              maxItems: 1
21811183ac0SOlivier Moysan
21911183ac0SOlivier Moysan            st,adc-channel-names:
22011183ac0SOlivier Moysan              maxItems: 1
22111183ac0SOlivier Moysan
22211183ac0SOlivier Moysan            st,adc-channel-types:
22311183ac0SOlivier Moysan              maxItems: 1
22411183ac0SOlivier Moysan
22511183ac0SOlivier Moysan            st,adc-channel-clk-src:
22611183ac0SOlivier Moysan              maxItems: 1
22711183ac0SOlivier Moysan
22811183ac0SOlivier Moysan          required:
22911183ac0SOlivier Moysan            - dmas
23011183ac0SOlivier Moysan            - dma-names
23111183ac0SOlivier Moysan
23211183ac0SOlivier Moysan          patternProperties:
23311183ac0SOlivier Moysan            "^dfsdm-dai+$":
23411183ac0SOlivier Moysan              type: object
23511183ac0SOlivier Moysan              description: child node
23611183ac0SOlivier Moysan
23711183ac0SOlivier Moysan              properties:
23811183ac0SOlivier Moysan                "#sound-dai-cells":
23911183ac0SOlivier Moysan                  const: 0
24011183ac0SOlivier Moysan
24111183ac0SOlivier Moysan                io-channels:
24211183ac0SOlivier Moysan                  description:
24311183ac0SOlivier Moysan                    From common IIO binding. Used to pipe external sigma delta
24411183ac0SOlivier Moysan                    modulator or internal ADC output to DFSDM channel.
24511183ac0SOlivier Moysan
24611183ac0SOlivier Moysan              required:
24711183ac0SOlivier Moysan                - "#sound-dai-cells"
24811183ac0SOlivier Moysan                - io-channels
24911183ac0SOlivier Moysan
25011183ac0SOlivier MoysanallOf:
25111183ac0SOlivier Moysan  - if:
25211183ac0SOlivier Moysan      properties:
25311183ac0SOlivier Moysan        compatible:
25411183ac0SOlivier Moysan          contains:
25511183ac0SOlivier Moysan            const: st,stm32h7-dfsdm
25611183ac0SOlivier Moysan
25711183ac0SOlivier Moysan  - then:
25811183ac0SOlivier Moysan      patternProperties:
25911183ac0SOlivier Moysan        "^filter@[0-9]+$":
26011183ac0SOlivier Moysan          properties:
26111183ac0SOlivier Moysan            reg:
26211183ac0SOlivier Moysan              items:
26311183ac0SOlivier Moysan                minimum: 0
26411183ac0SOlivier Moysan                maximum: 3
26511183ac0SOlivier Moysan
26611183ac0SOlivier Moysan  - if:
26711183ac0SOlivier Moysan      properties:
26811183ac0SOlivier Moysan        compatible:
26911183ac0SOlivier Moysan          contains:
27011183ac0SOlivier Moysan            const: st,stm32mp1-dfsdm
27111183ac0SOlivier Moysan
27211183ac0SOlivier Moysan  - then:
27311183ac0SOlivier Moysan      patternProperties:
27411183ac0SOlivier Moysan        "^filter@[0-9]+$":
27511183ac0SOlivier Moysan          properties:
27611183ac0SOlivier Moysan            reg:
27711183ac0SOlivier Moysan              items:
27811183ac0SOlivier Moysan                minimum: 0
27911183ac0SOlivier Moysan                maximum: 5
28011183ac0SOlivier Moysan
28111183ac0SOlivier Moysanexamples:
28211183ac0SOlivier Moysan  - |
28311183ac0SOlivier Moysan    #include <dt-bindings/interrupt-controller/arm-gic.h>
28411183ac0SOlivier Moysan    #include <dt-bindings/clock/stm32mp1-clks.h>
28511183ac0SOlivier Moysan    dfsdm: dfsdm@4400d000 {
28611183ac0SOlivier Moysan      compatible = "st,stm32mp1-dfsdm";
28711183ac0SOlivier Moysan      reg = <0x4400d000 0x800>;
28811183ac0SOlivier Moysan      clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>;
28911183ac0SOlivier Moysan      clock-names = "dfsdm", "audio";
29011183ac0SOlivier Moysan      #address-cells = <1>;
29111183ac0SOlivier Moysan      #size-cells = <0>;
29211183ac0SOlivier Moysan
29311183ac0SOlivier Moysan      dfsdm0: filter@0 {
29411183ac0SOlivier Moysan        compatible = "st,stm32-dfsdm-dmic";
29511183ac0SOlivier Moysan        reg = <0>;
29611183ac0SOlivier Moysan        interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
29711183ac0SOlivier Moysan        dmas = <&dmamux1 101 0x400 0x01>;
29811183ac0SOlivier Moysan        dma-names = "rx";
29911183ac0SOlivier Moysan        #io-channel-cells = <1>;
30011183ac0SOlivier Moysan        st,adc-channels = <1>;
30111183ac0SOlivier Moysan        st,adc-channel-names = "dmic0";
30211183ac0SOlivier Moysan        st,adc-channel-types = "SPI_R";
30311183ac0SOlivier Moysan        st,adc-channel-clk-src = "CLKOUT";
30411183ac0SOlivier Moysan        st,filter-order = <5>;
30511183ac0SOlivier Moysan
30611183ac0SOlivier Moysan        asoc_pdm0: dfsdm-dai {
30711183ac0SOlivier Moysan          compatible = "st,stm32h7-dfsdm-dai";
30811183ac0SOlivier Moysan          #sound-dai-cells = <0>;
30911183ac0SOlivier Moysan          io-channels = <&dfsdm0 0>;
31011183ac0SOlivier Moysan        };
31111183ac0SOlivier Moysan      };
31211183ac0SOlivier Moysan
31311183ac0SOlivier Moysan      dfsdm_pdm1: filter@1 {
31411183ac0SOlivier Moysan        compatible = "st,stm32-dfsdm-adc";
31511183ac0SOlivier Moysan        reg = <1>;
31611183ac0SOlivier Moysan        interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
31711183ac0SOlivier Moysan        dmas = <&dmamux1 102 0x400 0x01>;
31811183ac0SOlivier Moysan        dma-names = "rx";
31911183ac0SOlivier Moysan        #io-channel-cells = <1>;
32011183ac0SOlivier Moysan        st,adc-channels = <2 3>;
32111183ac0SOlivier Moysan        st,adc-channel-names = "in2", "in3";
32211183ac0SOlivier Moysan        st,adc-channel-types = "SPI_R", "SPI_R";
32311183ac0SOlivier Moysan        st,adc-channel-clk-src = "CLKOUT_F", "CLKOUT_F";
32411183ac0SOlivier Moysan        io-channels = <&sd_adc2 &sd_adc3>;
32511183ac0SOlivier Moysan        st,filter-order = <1>;
32611183ac0SOlivier Moysan      };
32711183ac0SOlivier Moysan    };
32811183ac0SOlivier Moysan
32911183ac0SOlivier Moysan...
330