xref: /openbmc/linux/Documentation/devicetree/bindings/sound/fsl,sai.yaml (revision 1c0036e03edd5d97fc0af94dd3ab7e8c58b8191d)
1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/sound/fsl,sai.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Freescale Synchronous Audio Interface (SAI).
8
9maintainers:
10  - Shengjiu Wang <shengjiu.wang@nxp.com>
11
12description: |
13  The SAI is based on I2S module that used communicating with audio codecs,
14  which provides a synchronous audio interface that supports fullduplex
15  serial interfaces with frame synchronization such as I2S, AC97, TDM, and
16  codec/DSP interfaces.
17
18properties:
19  compatible:
20    oneOf:
21      - enum:
22          - fsl,vf610-sai
23          - fsl,imx6sx-sai
24          - fsl,imx6ul-sai
25          - fsl,imx7ulp-sai
26          - fsl,imx8mq-sai
27          - fsl,imx8qm-sai
28          - fsl,imx8ulp-sai
29          - fsl,imx93-sai
30      - items:
31          - enum:
32              - fsl,imx8mm-sai
33              - fsl,imx8mn-sai
34              - fsl,imx8mp-sai
35          - const: fsl,imx8mq-sai
36
37  reg:
38    maxItems: 1
39
40  interrupts:
41    items:
42      - description: receive and transmit interrupt
43
44  dmas:
45    maxItems: 2
46
47  dma-names:
48    maxItems: 2
49
50  clocks:
51    items:
52      - description: The ipg clock for register access
53      - description: master clock source 0 (obsoleted)
54      - description: master clock source 1
55      - description: master clock source 2
56      - description: master clock source 3
57      - description: PLL clock source for 8kHz series
58      - description: PLL clock source for 11kHz series
59    minItems: 4
60
61  clock-names:
62    oneOf:
63      - items:
64          - const: bus
65          - const: mclk0
66          - const: mclk1
67          - const: mclk2
68          - const: mclk3
69          - const: pll8k
70          - const: pll11k
71        minItems: 4
72      - items:
73          - const: bus
74          - const: mclk1
75          - const: mclk2
76          - const: mclk3
77          - const: pll8k
78          - const: pll11k
79        minItems: 4
80
81  lsb-first:
82    description: |
83      Configures whether the LSB or the MSB is transmitted
84      first for the fifo data. If this property is absent,
85      the MSB is transmitted first as default, or the LSB
86      is transmitted first.
87    type: boolean
88
89  big-endian:
90    description: |
91      required if all the SAI registers are big-endian rather than little-endian.
92    type: boolean
93
94  fsl,sai-synchronous-rx:
95    description: |
96      SAI will work in the synchronous mode (sync Tx with Rx) which means
97      both the transmitter and the receiver will send and receive data by
98      following receiver's bit clocks and frame sync clocks.
99    type: boolean
100
101  fsl,sai-asynchronous:
102    description: |
103      SAI will work in the asynchronous mode, which means both transmitter
104      and receiver will send and receive data by following their own bit clocks
105      and frame sync clocks separately.
106      If both fsl,sai-asynchronous and fsl,sai-synchronous-rx are absent, the
107      default synchronous mode (sync Rx with Tx) will be used, which means both
108      transmitter and receiver will send and receive data by following clocks
109      of transmitter.
110    type: boolean
111
112  fsl,dataline:
113    $ref: /schemas/types.yaml#/definitions/uint32-matrix
114    description: |
115      Configure the dataline. It has 3 value for each configuration
116    maxItems: 16
117    items:
118      items:
119        - description: format Default(0), I2S(1) or PDM(2)
120          enum: [0, 1, 2]
121        - description: dataline mask for 'rx'
122        - description: dataline mask for 'tx'
123
124  fsl,sai-mclk-direction-output:
125    description: SAI will output the SAI MCLK clock.
126    type: boolean
127
128  fsl,shared-interrupt:
129    description: Interrupt is shared with other modules.
130    type: boolean
131
132  "#sound-dai-cells":
133    const: 0
134    description: optional, some dts node didn't add it.
135
136allOf:
137  - if:
138      properties:
139        compatible:
140          contains:
141            const: fsl,vf610-sai
142    then:
143      properties:
144        dmas:
145          items:
146            - description: DMA controller phandle and request line for TX
147            - description: DMA controller phandle and request line for RX
148        dma-names:
149          items:
150            - const: tx
151            - const: rx
152    else:
153      properties:
154        dmas:
155          items:
156            - description: DMA controller phandle and request line for RX
157            - description: DMA controller phandle and request line for TX
158        dma-names:
159          items:
160            - const: rx
161            - const: tx
162  - if:
163      required:
164        - fsl,sai-asynchronous
165    then:
166      properties:
167        fsl,sai-synchronous-rx: false
168
169required:
170  - compatible
171  - reg
172  - interrupts
173  - dmas
174  - dma-names
175  - clocks
176  - clock-names
177
178additionalProperties: false
179
180examples:
181  - |
182    #include <dt-bindings/interrupt-controller/arm-gic.h>
183    #include <dt-bindings/clock/vf610-clock.h>
184    sai2: sai@40031000 {
185        compatible = "fsl,vf610-sai";
186        reg = <0x40031000 0x1000>;
187        interrupts = <86 IRQ_TYPE_LEVEL_HIGH>;
188        pinctrl-names = "default";
189        pinctrl-0 = <&pinctrl_sai2_1>;
190        clocks = <&clks VF610_CLK_PLATFORM_BUS>,
191                 <&clks VF610_CLK_SAI2>,
192                 <&clks 0>, <&clks 0>;
193        clock-names = "bus", "mclk1", "mclk2", "mclk3";
194        dma-names = "tx", "rx";
195        dmas = <&edma0 0 21>,
196               <&edma0 0 20>;
197        big-endian;
198        lsb-first;
199    };
200
201  - |
202    #include <dt-bindings/interrupt-controller/arm-gic.h>
203    #include <dt-bindings/clock/imx8mm-clock.h>
204    sai1: sai@30010000 {
205        compatible = "fsl,imx8mm-sai", "fsl,imx8mq-sai";
206        reg = <0x30010000 0x10000>;
207        interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
208        clocks = <&clk IMX8MM_CLK_SAI1_IPG>,
209                 <&clk IMX8MM_CLK_DUMMY>,
210                 <&clk IMX8MM_CLK_SAI1_ROOT>,
211                 <&clk IMX8MM_CLK_DUMMY>, <&clk IMX8MM_CLK_DUMMY>;
212        clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
213        dmas = <&sdma2 0 2 0>, <&sdma2 1 2 0>;
214        dma-names = "rx", "tx";
215        fsl,dataline = <1 0xff 0xff 2 0xff 0x11>;
216        #sound-dai-cells = <0>;
217    };
218