Merge tag 'block-6.13-20242901' of git://git.kernel.dk/linux
[drm/drm-misc.git] / Documentation / devicetree / bindings / sound / st,stm32-sai.yaml
blob4a7129d0b157473f7e20a7c711aefa09f428edf3
1 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 %YAML 1.2
3 ---
4 $id: http://devicetree.org/schemas/sound/st,stm32-sai.yaml#
5 $schema: http://devicetree.org/meta-schemas/core.yaml#
7 title: STMicroelectronics STM32 Serial Audio Interface (SAI)
9 maintainers:
10   - Olivier Moysan <olivier.moysan@foss.st.com>
12 description:
13   The SAI interface (Serial Audio Interface) offers a wide set of audio
14   protocols as I2S standards, LSB or MSB-justified, PCM/DSP, TDM, and AC'97.
15   The SAI contains two independent audio sub-blocks. Each sub-block has
16   its own clock generator and I/O lines controller.
18 properties:
19   compatible:
20     enum:
21       - st,stm32f4-sai
22       - st,stm32h7-sai
23       - st,stm32mp25-sai
25   reg:
26     items:
27       - description: Base address and size of SAI common register set.
28       - description: Base address and size of SAI identification register set.
29     minItems: 1
31   ranges:
32     maxItems: 1
34   interrupts:
35     maxItems: 1
37   resets:
38     maxItems: 1
40   "#address-cells":
41     const: 1
43   "#size-cells":
44     const: 1
46   clocks:
47     minItems: 1
48     maxItems: 3
50   clock-names:
51     minItems: 1
52     maxItems: 3
54   access-controllers:
55     minItems: 1
56     maxItems: 2
58 required:
59   - compatible
60   - reg
61   - ranges
62   - "#address-cells"
63   - "#size-cells"
64   - clocks
65   - clock-names
67 patternProperties:
68   "^audio-controller@[0-9a-f]+$":
69     type: object
70     additionalProperties: false
71     description:
72       Two subnodes corresponding to SAI sub-block instances A et B
73       can be defined. Subnode can be omitted for unused sub-block.
75     properties:
76       compatible:
77         description: Compatible for SAI sub-block A or B.
78         pattern: "^st,stm32-sai-sub-[ab]$"
80       "#sound-dai-cells":
81         const: 0
83       reg:
84         maxItems: 1
86       clocks:
87         items:
88           - description: sai_ck clock feeding the internal clock generator.
89           - description: MCLK clock from a SAI set as master clock provider.
90         minItems: 1
92       clock-names:
93         items:
94           - const: sai_ck
95           - const: MCLK
96         minItems: 1
98       dmas:
99         maxItems: 1
101       dma-names:
102         description: |
103           rx: SAI sub-block is configured as a capture DAI.
104           tx: SAI sub-block is configured as a playback DAI.
105         enum: [ rx, tx ]
107       st,sync:
108         description:
109           Configure the SAI sub-block as slave of another SAI sub-block.
110           By default SAI sub-block is in asynchronous mode.
111           Must contain the phandle and index of the SAI sub-block providing
112           the synchronization.
113         $ref: /schemas/types.yaml#/definitions/phandle-array
114         items:
115           - items:
116               - description: phandle of the SAI sub-block
117               - description: index of the SAI sub-block
119       st,iec60958:
120         description:
121           If set, support S/PDIF IEC6958 protocol for playback.
122           IEC60958 protocol is not available for capture.
123           By default, custom protocol is assumed, meaning that protocol is
124           configured according to protocol defined in related DAI link node,
125           such as i2s, left justified, right justified, dsp and pdm protocols.
126         $ref: /schemas/types.yaml#/definitions/flag
128       "#clock-cells":
129         description: Configure the SAI device as master clock provider.
130         const: 0
132       port:
133         $ref: audio-graph-port.yaml#
134         unevaluatedProperties: false
136     required:
137       - compatible
138       - "#sound-dai-cells"
139       - reg
140       - clocks
141       - clock-names
142       - dmas
143       - dma-names
145 allOf:
146   - if:
147       properties:
148         compatible:
149           contains:
150             const: st,stm32f4-sai
151     then:
152       properties:
153         clocks:
154           items:
155             - description: x8k, SAI parent clock for sampling rates multiple of 8kHz.
156             - description: x11k, SAI parent clock for sampling rates multiple of 11.025kHz.
158         clock-names:
159           items:
160             - const: x8k
161             - const: x11k
163   - if:
164       properties:
165         compatible:
166           contains:
167             const: st,stm32mph7-sai
168     then:
169       properties:
170         clocks:
171           items:
172             - description: pclk feeds the peripheral bus interface.
173             - description: x8k, SAI parent clock for sampling rates multiple of 8kHz.
174             - description: x11k, SAI parent clock for sampling rates multiple of 11.025kHz.
176         clock-names:
177           items:
178             - const: pclk
179             - const: x8k
180             - const: x11k
182   - if:
183       properties:
184         compatible:
185           contains:
186             const: st,stm32mp25-sai
187     then:
188       properties:
189         clocks:
190           items:
191             - description: pclk feeds the peripheral bus interface.
193         clock-names:
194           items:
195             - const: pclk
197 additionalProperties: false
199 examples:
200   - |
201     #include <dt-bindings/interrupt-controller/arm-gic.h>
202     #include <dt-bindings/clock/stm32mp1-clks.h>
203     #include <dt-bindings/reset/stm32mp1-resets.h>
204     sai2: sai@4400b000 {
205       compatible = "st,stm32h7-sai";
206       #address-cells = <1>;
207       #size-cells = <1>;
208       ranges = <0 0x4400b000 0x400>;
209       reg = <0x4400b000 0x4>, <0x4400b3f0 0x10>;
210       clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
211       clock-names = "pclk", "x8k", "x11k";
212       pinctrl-names = "default", "sleep";
213       pinctrl-0 = <&sai2a_pins_a>, <&sai2b_pins_b>;
214       pinctrl-1 = <&sai2a_sleep_pins_a>, <&sai2b_sleep_pins_b>;
216       sai2a: audio-controller@4400b004 {
217         #sound-dai-cells = <0>;
218         compatible = "st,stm32-sai-sub-a";
219         reg = <0x4 0x1c>;
220         dmas = <&dmamux1 89 0x400 0x01>;
221         dma-names = "tx";
222         clocks = <&rcc SAI2_K>;
223         clock-names = "sai_ck";
224       };
225     };