xref: /linux/Documentation/devicetree/bindings/sound/fsl,sai.yaml (revision 33e02dc69afbd8f1b85a51d74d72f139ba4ca623)
1d5633368SShengjiu Wang# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2d5633368SShengjiu Wang%YAML 1.2
3d5633368SShengjiu Wang---
4d5633368SShengjiu Wang$id: http://devicetree.org/schemas/sound/fsl,sai.yaml#
5d5633368SShengjiu Wang$schema: http://devicetree.org/meta-schemas/core.yaml#
6d5633368SShengjiu Wang
7d5633368SShengjiu Wangtitle: Freescale Synchronous Audio Interface (SAI).
8d5633368SShengjiu Wang
9d5633368SShengjiu Wangmaintainers:
10d5633368SShengjiu Wang  - Shengjiu Wang <shengjiu.wang@nxp.com>
11d5633368SShengjiu Wang
12d5633368SShengjiu Wangdescription: |
13d5633368SShengjiu Wang  The SAI is based on I2S module that used communicating with audio codecs,
14d5633368SShengjiu Wang  which provides a synchronous audio interface that supports fullduplex
15d5633368SShengjiu Wang  serial interfaces with frame synchronization such as I2S, AC97, TDM, and
16d5633368SShengjiu Wang  codec/DSP interfaces.
17d5633368SShengjiu Wang
18d5633368SShengjiu Wangproperties:
19d5633368SShengjiu Wang  compatible:
20d5633368SShengjiu Wang    oneOf:
2181b6c043SMarek Vasut      - items:
22d5633368SShengjiu Wang          - enum:
23d5633368SShengjiu Wang              - fsl,imx6ul-sai
2481b6c043SMarek Vasut              - fsl,imx7d-sai
2581b6c043SMarek Vasut          - const: fsl,imx6sx-sai
2681b6c043SMarek Vasut
27d5633368SShengjiu Wang      - items:
28d5633368SShengjiu Wang          - enum:
29d5633368SShengjiu Wang              - fsl,imx8mm-sai
30d5633368SShengjiu Wang              - fsl,imx8mn-sai
31d5633368SShengjiu Wang              - fsl,imx8mp-sai
32d5633368SShengjiu Wang          - const: fsl,imx8mq-sai
33d5633368SShengjiu Wang
3481b6c043SMarek Vasut      - items:
3581b6c043SMarek Vasut          - enum:
3681b6c043SMarek Vasut              - fsl,imx6sx-sai
3781b6c043SMarek Vasut              - fsl,imx7ulp-sai
3881b6c043SMarek Vasut              - fsl,imx8mq-sai
3981b6c043SMarek Vasut              - fsl,imx8qm-sai
4081b6c043SMarek Vasut              - fsl,imx8ulp-sai
41e85b1f5aSMarek Vasut              - fsl,imx93-sai
4252523f70SChancel Liu              - fsl,imx95-sai
4381b6c043SMarek Vasut              - fsl,vf610-sai
4481b6c043SMarek Vasut
45d5633368SShengjiu Wang  reg:
46d5633368SShengjiu Wang    maxItems: 1
47d5633368SShengjiu Wang
48d5633368SShengjiu Wang  clocks:
49d5633368SShengjiu Wang    items:
50d5633368SShengjiu Wang      - description: The ipg clock for register access
51d5633368SShengjiu Wang      - description: master clock source 0 (obsoleted)
52d5633368SShengjiu Wang      - description: master clock source 1
53d5633368SShengjiu Wang      - description: master clock source 2
54d5633368SShengjiu Wang      - description: master clock source 3
55d5633368SShengjiu Wang      - description: PLL clock source for 8kHz series
56d5633368SShengjiu Wang      - description: PLL clock source for 11kHz series
57d5633368SShengjiu Wang    minItems: 4
58d5633368SShengjiu Wang
59d5633368SShengjiu Wang  clock-names:
60d5633368SShengjiu Wang    oneOf:
61d5633368SShengjiu Wang      - items:
62d5633368SShengjiu Wang          - const: bus
63d5633368SShengjiu Wang          - const: mclk0
64d5633368SShengjiu Wang          - const: mclk1
65d5633368SShengjiu Wang          - const: mclk2
66d5633368SShengjiu Wang          - const: mclk3
67d5633368SShengjiu Wang          - const: pll8k
68d5633368SShengjiu Wang          - const: pll11k
69ef555955SMarek Vasut        minItems: 5
70d5633368SShengjiu Wang      - items:
71d5633368SShengjiu Wang          - const: bus
72d5633368SShengjiu Wang          - const: mclk1
73d5633368SShengjiu Wang          - const: mclk2
74d5633368SShengjiu Wang          - const: mclk3
75d5633368SShengjiu Wang          - const: pll8k
76d5633368SShengjiu Wang          - const: pll11k
77d5633368SShengjiu Wang        minItems: 4
78d5633368SShengjiu Wang
797084f0deSAlexander Stein  power-domains:
807084f0deSAlexander Stein    maxItems: 1
817084f0deSAlexander Stein
823e4f964dSMarek Vasut  dmas:
83b6ea4284SAlexander Stein    minItems: 1
84*7b5f2072SFrank Li    maxItems: 2
853e4f964dSMarek Vasut
863e4f964dSMarek Vasut  dma-names:
87b6ea4284SAlexander Stein    minItems: 1
8821d64f6fSMarek Vasut    items:
89*7b5f2072SFrank Li      - enum: [ rx, tx ]
9021d64f6fSMarek Vasut      - const: tx
913e4f964dSMarek Vasut
923e4f964dSMarek Vasut  interrupts:
933e4f964dSMarek Vasut    items:
943e4f964dSMarek Vasut      - description: receive and transmit interrupt
95d5633368SShengjiu Wang
96d5633368SShengjiu Wang  big-endian:
97d5633368SShengjiu Wang    description: |
98d5633368SShengjiu Wang      required if all the SAI registers are big-endian rather than little-endian.
99d5633368SShengjiu Wang    type: boolean
100d5633368SShengjiu Wang
1013e4f964dSMarek Vasut  fsl,dataline:
1023e4f964dSMarek Vasut    $ref: /schemas/types.yaml#/definitions/uint32-matrix
1033e4f964dSMarek Vasut    description: |
1043e4f964dSMarek Vasut      Configure the dataline. It has 3 value for each configuration
1053e4f964dSMarek Vasut    maxItems: 16
1063e4f964dSMarek Vasut    items:
1073e4f964dSMarek Vasut      items:
1083e4f964dSMarek Vasut        - description: format Default(0), I2S(1) or PDM(2)
1093e4f964dSMarek Vasut          enum: [0, 1, 2]
1103e4f964dSMarek Vasut        - description: dataline mask for 'rx'
1113e4f964dSMarek Vasut        - description: dataline mask for 'tx'
1123e4f964dSMarek Vasut
1133e4f964dSMarek Vasut  fsl,sai-mclk-direction-output:
1143e4f964dSMarek Vasut    description: SAI will output the SAI MCLK clock.
1153e4f964dSMarek Vasut    type: boolean
1163e4f964dSMarek Vasut
117d5633368SShengjiu Wang  fsl,sai-synchronous-rx:
118d5633368SShengjiu Wang    description: |
119d5633368SShengjiu Wang      SAI will work in the synchronous mode (sync Tx with Rx) which means
120d5633368SShengjiu Wang      both the transmitter and the receiver will send and receive data by
121d5633368SShengjiu Wang      following receiver's bit clocks and frame sync clocks.
122d5633368SShengjiu Wang    type: boolean
123d5633368SShengjiu Wang
124d5633368SShengjiu Wang  fsl,sai-asynchronous:
125d5633368SShengjiu Wang    description: |
126d5633368SShengjiu Wang      SAI will work in the asynchronous mode, which means both transmitter
127d5633368SShengjiu Wang      and receiver will send and receive data by following their own bit clocks
128d5633368SShengjiu Wang      and frame sync clocks separately.
129d5633368SShengjiu Wang      If both fsl,sai-asynchronous and fsl,sai-synchronous-rx are absent, the
130d5633368SShengjiu Wang      default synchronous mode (sync Rx with Tx) will be used, which means both
131d5633368SShengjiu Wang      transmitter and receiver will send and receive data by following clocks
132d5633368SShengjiu Wang      of transmitter.
133d5633368SShengjiu Wang    type: boolean
134d5633368SShengjiu Wang
135d5633368SShengjiu Wang  fsl,shared-interrupt:
136d5633368SShengjiu Wang    description: Interrupt is shared with other modules.
137d5633368SShengjiu Wang    type: boolean
138d5633368SShengjiu Wang
1393e4f964dSMarek Vasut  lsb-first:
1403e4f964dSMarek Vasut    description: |
1413e4f964dSMarek Vasut      Configures whether the LSB or the MSB is transmitted
1423e4f964dSMarek Vasut      first for the fifo data. If this property is absent,
1433e4f964dSMarek Vasut      the MSB is transmitted first as default, or the LSB
1443e4f964dSMarek Vasut      is transmitted first.
1453e4f964dSMarek Vasut    type: boolean
1463e4f964dSMarek Vasut
147d5633368SShengjiu Wang  "#sound-dai-cells":
148d5633368SShengjiu Wang    const: 0
149d5633368SShengjiu Wang    description: optional, some dts node didn't add it.
150d5633368SShengjiu Wang
151d5633368SShengjiu WangallOf:
15258ae9a2aSKrzysztof Kozlowski  - $ref: dai-common.yaml#
153d5633368SShengjiu Wang  - if:
154d5633368SShengjiu Wang      required:
155d5633368SShengjiu Wang        - fsl,sai-asynchronous
156d5633368SShengjiu Wang    then:
157d5633368SShengjiu Wang      properties:
158d5633368SShengjiu Wang        fsl,sai-synchronous-rx: false
159d5633368SShengjiu Wang
160d5633368SShengjiu Wangrequired:
161d5633368SShengjiu Wang  - compatible
162d5633368SShengjiu Wang  - reg
163d5633368SShengjiu Wang  - clocks
164d5633368SShengjiu Wang  - clock-names
1653e4f964dSMarek Vasut  - dmas
1663e4f964dSMarek Vasut  - dma-names
1673e4f964dSMarek Vasut  - interrupts
168d5633368SShengjiu Wang
16958ae9a2aSKrzysztof KozlowskiunevaluatedProperties: false
170d5633368SShengjiu Wang
171d5633368SShengjiu Wangexamples:
172d5633368SShengjiu Wang  - |
173d5633368SShengjiu Wang    #include <dt-bindings/interrupt-controller/arm-gic.h>
174d5633368SShengjiu Wang    #include <dt-bindings/clock/vf610-clock.h>
175d5633368SShengjiu Wang    sai2: sai@40031000 {
176d5633368SShengjiu Wang        compatible = "fsl,vf610-sai";
177d5633368SShengjiu Wang        reg = <0x40031000 0x1000>;
178d5633368SShengjiu Wang        interrupts = <86 IRQ_TYPE_LEVEL_HIGH>;
179d5633368SShengjiu Wang        pinctrl-names = "default";
180d5633368SShengjiu Wang        pinctrl-0 = <&pinctrl_sai2_1>;
181d5633368SShengjiu Wang        clocks = <&clks VF610_CLK_PLATFORM_BUS>,
182d5633368SShengjiu Wang                 <&clks VF610_CLK_SAI2>,
183d5633368SShengjiu Wang                 <&clks 0>, <&clks 0>;
184d5633368SShengjiu Wang        clock-names = "bus", "mclk1", "mclk2", "mclk3";
18521d64f6fSMarek Vasut        dma-names = "rx", "tx";
18621d64f6fSMarek Vasut        dmas = <&edma0 0 20>, <&edma0 0 21>;
187d5633368SShengjiu Wang        big-endian;
188d5633368SShengjiu Wang        lsb-first;
189d5633368SShengjiu Wang    };
190d5633368SShengjiu Wang
191d5633368SShengjiu Wang  - |
192d5633368SShengjiu Wang    #include <dt-bindings/interrupt-controller/arm-gic.h>
193d5633368SShengjiu Wang    #include <dt-bindings/clock/imx8mm-clock.h>
194d5633368SShengjiu Wang    sai1: sai@30010000 {
195d5633368SShengjiu Wang        compatible = "fsl,imx8mm-sai", "fsl,imx8mq-sai";
196d5633368SShengjiu Wang        reg = <0x30010000 0x10000>;
197d5633368SShengjiu Wang        interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
198d5633368SShengjiu Wang        clocks = <&clk IMX8MM_CLK_SAI1_IPG>,
199d5633368SShengjiu Wang                 <&clk IMX8MM_CLK_DUMMY>,
200d5633368SShengjiu Wang                 <&clk IMX8MM_CLK_SAI1_ROOT>,
201d5633368SShengjiu Wang                 <&clk IMX8MM_CLK_DUMMY>, <&clk IMX8MM_CLK_DUMMY>;
202d5633368SShengjiu Wang        clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
203d5633368SShengjiu Wang        dmas = <&sdma2 0 2 0>, <&sdma2 1 2 0>;
204d5633368SShengjiu Wang        dma-names = "rx", "tx";
205d5633368SShengjiu Wang        fsl,dataline = <1 0xff 0xff 2 0xff 0x11>;
206d5633368SShengjiu Wang        #sound-dai-cells = <0>;
207d5633368SShengjiu Wang    };
208