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