Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[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         $ref: /schemas/types.yaml#/definitions/uint32-array
99         items:
100           minimum: 0
101           maximum: 7
102
103       st,adc-channel-names:
104         description: List of single-ended channel names.
105         $ref: /schemas/types.yaml#/definitions/string-array
106
107       st,filter-order:
108         description: |
109           SinC filter order from 0 to 5.
110           - 0: FastSinC
111           - [1-5]: order 1 to 5.
112           For audio purpose it is recommended to use order 3 to 5.
113         $ref: /schemas/types.yaml#/definitions/uint32
114         items:
115           minimum: 0
116           maximum: 5
117
118       "#io-channel-cells":
119         const: 1
120
121       st,adc-channel-types:
122         description: |
123           Single-ended channel input type.
124           - "SPI_R": SPI with data on rising edge (default)
125           - "SPI_F": SPI with data on falling edge
126           - "MANCH_R": manchester codec, rising edge = logic 0, falling edge = logic 1
127           - "MANCH_F": manchester codec, rising edge = logic 1, falling edge = logic 0
128         items:
129           enum: [ SPI_R, SPI_F, MANCH_R, MANCH_F ]
130         $ref: /schemas/types.yaml#/definitions/non-unique-string-array
131
132       st,adc-channel-clk-src:
133         description: |
134           Conversion clock source.
135           - "CLKIN": external SPI clock (CLKIN x)
136           - "CLKOUT": internal SPI clock (CLKOUT) (default)
137           - "CLKOUT_F": internal SPI clock divided by 2 (falling edge).
138           - "CLKOUT_R": internal SPI clock divided by 2 (rising edge).
139         items:
140           enum: [ CLKIN, CLKOUT, CLKOUT_F, CLKOUT_R ]
141         $ref: /schemas/types.yaml#/definitions/non-unique-string-array
142
143       st,adc-alt-channel:
144         description:
145           Must be defined if two sigma delta modulators are
146           connected on same SPI input.
147           If not set, channel n is connected to SPI input n.
148           If set, channel n is connected to SPI input n + 1.
149         type: boolean
150
151       st,filter0-sync:
152         description:
153           Set to 1 to synchronize with DFSDM filter instance 0.
154           Used for multi microphones synchronization.
155         type: boolean
156
157       dmas:
158         maxItems: 1
159
160       dma-names:
161         items:
162           - const: rx
163
164     required:
165       - compatible
166       - reg
167       - interrupts
168       - st,adc-channels
169       - st,adc-channel-names
170       - st,filter-order
171       - "#io-channel-cells"
172
173     allOf:
174       - if:
175           properties:
176             compatible:
177               contains:
178                 const: st,stm32-dfsdm-adc
179
180       - then:
181           properties:
182             st,adc-channels:
183               minItems: 1
184               maxItems: 8
185
186             st,adc-channel-names:
187               minItems: 1
188               maxItems: 8
189
190             st,adc-channel-types:
191               minItems: 1
192               maxItems: 8
193
194             st,adc-channel-clk-src:
195               minItems: 1
196               maxItems: 8
197
198             io-channels:
199               description:
200                 From common IIO binding. Used to pipe external sigma delta
201                 modulator or internal ADC output to DFSDM channel.
202                 This is not required for "st,stm32-dfsdm-pdm" compatibility as
203                 PDM microphone is binded in Audio DT node.
204
205           required:
206             - io-channels
207
208       - if:
209           properties:
210             compatible:
211               contains:
212                 const: st,stm32-dfsdm-dmic
213
214       - then:
215           properties:
216             st,adc-channels:
217               maxItems: 1
218
219             st,adc-channel-names:
220               maxItems: 1
221
222             st,adc-channel-types:
223               maxItems: 1
224
225             st,adc-channel-clk-src:
226               maxItems: 1
227
228           required:
229             - dmas
230             - dma-names
231
232           patternProperties:
233             "^dfsdm-dai+$":
234               type: object
235               description: child node
236
237               properties:
238                 "#sound-dai-cells":
239                   const: 0
240
241                 io-channels:
242                   description:
243                     From common IIO binding. Used to pipe external sigma delta
244                     modulator or internal ADC output to DFSDM channel.
245
246               required:
247                 - "#sound-dai-cells"
248                 - io-channels
249
250 allOf:
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
281 examples:
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 ...