blob: 1970503389aa9aacf88c356477b4ad6aff5e0bbc [file] [log] [blame]
Tom Rini53633a82024-02-29 12:33:36 -05001# 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
7title: STMicroelectronics STM32 DFSDM ADC device driver
8
9maintainers:
10 - Fabrice Gasnier <fabrice.gasnier@foss.st.com>
11 - Olivier Moysan <olivier.moysan@foss.st.com>
12
13description: |
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
25properties:
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
62required:
63 - compatible
64 - reg
65 - clocks
66 - clock-names
67 - "#address-cells"
68 - "#size-cells"
69
70additionalProperties: false
71
72patternProperties:
73 "^filter@[0-9]+$":
74 type: object
75 unevaluatedProperties: false
76 description: child node
77
78 properties:
79 compatible:
80 enum:
81 - st,stm32-dfsdm-adc
82 - st,stm32-dfsdm-dmic
83
84 reg:
85 description: Specifies the DFSDM filter instance used.
86 maxItems: 1
87
88 interrupts:
89 maxItems: 1
90
91 st,adc-channels:
92 description: |
93 List of single-ended channels muxed for this ADC.
94 On stm32h7 and stm32mp1:
95 - For st,stm32-dfsdm-adc: up to 8 channels numbered from 0 to 7.
96 - For st,stm32-dfsdm-dmic: 1 channel numbered from 0 to 7.
97 $ref: /schemas/types.yaml#/definitions/uint32-array
98 items:
99 minimum: 0
100 maximum: 7
101
102 st,adc-channel-names:
103 description: List of single-ended channel names.
104
105 st,filter-order:
106 description: |
107 SinC filter order from 0 to 5.
108 - 0: FastSinC
109 - [1-5]: order 1 to 5.
110 For audio purpose it is recommended to use order 3 to 5.
111 $ref: /schemas/types.yaml#/definitions/uint32
112 maximum: 5
113
114 "#io-channel-cells":
115 const: 1
116
117 st,adc-channel-types:
118 description: |
119 Single-ended channel input type.
120 - "SPI_R": SPI with data on rising edge (default)
121 - "SPI_F": SPI with data on falling edge
122 - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1
123 - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0
124 items:
125 enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]
126 $ref: /schemas/types.yaml#/definitions/non-unique-string-array
127
128 st,adc-channel-clk-src:
129 description: |
130 Conversion clock source.
131 - "CLKIN": external SPI clock (CLKIN x)
132 - "CLKOUT": internal SPI clock (CLKOUT) (default)
133 - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
134 - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
135 items:
136 enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]
137 $ref: /schemas/types.yaml#/definitions/non-unique-string-array
138
139 st,adc-alt-channel:
140 description:
141 Must be defined if two sigma delta modulators are
142 connected on same SPI input.
143 If not set, channel n is connected to SPI input n.
144 If set, channel n is connected to SPI input n + 1.
145 type: boolean
146
147 st,filter0-sync:
148 description:
149 Set to 1 to synchronize with DFSDM filter instance 0.
150 Used for multi microphones synchronization.
151 type: boolean
152
153 dmas:
154 maxItems: 1
155
156 dma-names:
157 items:
158 - const: rx
159
160 required:
161 - compatible
162 - reg
163 - interrupts
164 - st,adc-channels
165 - st,adc-channel-names
166 - st,filter-order
167 - "#io-channel-cells"
168
169 allOf:
170 - if:
171 properties:
172 compatible:
173 contains:
174 const: st,stm32-dfsdm-adc
175
176 then:
177 properties:
178 st,adc-channels:
179 minItems: 1
180 maxItems: 8
181
182 st,adc-channel-names:
183 minItems: 1
184 maxItems: 8
185
186 st,adc-channel-types:
187 minItems: 1
188 maxItems: 8
189
190 st,adc-channel-clk-src:
191 minItems: 1
192 maxItems: 8
193
194 io-channels:
195 description:
196 From common IIO binding. Used to pipe external sigma delta
197 modulator or internal ADC output to DFSDM channel.
198
199 required:
200 - io-channels
201
202 - if:
203 properties:
204 compatible:
205 contains:
206 const: st,stm32-dfsdm-dmic
207
208 then:
209 properties:
210 st,adc-channels:
211 maxItems: 1
212
213 st,adc-channel-names:
214 maxItems: 1
215
216 st,adc-channel-types:
217 maxItems: 1
218
219 st,adc-channel-clk-src:
220 maxItems: 1
221
222 required:
223 - dmas
224 - dma-names
225
226 patternProperties:
227 "^dfsdm-dai+$":
228 type: object
229 additionalProperties: false
230 description: child node
231
232 properties:
233 compatible:
234 enum:
235 - st,stm32h7-dfsdm-dai
236
237 "#sound-dai-cells":
238 const: 0
239
240 io-channels:
241 description:
242 From common IIO binding. Used to pipe external sigma delta
243 modulator or internal ADC output to DFSDM channel.
244
245 required:
246 - compatible
247 - "#sound-dai-cells"
248 - io-channels
249
250allOf:
251 - if:
252 properties:
253 compatible:
254 contains:
255 const: st,stm32h7-dfsdm
256
257 then:
258 patternProperties:
259 "^filter@[0-9]+$":
260 properties:
261 reg:
262 items:
263 minimum: 0
264 maximum: 3
265
266 - if:
267 properties:
268 compatible:
269 contains:
270 const: st,stm32mp1-dfsdm
271
272 then:
273 patternProperties:
274 "^filter@[0-9]+$":
275 properties:
276 reg:
277 items:
278 minimum: 0
279 maximum: 5
280
281examples:
282 - |
283 #include <dt-bindings/interrupt-controller/arm-gic.h>
284 #include <dt-bindings/clock/stm32mp1-clks.h>
285 dfsdm: dfsdm@4400d000 {
286 compatible = "st,stm32mp1-dfsdm";
287 reg = <0x4400d000 0x800>;
288 clocks = <&rcc DFSDM_K>, <&rcc ADFSDM_K>;
289 clock-names = "dfsdm", "audio";
290 #address-cells = <1>;
291 #size-cells = <0>;
292
293 dfsdm0: filter@0 {
294 compatible = "st,stm32-dfsdm-dmic";
295 reg = <0>;
296 interrupts = <GIC_SPI 110 IRQ_TYPE_LEVEL_HIGH>;
297 dmas = <&dmamux1 101 0x400 0x01>;
298 dma-names = "rx";
299 #io-channel-cells = <1>;
300 st,adc-channels = <1>;
301 st,adc-channel-names = "dmic0";
302 st,adc-channel-types = "SPI_R";
303 st,adc-channel-clk-src = "CLKOUT";
304 st,filter-order = <5>;
305
306 asoc_pdm0: dfsdm-dai {
307 compatible = "st,stm32h7-dfsdm-dai";
308 #sound-dai-cells = <0>;
309 io-channels = <&dfsdm0 0>;
310 };
311 };
312
313 dfsdm_pdm1: filter@1 {
314 compatible = "st,stm32-dfsdm-adc";
315 reg = <1>;
316 interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>;
317 dmas = <&dmamux1 102 0x400 0x01>;
318 dma-names = "rx";
319 #io-channel-cells = <1>;
320 st,adc-channels = <2 3>;
321 st,adc-channel-names = "in2", "in3";
322 st,adc-channel-types = "SPI_R", "SPI_R";
323 st,adc-channel-clk-src = "CLKOUT_F", "CLKOUT_F";
324 io-channels = <&sd_adc2 &sd_adc3>;
325 st,filter-order = <1>;
326 };
327 };
328
329...