xref: /linux/Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml (revision 11183ac07a7460b93acb4b5860528bf30f4d319f)
1*11183ac0SOlivier Moysan# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2*11183ac0SOlivier Moysan%YAML 1.2
3*11183ac0SOlivier Moysan---
4*11183ac0SOlivier Moysan$id: http://devicetree.org/schemas/st,stm32-dfsdm-adc.yaml#
5*11183ac0SOlivier Moysan$schema: http://devicetree.org/meta-schemas/core.yaml#
6*11183ac0SOlivier Moysan
7*11183ac0SOlivier Moysantitle: STMicroelectronics STM32 DFSDM ADC device driver
8*11183ac0SOlivier Moysan
9*11183ac0SOlivier Moysanmaintainers:
10*11183ac0SOlivier Moysan  - Fabrice Gasnier <fabrice.gasnier@st.com>
11*11183ac0SOlivier Moysan  - Olivier Moysan <olivier.moysan@st.com>
12*11183ac0SOlivier Moysan
13*11183ac0SOlivier Moysandescription: |
14*11183ac0SOlivier Moysan  STM32 DFSDM ADC is a sigma delta analog-to-digital converter dedicated to
15*11183ac0SOlivier Moysan  interface external sigma delta modulators to STM32 micro controllers.
16*11183ac0SOlivier Moysan  It is mainly targeted for:
17*11183ac0SOlivier Moysan  - Sigma delta modulators (motor control, metering...)
18*11183ac0SOlivier Moysan  - PDM microphones (audio digital microphone)
19*11183ac0SOlivier Moysan
20*11183ac0SOlivier Moysan  It features up to 8 serial digital interfaces (SPI or Manchester) and
21*11183ac0SOlivier Moysan  up to 4 filters on stm32h7 or 6 filters on stm32mp1.
22*11183ac0SOlivier Moysan
23*11183ac0SOlivier Moysan  Each child node matches with a filter instance.
24*11183ac0SOlivier Moysan
25*11183ac0SOlivier Moysanproperties:
26*11183ac0SOlivier Moysan  compatible:
27*11183ac0SOlivier Moysan    enum:
28*11183ac0SOlivier Moysan      - st,stm32h7-dfsdm
29*11183ac0SOlivier Moysan      - st,stm32mp1-dfsdm
30*11183ac0SOlivier Moysan
31*11183ac0SOlivier Moysan  reg:
32*11183ac0SOlivier Moysan    maxItems: 1
33*11183ac0SOlivier Moysan
34*11183ac0SOlivier Moysan  clocks:
35*11183ac0SOlivier Moysan    items:
36*11183ac0SOlivier Moysan      - description:
37*11183ac0SOlivier Moysan          Internal clock used for DFSDM digital processing and control blocks.
38*11183ac0SOlivier Moysan          dfsdm clock can also feed CLKOUT, when CLKOUT is used.
39*11183ac0SOlivier Moysan      - description: audio clock can be used as an alternate to feed CLKOUT.
40*11183ac0SOlivier Moysan    minItems: 1
41*11183ac0SOlivier Moysan    maxItems: 2
42*11183ac0SOlivier Moysan
43*11183ac0SOlivier Moysan  clock-names:
44*11183ac0SOlivier Moysan    items:
45*11183ac0SOlivier Moysan      - const: dfsdm
46*11183ac0SOlivier Moysan      - const: audio
47*11183ac0SOlivier Moysan    minItems: 1
48*11183ac0SOlivier Moysan    maxItems: 2
49*11183ac0SOlivier Moysan
50*11183ac0SOlivier Moysan  "#address-cells":
51*11183ac0SOlivier Moysan    const: 1
52*11183ac0SOlivier Moysan
53*11183ac0SOlivier Moysan  "#size-cells":
54*11183ac0SOlivier Moysan    const: 0
55*11183ac0SOlivier Moysan
56*11183ac0SOlivier Moysan  spi-max-frequency:
57*11183ac0SOlivier Moysan    description:
58*11183ac0SOlivier Moysan      SPI clock OUT frequency (Hz). Requested only for SPI master mode.
59*11183ac0SOlivier Moysan      This clock must be set according to the "clock" property.
60*11183ac0SOlivier Moysan      Frequency must be a multiple of the rcc clock frequency.
61*11183ac0SOlivier Moysan      If not, SPI CLKOUT frequency will not be accurate.
62*11183ac0SOlivier Moysan    maximum: 20000000
63*11183ac0SOlivier Moysan
64*11183ac0SOlivier Moysanrequired:
65*11183ac0SOlivier Moysan  - compatible
66*11183ac0SOlivier Moysan  - reg
67*11183ac0SOlivier Moysan  - clocks
68*11183ac0SOlivier Moysan  - clock-names
69*11183ac0SOlivier Moysan  - "#address-cells"
70*11183ac0SOlivier Moysan  - "#size-cells"
71*11183ac0SOlivier Moysan
72*11183ac0SOlivier MoysanpatternProperties:
73*11183ac0SOlivier Moysan  "^filter@[0-9]+$":
74*11183ac0SOlivier Moysan    type: object
75*11183ac0SOlivier Moysan    description: child node
76*11183ac0SOlivier Moysan
77*11183ac0SOlivier Moysan    properties:
78*11183ac0SOlivier Moysan      compatible:
79*11183ac0SOlivier Moysan        enum:
80*11183ac0SOlivier Moysan          - st,stm32-dfsdm-adc
81*11183ac0SOlivier Moysan          - st,stm32-dfsdm-dmic
82*11183ac0SOlivier Moysan
83*11183ac0SOlivier Moysan      reg:
84*11183ac0SOlivier Moysan        description: Specifies the DFSDM filter instance used.
85*11183ac0SOlivier Moysan        maxItems: 1
86*11183ac0SOlivier Moysan
87*11183ac0SOlivier Moysan      interrupts:
88*11183ac0SOlivier Moysan        maxItems: 1
89*11183ac0SOlivier Moysan
90*11183ac0SOlivier Moysan      st,adc-channels:
91*11183ac0SOlivier Moysan        description: |
92*11183ac0SOlivier Moysan          List of single-ended channels muxed for this ADC.
93*11183ac0SOlivier Moysan          On stm32h7 and stm32mp1:
94*11183ac0SOlivier Moysan          - For st,stm32-dfsdm-adc: up to 8 channels numbered from 0 to 7.
95*11183ac0SOlivier Moysan          - For st,stm32-dfsdm-dmic: 1 channel numbered from 0 to 7.
96*11183ac0SOlivier Moysan        allOf:
97*11183ac0SOlivier Moysan          - $ref: /schemas/types.yaml#/definitions/uint32-array
98*11183ac0SOlivier Moysan          - items:
99*11183ac0SOlivier Moysan              minimum: 0
100*11183ac0SOlivier Moysan              maximum: 7
101*11183ac0SOlivier Moysan
102*11183ac0SOlivier Moysan      st,adc-channel-names:
103*11183ac0SOlivier Moysan        description: List of single-ended channel names.
104*11183ac0SOlivier Moysan        allOf:
105*11183ac0SOlivier Moysan          - $ref: /schemas/types.yaml#/definitions/string-array
106*11183ac0SOlivier Moysan
107*11183ac0SOlivier Moysan      st,filter-order:
108*11183ac0SOlivier Moysan        description: |
109*11183ac0SOlivier Moysan          SinC filter order from 0 to 5.
110*11183ac0SOlivier Moysan          - 0: FastSinC
111*11183ac0SOlivier Moysan          - [1-5]: order 1 to 5.
112*11183ac0SOlivier Moysan          For audio purpose it is recommended to use order 3 to 5.
113*11183ac0SOlivier Moysan        allOf:
114*11183ac0SOlivier Moysan          - $ref: /schemas/types.yaml#/definitions/uint32
115*11183ac0SOlivier Moysan          - items:
116*11183ac0SOlivier Moysan              minimum: 0
117*11183ac0SOlivier Moysan              maximum: 5
118*11183ac0SOlivier Moysan
119*11183ac0SOlivier Moysan      "#io-channel-cells":
120*11183ac0SOlivier Moysan        const: 1
121*11183ac0SOlivier Moysan
122*11183ac0SOlivier Moysan      st,adc-channel-types:
123*11183ac0SOlivier Moysan        description: |
124*11183ac0SOlivier Moysan          Single-ended channel input type.
125*11183ac0SOlivier Moysan          - "SPI_R": SPI with data on rising edge (default)
126*11183ac0SOlivier Moysan          - "SPI_F": SPI with data on falling edge
127*11183ac0SOlivier Moysan          - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1
128*11183ac0SOlivier Moysan          - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0
129*11183ac0SOlivier Moysan        items:
130*11183ac0SOlivier Moysan          enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]
131*11183ac0SOlivier Moysan        allOf:
132*11183ac0SOlivier Moysan          - $ref: /schemas/types.yaml#/definitions/non-unique-string-array
133*11183ac0SOlivier Moysan
134*11183ac0SOlivier Moysan      st,adc-channel-clk-src:
135*11183ac0SOlivier Moysan        description: |
136*11183ac0SOlivier Moysan          Conversion clock source.
137*11183ac0SOlivier Moysan          - "CLKIN": external SPI clock (CLKIN x)
138*11183ac0SOlivier Moysan          - "CLKOUT": internal SPI clock (CLKOUT) (default)
139*11183ac0SOlivier Moysan          - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
140*11183ac0SOlivier Moysan          - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
141*11183ac0SOlivier Moysan        items:
142*11183ac0SOlivier Moysan          enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]
143*11183ac0SOlivier Moysan        allOf:
144*11183ac0SOlivier Moysan          - $ref: /schemas/types.yaml#/definitions/non-unique-string-array
145*11183ac0SOlivier Moysan
146*11183ac0SOlivier Moysan      st,adc-alt-channel:
147*11183ac0SOlivier Moysan        description:
148*11183ac0SOlivier Moysan          Must be defined if two sigma delta modulators are
149*11183ac0SOlivier Moysan          connected on same SPI input.
150*11183ac0SOlivier Moysan          If not set, channel n is connected to SPI input n.
151*11183ac0SOlivier Moysan          If set, channel n is connected to SPI input n + 1.
152*11183ac0SOlivier Moysan        type: boolean
153*11183ac0SOlivier Moysan
154*11183ac0SOlivier Moysan      st,filter0-sync:
155*11183ac0SOlivier Moysan        description:
156*11183ac0SOlivier Moysan          Set to 1 to synchronize with DFSDM filter instance 0.
157*11183ac0SOlivier Moysan          Used for multi microphones synchronization.
158*11183ac0SOlivier Moysan        type: boolean
159*11183ac0SOlivier Moysan
160*11183ac0SOlivier Moysan      dmas:
161*11183ac0SOlivier Moysan        maxItems: 1
162*11183ac0SOlivier Moysan
163*11183ac0SOlivier Moysan      dma-names:
164*11183ac0SOlivier Moysan        items:
165*11183ac0SOlivier Moysan          - const: rx
166*11183ac0SOlivier Moysan
167*11183ac0SOlivier Moysan    required:
168*11183ac0SOlivier Moysan      - compatible
169*11183ac0SOlivier Moysan      - reg
170*11183ac0SOlivier Moysan      - interrupts
171*11183ac0SOlivier Moysan      - st,adc-channels
172*11183ac0SOlivier Moysan      - st,adc-channel-names
173*11183ac0SOlivier Moysan      - st,filter-order
174*11183ac0SOlivier Moysan      - "#io-channel-cells"
175*11183ac0SOlivier Moysan
176*11183ac0SOlivier Moysan    allOf:
177*11183ac0SOlivier Moysan      - if:
178*11183ac0SOlivier Moysan          properties:
179*11183ac0SOlivier Moysan            compatible:
180*11183ac0SOlivier Moysan              contains:
181*11183ac0SOlivier Moysan                const: st,stm32-dfsdm-adc
182*11183ac0SOlivier Moysan
183*11183ac0SOlivier Moysan      - then:
184*11183ac0SOlivier Moysan          properties:
185*11183ac0SOlivier Moysan            st,adc-channels:
186*11183ac0SOlivier Moysan              minItems: 1
187*11183ac0SOlivier Moysan              maxItems: 8
188*11183ac0SOlivier Moysan
189*11183ac0SOlivier Moysan            st,adc-channel-names:
190*11183ac0SOlivier Moysan              minItems: 1
191*11183ac0SOlivier Moysan              maxItems: 8
192*11183ac0SOlivier Moysan
193*11183ac0SOlivier Moysan            st,adc-channel-types:
194*11183ac0SOlivier Moysan              minItems: 1
195*11183ac0SOlivier Moysan              maxItems: 8
196*11183ac0SOlivier Moysan
197*11183ac0SOlivier Moysan            st,adc-channel-clk-src:
198*11183ac0SOlivier Moysan              minItems: 1
199*11183ac0SOlivier Moysan              maxItems: 8
200*11183ac0SOlivier Moysan
201*11183ac0SOlivier Moysan            io-channels:
202*11183ac0SOlivier Moysan              description:
203*11183ac0SOlivier Moysan                From common IIO binding. Used to pipe external sigma delta
204*11183ac0SOlivier Moysan                modulator or internal ADC output to DFSDM channel.
205*11183ac0SOlivier Moysan                This is not required for "st,stm32-dfsdm-pdm" compatibility as
206*11183ac0SOlivier Moysan                PDM microphone is binded in Audio DT node.
207*11183ac0SOlivier Moysan
208*11183ac0SOlivier Moysan          required:
209*11183ac0SOlivier Moysan            - io-channels
210*11183ac0SOlivier Moysan
211*11183ac0SOlivier Moysan      - if:
212*11183ac0SOlivier Moysan          properties:
213*11183ac0SOlivier Moysan            compatible:
214*11183ac0SOlivier Moysan              contains:
215*11183ac0SOlivier Moysan                const: st,stm32-dfsdm-dmic
216*11183ac0SOlivier Moysan
217*11183ac0SOlivier Moysan      - then:
218*11183ac0SOlivier Moysan          properties:
219*11183ac0SOlivier Moysan            st,adc-channels:
220*11183ac0SOlivier Moysan              maxItems: 1
221*11183ac0SOlivier Moysan
222*11183ac0SOlivier Moysan            st,adc-channel-names:
223*11183ac0SOlivier Moysan              maxItems: 1
224*11183ac0SOlivier Moysan
225*11183ac0SOlivier Moysan            st,adc-channel-types:
226*11183ac0SOlivier Moysan              maxItems: 1
227*11183ac0SOlivier Moysan
228*11183ac0SOlivier Moysan            st,adc-channel-clk-src:
229*11183ac0SOlivier Moysan              maxItems: 1
230*11183ac0SOlivier Moysan
231*11183ac0SOlivier Moysan          required:
232*11183ac0SOlivier Moysan            - dmas
233*11183ac0SOlivier Moysan            - dma-names
234*11183ac0SOlivier Moysan
235*11183ac0SOlivier Moysan          patternProperties:
236*11183ac0SOlivier Moysan            "^dfsdm-dai+$":
237*11183ac0SOlivier Moysan              type: object
238*11183ac0SOlivier Moysan              description: child node
239*11183ac0SOlivier Moysan
240*11183ac0SOlivier Moysan              properties:
241*11183ac0SOlivier Moysan                "#sound-dai-cells":
242*11183ac0SOlivier Moysan                  const: 0
243*11183ac0SOlivier Moysan
244*11183ac0SOlivier Moysan                io-channels:
245*11183ac0SOlivier Moysan                  description:
246*11183ac0SOlivier Moysan                    From common IIO binding. Used to pipe external sigma delta
247*11183ac0SOlivier Moysan                    modulator or internal ADC output to DFSDM channel.
248*11183ac0SOlivier Moysan
249*11183ac0SOlivier Moysan              required:
250*11183ac0SOlivier Moysan                - "#sound-dai-cells"
251*11183ac0SOlivier Moysan                - io-channels
252*11183ac0SOlivier Moysan
253*11183ac0SOlivier MoysanallOf:
254*11183ac0SOlivier Moysan  - if:
255*11183ac0SOlivier Moysan      properties:
256*11183ac0SOlivier Moysan        compatible:
257*11183ac0SOlivier Moysan          contains:
258*11183ac0SOlivier Moysan            const: st,stm32h7-dfsdm
259*11183ac0SOlivier Moysan
260*11183ac0SOlivier Moysan  - then:
261*11183ac0SOlivier Moysan      patternProperties:
262*11183ac0SOlivier Moysan        "^filter@[0-9]+$":
263*11183ac0SOlivier Moysan          properties:
264*11183ac0SOlivier Moysan            reg:
265*11183ac0SOlivier Moysan              items:
266*11183ac0SOlivier Moysan                minimum: 0
267*11183ac0SOlivier Moysan                maximum: 3
268*11183ac0SOlivier Moysan
269*11183ac0SOlivier Moysan  - if:
270*11183ac0SOlivier Moysan      properties:
271*11183ac0SOlivier Moysan        compatible:
272*11183ac0SOlivier Moysan          contains:
273*11183ac0SOlivier Moysan            const: st,stm32mp1-dfsdm
274*11183ac0SOlivier Moysan
275*11183ac0SOlivier Moysan  - then:
276*11183ac0SOlivier Moysan      patternProperties:
277*11183ac0SOlivier Moysan        "^filter@[0-9]+$":
278*11183ac0SOlivier Moysan          properties:
279*11183ac0SOlivier Moysan            reg:
280*11183ac0SOlivier Moysan              items:
281*11183ac0SOlivier Moysan                minimum: 0
282*11183ac0SOlivier Moysan                maximum: 5
283*11183ac0SOlivier Moysan
284*11183ac0SOlivier Moysanexamples:
285*11183ac0SOlivier Moysan  - |
286*11183ac0SOlivier Moysan    #include <dt-bindings/interrupt-controller/arm-gic.h>
287*11183ac0SOlivier Moysan    #include <dt-bindings/clock/stm32mp1-clks.h>
288*11183ac0SOlivier Moysan    dfsdm: dfsdm@4400d000 {
289*11183ac0SOlivier Moysan      compatible = "st,stm32mp1-dfsdm";
290*11183ac0SOlivier Moysan      reg = <0x4400d000 0x800>;
291*11183ac0SOlivier Moysan      clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>;
292*11183ac0SOlivier Moysan      clock-names = "dfsdm", "audio";
293*11183ac0SOlivier Moysan      #address-cells = <1>;
294*11183ac0SOlivier Moysan      #size-cells = <0>;
295*11183ac0SOlivier Moysan
296*11183ac0SOlivier Moysan      dfsdm0: filter@0 {
297*11183ac0SOlivier Moysan        compatible = "st,stm32-dfsdm-dmic";
298*11183ac0SOlivier Moysan        reg = <0>;
299*11183ac0SOlivier Moysan        interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
300*11183ac0SOlivier Moysan        dmas = <&dmamux1 101 0x400 0x01>;
301*11183ac0SOlivier Moysan        dma-names = "rx";
302*11183ac0SOlivier Moysan        #io-channel-cells = <1>;
303*11183ac0SOlivier Moysan        st,adc-channels = <1>;
304*11183ac0SOlivier Moysan        st,adc-channel-names = "dmic0";
305*11183ac0SOlivier Moysan        st,adc-channel-types = "SPI_R";
306*11183ac0SOlivier Moysan        st,adc-channel-clk-src = "CLKOUT";
307*11183ac0SOlivier Moysan        st,filter-order = <5>;
308*11183ac0SOlivier Moysan
309*11183ac0SOlivier Moysan        asoc_pdm0: dfsdm-dai {
310*11183ac0SOlivier Moysan          compatible = "st,stm32h7-dfsdm-dai";
311*11183ac0SOlivier Moysan          #sound-dai-cells = <0>;
312*11183ac0SOlivier Moysan          io-channels = <&dfsdm0 0>;
313*11183ac0SOlivier Moysan        };
314*11183ac0SOlivier Moysan      };
315*11183ac0SOlivier Moysan
316*11183ac0SOlivier Moysan      dfsdm_pdm1: filter@1 {
317*11183ac0SOlivier Moysan        compatible = "st,stm32-dfsdm-adc";
318*11183ac0SOlivier Moysan        reg = <1>;
319*11183ac0SOlivier Moysan        interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
320*11183ac0SOlivier Moysan        dmas = <&dmamux1 102 0x400 0x01>;
321*11183ac0SOlivier Moysan        dma-names = "rx";
322*11183ac0SOlivier Moysan        #io-channel-cells = <1>;
323*11183ac0SOlivier Moysan        st,adc-channels = <2 3>;
324*11183ac0SOlivier Moysan        st,adc-channel-names = "in2", "in3";
325*11183ac0SOlivier Moysan        st,adc-channel-types = "SPI_R", "SPI_R";
326*11183ac0SOlivier Moysan        st,adc-channel-clk-src = "CLKOUT_F", "CLKOUT_F";
327*11183ac0SOlivier Moysan        io-channels = <&sd_adc2 &sd_adc3>;
328*11183ac0SOlivier Moysan        st,filter-order = <1>;
329*11183ac0SOlivier Moysan      };
330*11183ac0SOlivier Moysan    };
331*11183ac0SOlivier Moysan
332*11183ac0SOlivier Moysan...
333