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