xref: /linux/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml (revision 02ec75edaa94a28b4e89ca6594ae988918be3dc5)
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:
10f4eedebdSPatrice Chotard  - Fabrice Gasnier <fabrice.gasnier@foss.st.com>
11f4eedebdSPatrice Chotard  - Olivier Moysan <olivier.moysan@foss.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
4211183ac0SOlivier Moysan  clock-names:
4311183ac0SOlivier Moysan    items:
4411183ac0SOlivier Moysan      - const: dfsdm
4511183ac0SOlivier Moysan      - const: audio
4611183ac0SOlivier Moysan    minItems: 1
4711183ac0SOlivier Moysan
4811183ac0SOlivier Moysan  "#address-cells":
4911183ac0SOlivier Moysan    const: 1
5011183ac0SOlivier Moysan
5111183ac0SOlivier Moysan  "#size-cells":
5211183ac0SOlivier Moysan    const: 0
5311183ac0SOlivier Moysan
5411183ac0SOlivier Moysan  spi-max-frequency:
5511183ac0SOlivier Moysan    description:
5611183ac0SOlivier Moysan      SPI clock OUT frequency (Hz). Requested only for SPI master mode.
5711183ac0SOlivier Moysan      This clock must be set according to the "clock" property.
5811183ac0SOlivier Moysan      Frequency must be a multiple of the rcc clock frequency.
5911183ac0SOlivier Moysan      If not, SPI CLKOUT frequency will not be accurate.
6011183ac0SOlivier Moysan    maximum: 20000000
6111183ac0SOlivier Moysan
62*02ec75edSGatien Chevallier  access-controllers:
63*02ec75edSGatien Chevallier    minItems: 1
64*02ec75edSGatien Chevallier    maxItems: 2
65*02ec75edSGatien Chevallier
6611183ac0SOlivier Moysanrequired:
6711183ac0SOlivier Moysan  - compatible
6811183ac0SOlivier Moysan  - reg
6911183ac0SOlivier Moysan  - clocks
7011183ac0SOlivier Moysan  - clock-names
7111183ac0SOlivier Moysan  - "#address-cells"
7211183ac0SOlivier Moysan  - "#size-cells"
7311183ac0SOlivier Moysan
747f464532SRob HerringadditionalProperties: false
757f464532SRob Herring
7611183ac0SOlivier MoysanpatternProperties:
7711183ac0SOlivier Moysan  "^filter@[0-9]+$":
7811183ac0SOlivier Moysan    type: object
79c682c963SRob Herring    unevaluatedProperties: false
8011183ac0SOlivier Moysan    description: child node
8111183ac0SOlivier Moysan
8211183ac0SOlivier Moysan    properties:
8311183ac0SOlivier Moysan      compatible:
8411183ac0SOlivier Moysan        enum:
8511183ac0SOlivier Moysan          - st,stm32-dfsdm-adc
8611183ac0SOlivier Moysan          - st,stm32-dfsdm-dmic
8711183ac0SOlivier Moysan
8811183ac0SOlivier Moysan      reg:
8911183ac0SOlivier Moysan        description: Specifies the DFSDM filter instance used.
9011183ac0SOlivier Moysan        maxItems: 1
9111183ac0SOlivier Moysan
9211183ac0SOlivier Moysan      interrupts:
9311183ac0SOlivier Moysan        maxItems: 1
9411183ac0SOlivier Moysan
9511183ac0SOlivier Moysan      st,adc-channels:
9611183ac0SOlivier Moysan        description: |
9711183ac0SOlivier Moysan          List of single-ended channels muxed for this ADC.
9811183ac0SOlivier Moysan          On stm32h7 and stm32mp1:
9911183ac0SOlivier Moysan          - For st,stm32-dfsdm-adc: up to 8 channels numbered from 0 to 7.
10011183ac0SOlivier Moysan          - For st,stm32-dfsdm-dmic: 1 channel numbered from 0 to 7.
1013d21a460SRob Herring        $ref: /schemas/types.yaml#/definitions/uint32-array
1023d21a460SRob Herring        items:
10311183ac0SOlivier Moysan          minimum: 0
10411183ac0SOlivier Moysan          maximum: 7
10511183ac0SOlivier Moysan
10611183ac0SOlivier Moysan      st,adc-channel-names:
10711183ac0SOlivier Moysan        description: List of single-ended channel names.
10811183ac0SOlivier Moysan
10911183ac0SOlivier Moysan      st,filter-order:
11011183ac0SOlivier Moysan        description: |
11111183ac0SOlivier Moysan          SinC filter order from 0 to 5.
11211183ac0SOlivier Moysan          - 0: FastSinC
11311183ac0SOlivier Moysan          - [1-5]: order 1 to 5.
11411183ac0SOlivier Moysan          For audio purpose it is recommended to use order 3 to 5.
1153d21a460SRob Herring        $ref: /schemas/types.yaml#/definitions/uint32
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 ]
1303d21a460SRob 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 ]
1413d21a460SRob 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
18027e4a85cSRob Herring        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
20311183ac0SOlivier Moysan          required:
20411183ac0SOlivier Moysan            - io-channels
20511183ac0SOlivier Moysan
20611183ac0SOlivier Moysan      - if:
20711183ac0SOlivier Moysan          properties:
20811183ac0SOlivier Moysan            compatible:
20911183ac0SOlivier Moysan              contains:
21011183ac0SOlivier Moysan                const: st,stm32-dfsdm-dmic
21111183ac0SOlivier Moysan
21227e4a85cSRob Herring        then:
21311183ac0SOlivier Moysan          properties:
21411183ac0SOlivier Moysan            st,adc-channels:
21511183ac0SOlivier Moysan              maxItems: 1
21611183ac0SOlivier Moysan
21711183ac0SOlivier Moysan            st,adc-channel-names:
21811183ac0SOlivier Moysan              maxItems: 1
21911183ac0SOlivier Moysan
22011183ac0SOlivier Moysan            st,adc-channel-types:
22111183ac0SOlivier Moysan              maxItems: 1
22211183ac0SOlivier Moysan
22311183ac0SOlivier Moysan            st,adc-channel-clk-src:
22411183ac0SOlivier Moysan              maxItems: 1
22511183ac0SOlivier Moysan
22611183ac0SOlivier Moysan          required:
22711183ac0SOlivier Moysan            - dmas
22811183ac0SOlivier Moysan            - dma-names
22911183ac0SOlivier Moysan
23011183ac0SOlivier Moysan          patternProperties:
23111183ac0SOlivier Moysan            "^dfsdm-dai+$":
23211183ac0SOlivier Moysan              type: object
233c682c963SRob Herring              additionalProperties: false
23411183ac0SOlivier Moysan              description: child node
23511183ac0SOlivier Moysan
23611183ac0SOlivier Moysan              properties:
237f24fd10bSOlivier Moysan                compatible:
238f24fd10bSOlivier Moysan                  enum:
239f24fd10bSOlivier Moysan                    - st,stm32h7-dfsdm-dai
240f24fd10bSOlivier Moysan
24111183ac0SOlivier Moysan                "#sound-dai-cells":
24211183ac0SOlivier Moysan                  const: 0
24311183ac0SOlivier Moysan
24411183ac0SOlivier Moysan                io-channels:
24511183ac0SOlivier Moysan                  description:
24611183ac0SOlivier Moysan                    From common IIO binding. Used to pipe external sigma delta
24711183ac0SOlivier Moysan                    modulator or internal ADC output to DFSDM channel.
24811183ac0SOlivier Moysan
24911183ac0SOlivier Moysan              required:
250f24fd10bSOlivier Moysan                - compatible
25111183ac0SOlivier Moysan                - "#sound-dai-cells"
25211183ac0SOlivier Moysan                - io-channels
25311183ac0SOlivier Moysan
25411183ac0SOlivier MoysanallOf:
25511183ac0SOlivier Moysan  - if:
25611183ac0SOlivier Moysan      properties:
25711183ac0SOlivier Moysan        compatible:
25811183ac0SOlivier Moysan          contains:
25911183ac0SOlivier Moysan            const: st,stm32h7-dfsdm
26011183ac0SOlivier Moysan
26127e4a85cSRob Herring    then:
26211183ac0SOlivier Moysan      patternProperties:
26311183ac0SOlivier Moysan        "^filter@[0-9]+$":
26411183ac0SOlivier Moysan          properties:
26511183ac0SOlivier Moysan            reg:
26611183ac0SOlivier Moysan              items:
26711183ac0SOlivier Moysan                minimum: 0
26811183ac0SOlivier Moysan                maximum: 3
26911183ac0SOlivier Moysan
27011183ac0SOlivier Moysan  - if:
27111183ac0SOlivier Moysan      properties:
27211183ac0SOlivier Moysan        compatible:
27311183ac0SOlivier Moysan          contains:
27411183ac0SOlivier Moysan            const: st,stm32mp1-dfsdm
27511183ac0SOlivier Moysan
27627e4a85cSRob Herring    then:
27711183ac0SOlivier Moysan      patternProperties:
27811183ac0SOlivier Moysan        "^filter@[0-9]+$":
27911183ac0SOlivier Moysan          properties:
28011183ac0SOlivier Moysan            reg:
28111183ac0SOlivier Moysan              items:
28211183ac0SOlivier Moysan                minimum: 0
28311183ac0SOlivier Moysan                maximum: 5
28411183ac0SOlivier Moysan
28511183ac0SOlivier Moysanexamples:
28611183ac0SOlivier Moysan  - |
28711183ac0SOlivier Moysan    #include <dt-bindings/interrupt-controller/arm-gic.h>
28811183ac0SOlivier Moysan    #include <dt-bindings/clock/stm32mp1-clks.h>
28911183ac0SOlivier Moysan    dfsdm: dfsdm@4400d000 {
29011183ac0SOlivier Moysan      compatible = "st,stm32mp1-dfsdm";
29111183ac0SOlivier Moysan      reg = <0x4400d000 0x800>;
29211183ac0SOlivier Moysan      clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>;
29311183ac0SOlivier Moysan      clock-names = "dfsdm", "audio";
29411183ac0SOlivier Moysan      #address-cells = <1>;
29511183ac0SOlivier Moysan      #size-cells = <0>;
29611183ac0SOlivier Moysan
29711183ac0SOlivier Moysan      dfsdm0: filter@0 {
29811183ac0SOlivier Moysan        compatible = "st,stm32-dfsdm-dmic";
29911183ac0SOlivier Moysan        reg = <0>;
30011183ac0SOlivier Moysan        interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
30111183ac0SOlivier Moysan        dmas = <&dmamux1 101 0x400 0x01>;
30211183ac0SOlivier Moysan        dma-names = "rx";
30311183ac0SOlivier Moysan        #io-channel-cells = <1>;
30411183ac0SOlivier Moysan        st,adc-channels = <1>;
30511183ac0SOlivier Moysan        st,adc-channel-names = "dmic0";
30611183ac0SOlivier Moysan        st,adc-channel-types = "SPI_R";
30711183ac0SOlivier Moysan        st,adc-channel-clk-src = "CLKOUT";
30811183ac0SOlivier Moysan        st,filter-order = <5>;
30911183ac0SOlivier Moysan
31011183ac0SOlivier Moysan        asoc_pdm0: dfsdm-dai {
31111183ac0SOlivier Moysan          compatible = "st,stm32h7-dfsdm-dai";
31211183ac0SOlivier Moysan          #sound-dai-cells = <0>;
31311183ac0SOlivier Moysan          io-channels = <&dfsdm0 0>;
31411183ac0SOlivier Moysan        };
31511183ac0SOlivier Moysan      };
31611183ac0SOlivier Moysan
31711183ac0SOlivier Moysan      dfsdm_pdm1: filter@1 {
31811183ac0SOlivier Moysan        compatible = "st,stm32-dfsdm-adc";
31911183ac0SOlivier Moysan        reg = <1>;
32011183ac0SOlivier Moysan        interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
32111183ac0SOlivier Moysan        dmas = <&dmamux1 102 0x400 0x01>;
32211183ac0SOlivier Moysan        dma-names = "rx";
32311183ac0SOlivier Moysan        #io-channel-cells = <1>;
32411183ac0SOlivier Moysan        st,adc-channels = <2 3>;
32511183ac0SOlivier Moysan        st,adc-channel-names = "in2", "in3";
32611183ac0SOlivier Moysan        st,adc-channel-types = "SPI_R", "SPI_R";
32711183ac0SOlivier Moysan        st,adc-channel-clk-src = "CLKOUT_F", "CLKOUT_F";
32811183ac0SOlivier Moysan        io-channels = <&sd_adc2 &sd_adc3>;
32911183ac0SOlivier Moysan        st,filter-order = <1>;
33011183ac0SOlivier Moysan      };
33111183ac0SOlivier Moysan    };
33211183ac0SOlivier Moysan
33311183ac0SOlivier Moysan...
334