Debian Codegraph @

Documentation/devicetree/bindings/iio/adc/st,stm32-dfsdm-adc.yaml

raw symbols SCIP
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 <[email protected]>
11 - Olivier Moysan <[email protected]>
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
42 clock-names:
43 items:
44 - const: dfsdm
45 - const: audio
46 minItems: 1
47
48 "#address-cells":
49 const: 1
50
51 "#size-cells":
52 const: 0
53
54 spi-max-frequency:
55 description:
56 SPI clock OUT frequency (Hz). Requested only for SPI master mode.
57 This clock must be set according to the "clock" property.
58 Frequency must be a multiple of the rcc clock frequency.
59 If not, SPI CLKOUT frequency will not be accurate.
60 maximum: 20000000
61
62 access-controllers:
63 minItems: 1
64 maxItems: 2
65
66 required:
67 - compatible
68 - reg
69 - clocks
70 - clock-names
71 - "#address-cells"
72 - "#size-cells"
73
74 additionalProperties: false
75
76 patternProperties:
77 "^filter@[0-9]+$":
78 type: object
79 unevaluatedProperties: false
80 description: child node
81
82 properties:
83 compatible:
84 enum:
85 - st,stm32-dfsdm-adc
86 - st,stm32-dfsdm-dmic
87
88 reg:
89 description: Specifies the DFSDM filter instance used.
90 maxItems: 1
91
92 interrupts:
93 maxItems: 1
94
95 st,adc-channels:
96 description: |
97 List of single-ended channels muxed for this ADC.
98 On stm32h7 and stm32mp1:
99 - For st,stm32-dfsdm-adc: up to 8 channels numbered from 0 to 7.
100 - For st,stm32-dfsdm-dmic: 1 channel numbered from 0 to 7.
101 $ref: /schemas/types.yaml#/definitions/uint32-array
102 items:
103 minimum: 0
104 maximum: 7
105 deprecated: true
106
107 st,adc-channel-names:
108 description: List of single-ended channel names.
109 deprecated: true
110
111 st,filter-order:
112 description: |
113 SinC filter order from 0 to 5.
114 - 0: FastSinC
115 - [1-5]: order 1 to 5.
116 For audio purpose it is recommended to use order 3 to 5.
117 $ref: /schemas/types.yaml#/definitions/uint32
118 maximum: 5
119
120 "#io-channel-cells":
121 const: 1
122
123 '#address-cells':
124 const: 1
125
126 '#size-cells':
127 const: 0
128
129 st,adc-channel-types:
130 description: |
131 Single-ended channel input type.
132 - "SPI_R": SPI with data on rising edge (default)
133 - "SPI_F": SPI with data on falling edge
134 - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1
135 - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0
136 items:
137 enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]
138 $ref: /schemas/types.yaml#/definitions/non-unique-string-array
139 deprecated: true
140
141 st,adc-channel-clk-src:
142 description: |
143 Conversion clock source.
144 - "CLKIN": external SPI clock (CLKIN x)
145 - "CLKOUT": internal SPI clock (CLKOUT) (default)
146 - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
147 - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
148 items:
149 enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]
150 $ref: /schemas/types.yaml#/definitions/non-unique-string-array
151 deprecated: true
152
153 st,adc-alt-channel:
154 description:
155 Must be defined if two sigma delta modulators are
156 connected on same SPI input.
157 If not set, channel n is connected to SPI input n.
158 If set, channel n is connected to SPI input n + 1.
159 type: boolean
160 deprecated: true
161
162 st,filter0-sync:
163 description:
164 Set to 1 to synchronize with DFSDM filter instance 0.
165 Used for multi microphones synchronization.
166 type: boolean
167
168 dmas:
169 maxItems: 1
170
171 dma-names:
172 items:
173 - const: rx
174
175 required:
176 - compatible
177 - reg
178 - interrupts
179 - st,filter-order
180 - "#io-channel-cells"
181
182 patternProperties:
183 "^channel@[0-7]$":
184 type: object
185 $ref: adc.yaml
186 unevaluatedProperties: false
187 description: Represents the external channels which are connected to the DFSDM.
188
189 properties:
190 reg:
191 maximum: 7
192
193 label:
194 description:
195 Unique name to identify which channel this is.
196
197 st,adc-channel-type:
198 description: |
199 Single-ended channel input type.
200 - "SPI_R": SPI with data on rising edge (default)
201 - "SPI_F": SPI with data on falling edge
202 - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1
203 - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0
204 $ref: /schemas/types.yaml#/definitions/string
205 enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]
206
207 st,adc-channel-clk-src:
208 description: |
209 Conversion clock source.
210 - "CLKIN": external SPI clock (CLKIN x)
211 - "CLKOUT": internal SPI clock (CLKOUT) (default)
212 - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
213 - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
214 $ref: /schemas/types.yaml#/definitions/string
215 enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]
216
217 st,adc-alt-channel:
218 description:
219 Must be defined if two sigma delta modulators are
220 connected on same SPI input.
221 If not set, channel n is connected to SPI input n.
222 If set, channel n is connected to SPI input n + 1.
223 type: boolean
224
225 io-backends:
226 description:
227 Used to pipe external sigma delta modulator or internal ADC backend to DFSDM channel.
228 maxItems: 1
229
230 required:
231 - reg
232
233 allOf:
234 - if:
235 properties:
236 compatible:
237 contains:
238 const: st,stm32-dfsdm-adc
239
240 then:
241 properties:
242 st,adc-channels:
243 minItems: 1
244 maxItems: 8
245
246 st,adc-channel-names:
247 minItems: 1
248 maxItems: 8
249
250 st,adc-channel-types:
251 minItems: 1
252 maxItems: 8
253
254 st,adc-channel-clk-src:
255 minItems: 1
256 maxItems: 8
257
258 io-channels:
259 description:
260 From common IIO binding. Used to pipe external sigma delta
261 modulator or internal ADC output to DFSDM channel.
262 deprecated: true
263
264 if:
265 required:
266 - st,adc-channels
267 then:
268 required:
269 - io-channels
270
271 patternProperties:
272 "^channel@[0-7]$":
273 required:
274 - io-backends
275
276 - if:
277 properties:
278 compatible:
279 contains:
280 const: st,stm32-dfsdm-dmic
281
282 then:
283 properties:
284 st,adc-channels:
285 maxItems: 1
286
287 st,adc-channel-names:
288 maxItems: 1
289
290 st,adc-channel-types:
291 maxItems: 1
292
293 st,adc-channel-clk-src:
294 maxItems: 1
295
296 required:
297 - dmas
298 - dma-names
299
300 patternProperties:
301 "^dfsdm-dai+$":
302 type: object
303 additionalProperties: false
304 description: child node
305
306 properties:
307 compatible:
308 enum:
309 - st,stm32h7-dfsdm-dai
310
311 "#sound-dai-cells":
312 const: 0
313
314 io-channels:
315 description:
316 From common IIO binding. Used to pipe external sigma delta
317 modulator or internal ADC output to DFSDM channel.
318
319 port:
320 $ref: /schemas/sound/audio-graph-port.yaml#
321 unevaluatedProperties: false
322
323 required:
324 - compatible
325 - "#sound-dai-cells"
326 - io-channels
327
328 allOf:
329 - if:
330 properties:
331 compatible:
332 contains:
333 const: st,stm32h7-dfsdm
334
335 then:
336 patternProperties:
337 "^filter@[0-9]+$":
338 properties:
339 reg:
340 items:
341 minimum: 0
342 maximum: 3
343
344 - if:
345 properties:
346 compatible:
347 contains:
348 const: st,stm32mp1-dfsdm
349
350 then:
351 patternProperties:
352 "^filter@[0-9]+$":
353 properties:
354 reg:
355 items:
356 minimum: 0
357 maximum: 5
358
359 examples:
360 - |
361 #include <dt-bindings/interrupt-controller/arm-gic.h>
362 #include <dt-bindings/clock/stm32mp1-clks.h>
363 dfsdm: dfsdm@4400d000 {
364 compatible = "st,stm32mp1-dfsdm";
365 reg = <0x4400d000 0x800>;
366 clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>;
367 clock-names = "dfsdm", "audio";
368 #address-cells = <1>;
369 #size-cells = <0>;
370
371 // Example 1: Audio use case with generic binding
372 dfsdm0: filter@0 {
373 compatible = "st,stm32-dfsdm-dmic";
374 reg = <0>;
375 interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
376 dmas = <&dmamux1 101 0x400 0x01>;
377 dma-names = "rx";
378 #io-channel-cells = <1>;
379 #address-cells = <1>;
380 #size-cells = <0>;
381 st,filter-order = <5>;
382
383 channel@1 {
384 reg = <1>;
385 label = "dmic0";
386 st,adc-channel-type = "SPI_R";
387 st,adc-channel-clk-src = "CLKOUT";
388 st,adc-alt-channel;
389 };
390
391 asoc_pdm0: dfsdm-dai {
392 compatible = "st,stm32h7-dfsdm-dai";
393 #sound-dai-cells = <0>;
394 io-channels = <&dfsdm0 0>;
395 };
396 };
397
398 // Example 2: Analog use case with generic binding
399 dfsdm1: filter@1 {
400 compatible = "st,stm32-dfsdm-adc";
401 reg = <1>;
402 interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
403 dmas = <&dmamux1 102 0x400 0x01>;
404 dma-names = "rx";
405 st,filter-order = <1>;
406 #io-channel-cells = <1>;
407 #address-cells = <1>;
408 #size-cells = <0>;
409
410 channel@2 {
411 reg = <2>;
412 label = "in2";
413 st,adc-channel-type = "SPI_F";
414 st,adc-channel-clk-src = "CLKOUT";
415 st,adc-alt-channel;
416 io-backends = <&sd_adc2>;
417 };
418
419 channel@3 {
420 reg = <3>;
421 label = "in3";
422 st,adc-channel-type = "SPI_R";
423 st,adc-channel-clk-src = "CLKOUT";
424 io-backends = <&sd_adc3>;
425 };
426 };
427 };
428
429 ...