xref: /linux/Documentation/devicetree/bindings/sound/st,stm32-sai.yaml (revision a460513ed4b6994bfeb7bd86f72853140bc1ac12)
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#
6
7title: STMicroelectronics STM32 Serial Audio Interface (SAI)
8
9maintainers:
10  - Olivier Moysan <olivier.moysan@st.com>
11
12description:
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.
17
18properties:
19  compatible:
20    enum:
21      - st,stm32f4-sai
22      - st,stm32h7-sai
23
24  reg:
25    items:
26      - description: Base address and size of SAI common register set.
27      - description: Base address and size of SAI identification register set.
28    minItems: 1
29    maxItems: 2
30
31  ranges:
32    maxItems: 1
33
34  interrupts:
35    maxItems: 1
36
37  resets:
38    maxItems: 1
39
40  "#address-cells":
41    const: 1
42
43  "#size-cells":
44    const: 1
45
46  clocks:
47    maxItems: 3
48
49  clock-names:
50    maxItems: 3
51
52required:
53  - compatible
54  - reg
55  - ranges
56  - "#address-cells"
57  - "#size-cells"
58  - clocks
59  - clock-names
60
61patternProperties:
62  "^audio-controller@[0-9a-f]+$":
63    type: object
64    description:
65      Two subnodes corresponding to SAI sub-block instances A et B
66      can be defined. Subnode can be omitted for unsused sub-block.
67
68    properties:
69      compatible:
70        description: Compatible for SAI sub-block A or B.
71        pattern: "st,stm32-sai-sub-[ab]"
72
73      "#sound-dai-cells":
74        const: 0
75
76      reg:
77        maxItems: 1
78
79      clocks:
80        items:
81          - description: sai_ck clock feeding the internal clock generator.
82          - description: MCLK clock from a SAI set as master clock provider.
83        minItems: 1
84        maxItems: 2
85
86      clock-names:
87        items:
88          - const: sai_ck
89          - const: MCLK
90        minItems: 1
91        maxItems: 2
92
93      dmas:
94        maxItems: 1
95
96      dma-names:
97        description: |
98          rx: SAI sub-block is configured as a capture DAI.
99          tx: SAI sub-block is configured as a playback DAI.
100        enum: [ rx, tx ]
101
102      st,sync:
103        description:
104          Configure the SAI sub-block as slave of another SAI sub-block.
105          By default SAI sub-block is in asynchronous mode.
106          Must contain the phandle and index of the SAI sub-block providing
107          the synchronization.
108        allOf:
109          - $ref: /schemas/types.yaml#/definitions/phandle-array
110          - maxItems: 1
111
112      st,iec60958:
113        description:
114          If set, support S/PDIF IEC6958 protocol for playback.
115          IEC60958 protocol is not available for capture.
116          By default, custom protocol is assumed, meaning that protocol is
117          configured according to protocol defined in related DAI link node,
118          such as i2s, left justified, right justified, dsp and pdm protocols.
119        allOf:
120          - $ref: /schemas/types.yaml#/definitions/flag
121
122      "#clock-cells":
123        description: Configure the SAI device as master clock provider.
124        const: 0
125
126    required:
127      - compatible
128      - "#sound-dai-cells"
129      - reg
130      - clocks
131      - clock-names
132      - dmas
133      - dma-names
134
135allOf:
136  - if:
137      properties:
138        compatible:
139          contains:
140            const: st,stm32f4-sai
141
142  - then:
143      properties:
144        clocks:
145          items:
146            - description: x8k, SAI parent clock for sampling rates multiple of 8kHz.
147            - description: x11k, SAI parent clock for sampling rates multiple of 11.025kHz.
148
149        clock-names:
150          items:
151            - const: x8k
152            - const: x11k
153
154  - else:
155      properties:
156        clocks:
157          items:
158            - description: pclk feeds the peripheral bus interface.
159            - description: x8k, SAI parent clock for sampling rates multiple of 8kHz.
160            - description: x11k, SAI parent clock for sampling rates multiple of 11.025kHz.
161
162        clock-names:
163          items:
164            - const: pclk
165            - const: x8k
166            - const: x11k
167
168additionalProperties: false
169
170examples:
171  - |
172    #include <dt-bindings/interrupt-controller/arm-gic.h>
173    #include <dt-bindings/clock/stm32mp1-clks.h>
174    #include <dt-bindings/reset/stm32mp1-resets.h>
175    sai2: sai@4400b000 {
176      compatible = "st,stm32h7-sai";
177      #address-cells = <1>;
178      #size-cells = <1>;
179      ranges = <0 0x4400b000 0x400>;
180      reg = <0x4400b000 0x4>, <0x4400b3f0 0x10>;
181      clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
182      clock-names = "pclk", "x8k", "x11k";
183      pinctrl-names = "default", "sleep";
184      pinctrl-0 = <&sai2a_pins_a>, <&sai2b_pins_b>;
185      pinctrl-1 = <&sai2a_sleep_pins_a>, <&sai2b_sleep_pins_b>;
186      status = "okay";
187
188      sai2a: audio-controller@4400b004 {
189        #sound-dai-cells = <0>;
190        compatible = "st,stm32-sai-sub-a";
191        reg = <0x4 0x1c>;
192        dmas = <&dmamux1 89 0x400 0x01>;
193        dma-names = "tx";
194        clocks = <&rcc SAI2_K>;
195        clock-names = "sai_ck";
196        status = "okay";
197      };
198    };
199
200...
201