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