xref: /freebsd-src/sys/contrib/device-tree/Bindings/sound/fsl,sai.yaml (revision 7d0873ebb83b19ba1e8a89e679470d885efe12e3)
17ef62cebSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
27ef62cebSEmmanuel Vadot%YAML 1.2
37ef62cebSEmmanuel Vadot---
47ef62cebSEmmanuel Vadot$id: http://devicetree.org/schemas/sound/fsl,sai.yaml#
57ef62cebSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
67ef62cebSEmmanuel Vadot
77ef62cebSEmmanuel Vadottitle: Freescale Synchronous Audio Interface (SAI).
87ef62cebSEmmanuel Vadot
97ef62cebSEmmanuel Vadotmaintainers:
107ef62cebSEmmanuel Vadot  - Shengjiu Wang <shengjiu.wang@nxp.com>
117ef62cebSEmmanuel Vadot
127ef62cebSEmmanuel Vadotdescription: |
137ef62cebSEmmanuel Vadot  The SAI is based on I2S module that used communicating with audio codecs,
147ef62cebSEmmanuel Vadot  which provides a synchronous audio interface that supports fullduplex
157ef62cebSEmmanuel Vadot  serial interfaces with frame synchronization such as I2S, AC97, TDM, and
167ef62cebSEmmanuel Vadot  codec/DSP interfaces.
177ef62cebSEmmanuel Vadot
187ef62cebSEmmanuel Vadotproperties:
197ef62cebSEmmanuel Vadot  compatible:
207ef62cebSEmmanuel Vadot    oneOf:
218bab661aSEmmanuel Vadot      - items:
227ef62cebSEmmanuel Vadot          - enum:
237ef62cebSEmmanuel Vadot              - fsl,imx6ul-sai
248bab661aSEmmanuel Vadot              - fsl,imx7d-sai
258bab661aSEmmanuel Vadot          - const: fsl,imx6sx-sai
268bab661aSEmmanuel Vadot
277ef62cebSEmmanuel Vadot      - items:
287ef62cebSEmmanuel Vadot          - enum:
297ef62cebSEmmanuel Vadot              - fsl,imx8mm-sai
307ef62cebSEmmanuel Vadot              - fsl,imx8mn-sai
317ef62cebSEmmanuel Vadot              - fsl,imx8mp-sai
327ef62cebSEmmanuel Vadot          - const: fsl,imx8mq-sai
337ef62cebSEmmanuel Vadot
348bab661aSEmmanuel Vadot      - items:
358bab661aSEmmanuel Vadot          - enum:
368bab661aSEmmanuel Vadot              - fsl,imx6sx-sai
378bab661aSEmmanuel Vadot              - fsl,imx7ulp-sai
388bab661aSEmmanuel Vadot              - fsl,imx8mq-sai
398bab661aSEmmanuel Vadot              - fsl,imx8qm-sai
408bab661aSEmmanuel Vadot              - fsl,imx8ulp-sai
418bab661aSEmmanuel Vadot              - fsl,imx93-sai
4201950c46SEmmanuel Vadot              - fsl,imx95-sai
438bab661aSEmmanuel Vadot              - fsl,vf610-sai
448bab661aSEmmanuel Vadot
457ef62cebSEmmanuel Vadot  reg:
467ef62cebSEmmanuel Vadot    maxItems: 1
477ef62cebSEmmanuel Vadot
487ef62cebSEmmanuel Vadot  clocks:
497ef62cebSEmmanuel Vadot    items:
507ef62cebSEmmanuel Vadot      - description: The ipg clock for register access
517ef62cebSEmmanuel Vadot      - description: master clock source 0 (obsoleted)
527ef62cebSEmmanuel Vadot      - description: master clock source 1
537ef62cebSEmmanuel Vadot      - description: master clock source 2
547ef62cebSEmmanuel Vadot      - description: master clock source 3
557ef62cebSEmmanuel Vadot      - description: PLL clock source for 8kHz series
567ef62cebSEmmanuel Vadot      - description: PLL clock source for 11kHz series
577ef62cebSEmmanuel Vadot    minItems: 4
587ef62cebSEmmanuel Vadot
597ef62cebSEmmanuel Vadot  clock-names:
607ef62cebSEmmanuel Vadot    oneOf:
617ef62cebSEmmanuel Vadot      - items:
627ef62cebSEmmanuel Vadot          - const: bus
637ef62cebSEmmanuel Vadot          - const: mclk0
647ef62cebSEmmanuel Vadot          - const: mclk1
657ef62cebSEmmanuel Vadot          - const: mclk2
667ef62cebSEmmanuel Vadot          - const: mclk3
677ef62cebSEmmanuel Vadot          - const: pll8k
687ef62cebSEmmanuel Vadot          - const: pll11k
698bab661aSEmmanuel Vadot        minItems: 5
707ef62cebSEmmanuel Vadot      - items:
717ef62cebSEmmanuel Vadot          - const: bus
727ef62cebSEmmanuel Vadot          - const: mclk1
737ef62cebSEmmanuel Vadot          - const: mclk2
747ef62cebSEmmanuel Vadot          - const: mclk3
757ef62cebSEmmanuel Vadot          - const: pll8k
767ef62cebSEmmanuel Vadot          - const: pll11k
777ef62cebSEmmanuel Vadot        minItems: 4
787ef62cebSEmmanuel Vadot
7901950c46SEmmanuel Vadot  power-domains:
8001950c46SEmmanuel Vadot    maxItems: 1
8101950c46SEmmanuel Vadot
828bab661aSEmmanuel Vadot  dmas:
8301950c46SEmmanuel Vadot    minItems: 1
84*7d0873ebSEmmanuel Vadot    maxItems: 2
858bab661aSEmmanuel Vadot
868bab661aSEmmanuel Vadot  dma-names:
8701950c46SEmmanuel Vadot    minItems: 1
88cb7aa33aSEmmanuel Vadot    items:
89*7d0873ebSEmmanuel Vadot      - enum: [ rx, tx ]
90cb7aa33aSEmmanuel Vadot      - const: tx
918bab661aSEmmanuel Vadot
928bab661aSEmmanuel Vadot  interrupts:
938bab661aSEmmanuel Vadot    items:
948bab661aSEmmanuel Vadot      - description: receive and transmit interrupt
957ef62cebSEmmanuel Vadot
967ef62cebSEmmanuel Vadot  big-endian:
977ef62cebSEmmanuel Vadot    description: |
987ef62cebSEmmanuel Vadot      required if all the SAI registers are big-endian rather than little-endian.
997ef62cebSEmmanuel Vadot    type: boolean
1007ef62cebSEmmanuel Vadot
1018bab661aSEmmanuel Vadot  fsl,dataline:
1028bab661aSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32-matrix
1038bab661aSEmmanuel Vadot    description: |
1048bab661aSEmmanuel Vadot      Configure the dataline. It has 3 value for each configuration
1058bab661aSEmmanuel Vadot    maxItems: 16
1068bab661aSEmmanuel Vadot    items:
1078bab661aSEmmanuel Vadot      items:
1088bab661aSEmmanuel Vadot        - description: format Default(0), I2S(1) or PDM(2)
1098bab661aSEmmanuel Vadot          enum: [0, 1, 2]
1108bab661aSEmmanuel Vadot        - description: dataline mask for 'rx'
1118bab661aSEmmanuel Vadot        - description: dataline mask for 'tx'
1128bab661aSEmmanuel Vadot
1138bab661aSEmmanuel Vadot  fsl,sai-mclk-direction-output:
1148bab661aSEmmanuel Vadot    description: SAI will output the SAI MCLK clock.
1158bab661aSEmmanuel Vadot    type: boolean
1168bab661aSEmmanuel Vadot
1177ef62cebSEmmanuel Vadot  fsl,sai-synchronous-rx:
1187ef62cebSEmmanuel Vadot    description: |
1197ef62cebSEmmanuel Vadot      SAI will work in the synchronous mode (sync Tx with Rx) which means
1207ef62cebSEmmanuel Vadot      both the transmitter and the receiver will send and receive data by
1217ef62cebSEmmanuel Vadot      following receiver's bit clocks and frame sync clocks.
1227ef62cebSEmmanuel Vadot    type: boolean
1237ef62cebSEmmanuel Vadot
1247ef62cebSEmmanuel Vadot  fsl,sai-asynchronous:
1257ef62cebSEmmanuel Vadot    description: |
1267ef62cebSEmmanuel Vadot      SAI will work in the asynchronous mode, which means both transmitter
1277ef62cebSEmmanuel Vadot      and receiver will send and receive data by following their own bit clocks
1287ef62cebSEmmanuel Vadot      and frame sync clocks separately.
1297ef62cebSEmmanuel Vadot      If both fsl,sai-asynchronous and fsl,sai-synchronous-rx are absent, the
1307ef62cebSEmmanuel Vadot      default synchronous mode (sync Rx with Tx) will be used, which means both
1317ef62cebSEmmanuel Vadot      transmitter and receiver will send and receive data by following clocks
1327ef62cebSEmmanuel Vadot      of transmitter.
1337ef62cebSEmmanuel Vadot    type: boolean
1347ef62cebSEmmanuel Vadot
1357ef62cebSEmmanuel Vadot  fsl,shared-interrupt:
1367ef62cebSEmmanuel Vadot    description: Interrupt is shared with other modules.
1377ef62cebSEmmanuel Vadot    type: boolean
1387ef62cebSEmmanuel Vadot
1398bab661aSEmmanuel Vadot  lsb-first:
1408bab661aSEmmanuel Vadot    description: |
1418bab661aSEmmanuel Vadot      Configures whether the LSB or the MSB is transmitted
1428bab661aSEmmanuel Vadot      first for the fifo data. If this property is absent,
1438bab661aSEmmanuel Vadot      the MSB is transmitted first as default, or the LSB
1448bab661aSEmmanuel Vadot      is transmitted first.
1458bab661aSEmmanuel Vadot    type: boolean
1468bab661aSEmmanuel Vadot
1477ef62cebSEmmanuel Vadot  "#sound-dai-cells":
1487ef62cebSEmmanuel Vadot    const: 0
1497ef62cebSEmmanuel Vadot    description: optional, some dts node didn't add it.
1507ef62cebSEmmanuel Vadot
1517ef62cebSEmmanuel VadotallOf:
1528bab661aSEmmanuel Vadot  - $ref: dai-common.yaml#
1537ef62cebSEmmanuel Vadot  - if:
1547ef62cebSEmmanuel Vadot      required:
1557ef62cebSEmmanuel Vadot        - fsl,sai-asynchronous
1567ef62cebSEmmanuel Vadot    then:
1577ef62cebSEmmanuel Vadot      properties:
1587ef62cebSEmmanuel Vadot        fsl,sai-synchronous-rx: false
1597ef62cebSEmmanuel Vadot
1607ef62cebSEmmanuel Vadotrequired:
1617ef62cebSEmmanuel Vadot  - compatible
1627ef62cebSEmmanuel Vadot  - reg
1637ef62cebSEmmanuel Vadot  - clocks
1647ef62cebSEmmanuel Vadot  - clock-names
1658bab661aSEmmanuel Vadot  - dmas
1668bab661aSEmmanuel Vadot  - dma-names
1678bab661aSEmmanuel Vadot  - interrupts
1687ef62cebSEmmanuel Vadot
1698bab661aSEmmanuel VadotunevaluatedProperties: false
1707ef62cebSEmmanuel Vadot
1717ef62cebSEmmanuel Vadotexamples:
1727ef62cebSEmmanuel Vadot  - |
1737ef62cebSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
1747ef62cebSEmmanuel Vadot    #include <dt-bindings/clock/vf610-clock.h>
1757ef62cebSEmmanuel Vadot    sai2: sai@40031000 {
1767ef62cebSEmmanuel Vadot        compatible = "fsl,vf610-sai";
1777ef62cebSEmmanuel Vadot        reg = <0x40031000 0x1000>;
1787ef62cebSEmmanuel Vadot        interrupts = <86 IRQ_TYPE_LEVEL_HIGH>;
1797ef62cebSEmmanuel Vadot        pinctrl-names = "default";
1807ef62cebSEmmanuel Vadot        pinctrl-0 = <&pinctrl_sai2_1>;
1817ef62cebSEmmanuel Vadot        clocks = <&clks VF610_CLK_PLATFORM_BUS>,
1827ef62cebSEmmanuel Vadot                 <&clks VF610_CLK_SAI2>,
1837ef62cebSEmmanuel Vadot                 <&clks 0>, <&clks 0>;
1847ef62cebSEmmanuel Vadot        clock-names = "bus", "mclk1", "mclk2", "mclk3";
185cb7aa33aSEmmanuel Vadot        dma-names = "rx", "tx";
186cb7aa33aSEmmanuel Vadot        dmas = <&edma0 0 20>, <&edma0 0 21>;
1877ef62cebSEmmanuel Vadot        big-endian;
1887ef62cebSEmmanuel Vadot        lsb-first;
1897ef62cebSEmmanuel Vadot    };
1907ef62cebSEmmanuel Vadot
1917ef62cebSEmmanuel Vadot  - |
1927ef62cebSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
1937ef62cebSEmmanuel Vadot    #include <dt-bindings/clock/imx8mm-clock.h>
1947ef62cebSEmmanuel Vadot    sai1: sai@30010000 {
1957ef62cebSEmmanuel Vadot        compatible = "fsl,imx8mm-sai", "fsl,imx8mq-sai";
1967ef62cebSEmmanuel Vadot        reg = <0x30010000 0x10000>;
1977ef62cebSEmmanuel Vadot        interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
1987ef62cebSEmmanuel Vadot        clocks = <&clk IMX8MM_CLK_SAI1_IPG>,
1997ef62cebSEmmanuel Vadot                 <&clk IMX8MM_CLK_DUMMY>,
2007ef62cebSEmmanuel Vadot                 <&clk IMX8MM_CLK_SAI1_ROOT>,
2017ef62cebSEmmanuel Vadot                 <&clk IMX8MM_CLK_DUMMY>, <&clk IMX8MM_CLK_DUMMY>;
2027ef62cebSEmmanuel Vadot        clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
2037ef62cebSEmmanuel Vadot        dmas = <&sdma2 0 2 0>, <&sdma2 1 2 0>;
2047ef62cebSEmmanuel Vadot        dma-names = "rx", "tx";
2057ef62cebSEmmanuel Vadot        fsl,dataline = <1 0xff 0xff 2 0xff 0x11>;
2067ef62cebSEmmanuel Vadot        #sound-dai-cells = <0>;
2077ef62cebSEmmanuel Vadot    };
208