xref: /freebsd/sys/contrib/device-tree/Bindings/sound/fsl,sai.yaml (revision cb7aa33ac6cd46a5434798e50363136e64f3ae98)
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
428bab661aSEmmanuel Vadot              - fsl,vf610-sai
438bab661aSEmmanuel Vadot
447ef62cebSEmmanuel Vadot  reg:
457ef62cebSEmmanuel Vadot    maxItems: 1
467ef62cebSEmmanuel Vadot
477ef62cebSEmmanuel Vadot  clocks:
487ef62cebSEmmanuel Vadot    items:
497ef62cebSEmmanuel Vadot      - description: The ipg clock for register access
507ef62cebSEmmanuel Vadot      - description: master clock source 0 (obsoleted)
517ef62cebSEmmanuel Vadot      - description: master clock source 1
527ef62cebSEmmanuel Vadot      - description: master clock source 2
537ef62cebSEmmanuel Vadot      - description: master clock source 3
547ef62cebSEmmanuel Vadot      - description: PLL clock source for 8kHz series
557ef62cebSEmmanuel Vadot      - description: PLL clock source for 11kHz series
567ef62cebSEmmanuel Vadot    minItems: 4
577ef62cebSEmmanuel Vadot
587ef62cebSEmmanuel Vadot  clock-names:
597ef62cebSEmmanuel Vadot    oneOf:
607ef62cebSEmmanuel Vadot      - items:
617ef62cebSEmmanuel Vadot          - const: bus
627ef62cebSEmmanuel Vadot          - const: mclk0
637ef62cebSEmmanuel Vadot          - const: mclk1
647ef62cebSEmmanuel Vadot          - const: mclk2
657ef62cebSEmmanuel Vadot          - const: mclk3
667ef62cebSEmmanuel Vadot          - const: pll8k
677ef62cebSEmmanuel Vadot          - const: pll11k
688bab661aSEmmanuel Vadot        minItems: 5
697ef62cebSEmmanuel Vadot      - items:
707ef62cebSEmmanuel Vadot          - const: bus
717ef62cebSEmmanuel Vadot          - const: mclk1
727ef62cebSEmmanuel Vadot          - const: mclk2
737ef62cebSEmmanuel Vadot          - const: mclk3
747ef62cebSEmmanuel Vadot          - const: pll8k
757ef62cebSEmmanuel Vadot          - const: pll11k
767ef62cebSEmmanuel Vadot        minItems: 4
777ef62cebSEmmanuel Vadot
788bab661aSEmmanuel Vadot  dmas:
79*cb7aa33aSEmmanuel Vadot    items:
80*cb7aa33aSEmmanuel Vadot      - description: DMA controller phandle and request line for RX
81*cb7aa33aSEmmanuel Vadot      - description: DMA controller phandle and request line for TX
828bab661aSEmmanuel Vadot
838bab661aSEmmanuel Vadot  dma-names:
84*cb7aa33aSEmmanuel Vadot    items:
85*cb7aa33aSEmmanuel Vadot      - const: rx
86*cb7aa33aSEmmanuel Vadot      - const: tx
878bab661aSEmmanuel Vadot
888bab661aSEmmanuel Vadot  interrupts:
898bab661aSEmmanuel Vadot    items:
908bab661aSEmmanuel Vadot      - description: receive and transmit interrupt
917ef62cebSEmmanuel Vadot
927ef62cebSEmmanuel Vadot  big-endian:
937ef62cebSEmmanuel Vadot    description: |
947ef62cebSEmmanuel Vadot      required if all the SAI registers are big-endian rather than little-endian.
957ef62cebSEmmanuel Vadot    type: boolean
967ef62cebSEmmanuel Vadot
978bab661aSEmmanuel Vadot  fsl,dataline:
988bab661aSEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/uint32-matrix
998bab661aSEmmanuel Vadot    description: |
1008bab661aSEmmanuel Vadot      Configure the dataline. It has 3 value for each configuration
1018bab661aSEmmanuel Vadot    maxItems: 16
1028bab661aSEmmanuel Vadot    items:
1038bab661aSEmmanuel Vadot      items:
1048bab661aSEmmanuel Vadot        - description: format Default(0), I2S(1) or PDM(2)
1058bab661aSEmmanuel Vadot          enum: [0, 1, 2]
1068bab661aSEmmanuel Vadot        - description: dataline mask for 'rx'
1078bab661aSEmmanuel Vadot        - description: dataline mask for 'tx'
1088bab661aSEmmanuel Vadot
1098bab661aSEmmanuel Vadot  fsl,sai-mclk-direction-output:
1108bab661aSEmmanuel Vadot    description: SAI will output the SAI MCLK clock.
1118bab661aSEmmanuel Vadot    type: boolean
1128bab661aSEmmanuel Vadot
1137ef62cebSEmmanuel Vadot  fsl,sai-synchronous-rx:
1147ef62cebSEmmanuel Vadot    description: |
1157ef62cebSEmmanuel Vadot      SAI will work in the synchronous mode (sync Tx with Rx) which means
1167ef62cebSEmmanuel Vadot      both the transmitter and the receiver will send and receive data by
1177ef62cebSEmmanuel Vadot      following receiver's bit clocks and frame sync clocks.
1187ef62cebSEmmanuel Vadot    type: boolean
1197ef62cebSEmmanuel Vadot
1207ef62cebSEmmanuel Vadot  fsl,sai-asynchronous:
1217ef62cebSEmmanuel Vadot    description: |
1227ef62cebSEmmanuel Vadot      SAI will work in the asynchronous mode, which means both transmitter
1237ef62cebSEmmanuel Vadot      and receiver will send and receive data by following their own bit clocks
1247ef62cebSEmmanuel Vadot      and frame sync clocks separately.
1257ef62cebSEmmanuel Vadot      If both fsl,sai-asynchronous and fsl,sai-synchronous-rx are absent, the
1267ef62cebSEmmanuel Vadot      default synchronous mode (sync Rx with Tx) will be used, which means both
1277ef62cebSEmmanuel Vadot      transmitter and receiver will send and receive data by following clocks
1287ef62cebSEmmanuel Vadot      of transmitter.
1297ef62cebSEmmanuel Vadot    type: boolean
1307ef62cebSEmmanuel Vadot
1317ef62cebSEmmanuel Vadot  fsl,shared-interrupt:
1327ef62cebSEmmanuel Vadot    description: Interrupt is shared with other modules.
1337ef62cebSEmmanuel Vadot    type: boolean
1347ef62cebSEmmanuel Vadot
1358bab661aSEmmanuel Vadot  lsb-first:
1368bab661aSEmmanuel Vadot    description: |
1378bab661aSEmmanuel Vadot      Configures whether the LSB or the MSB is transmitted
1388bab661aSEmmanuel Vadot      first for the fifo data. If this property is absent,
1398bab661aSEmmanuel Vadot      the MSB is transmitted first as default, or the LSB
1408bab661aSEmmanuel Vadot      is transmitted first.
1418bab661aSEmmanuel Vadot    type: boolean
1428bab661aSEmmanuel Vadot
1437ef62cebSEmmanuel Vadot  "#sound-dai-cells":
1447ef62cebSEmmanuel Vadot    const: 0
1457ef62cebSEmmanuel Vadot    description: optional, some dts node didn't add it.
1467ef62cebSEmmanuel Vadot
1477ef62cebSEmmanuel VadotallOf:
1488bab661aSEmmanuel Vadot  - $ref: dai-common.yaml#
1497ef62cebSEmmanuel Vadot  - if:
1507ef62cebSEmmanuel Vadot      required:
1517ef62cebSEmmanuel Vadot        - fsl,sai-asynchronous
1527ef62cebSEmmanuel Vadot    then:
1537ef62cebSEmmanuel Vadot      properties:
1547ef62cebSEmmanuel Vadot        fsl,sai-synchronous-rx: false
1557ef62cebSEmmanuel Vadot
1567ef62cebSEmmanuel Vadotrequired:
1577ef62cebSEmmanuel Vadot  - compatible
1587ef62cebSEmmanuel Vadot  - reg
1597ef62cebSEmmanuel Vadot  - clocks
1607ef62cebSEmmanuel Vadot  - clock-names
1618bab661aSEmmanuel Vadot  - dmas
1628bab661aSEmmanuel Vadot  - dma-names
1638bab661aSEmmanuel Vadot  - interrupts
1647ef62cebSEmmanuel Vadot
1658bab661aSEmmanuel VadotunevaluatedProperties: false
1667ef62cebSEmmanuel Vadot
1677ef62cebSEmmanuel Vadotexamples:
1687ef62cebSEmmanuel Vadot  - |
1697ef62cebSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
1707ef62cebSEmmanuel Vadot    #include <dt-bindings/clock/vf610-clock.h>
1717ef62cebSEmmanuel Vadot    sai2: sai@40031000 {
1727ef62cebSEmmanuel Vadot        compatible = "fsl,vf610-sai";
1737ef62cebSEmmanuel Vadot        reg = <0x40031000 0x1000>;
1747ef62cebSEmmanuel Vadot        interrupts = <86 IRQ_TYPE_LEVEL_HIGH>;
1757ef62cebSEmmanuel Vadot        pinctrl-names = "default";
1767ef62cebSEmmanuel Vadot        pinctrl-0 = <&pinctrl_sai2_1>;
1777ef62cebSEmmanuel Vadot        clocks = <&clks VF610_CLK_PLATFORM_BUS>,
1787ef62cebSEmmanuel Vadot                 <&clks VF610_CLK_SAI2>,
1797ef62cebSEmmanuel Vadot                 <&clks 0>, <&clks 0>;
1807ef62cebSEmmanuel Vadot        clock-names = "bus", "mclk1", "mclk2", "mclk3";
181*cb7aa33aSEmmanuel Vadot        dma-names = "rx", "tx";
182*cb7aa33aSEmmanuel Vadot        dmas = <&edma0 0 20>, <&edma0 0 21>;
1837ef62cebSEmmanuel Vadot        big-endian;
1847ef62cebSEmmanuel Vadot        lsb-first;
1857ef62cebSEmmanuel Vadot    };
1867ef62cebSEmmanuel Vadot
1877ef62cebSEmmanuel Vadot  - |
1887ef62cebSEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
1897ef62cebSEmmanuel Vadot    #include <dt-bindings/clock/imx8mm-clock.h>
1907ef62cebSEmmanuel Vadot    sai1: sai@30010000 {
1917ef62cebSEmmanuel Vadot        compatible = "fsl,imx8mm-sai", "fsl,imx8mq-sai";
1927ef62cebSEmmanuel Vadot        reg = <0x30010000 0x10000>;
1937ef62cebSEmmanuel Vadot        interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_HIGH>;
1947ef62cebSEmmanuel Vadot        clocks = <&clk IMX8MM_CLK_SAI1_IPG>,
1957ef62cebSEmmanuel Vadot                 <&clk IMX8MM_CLK_DUMMY>,
1967ef62cebSEmmanuel Vadot                 <&clk IMX8MM_CLK_SAI1_ROOT>,
1977ef62cebSEmmanuel Vadot                 <&clk IMX8MM_CLK_DUMMY>, <&clk IMX8MM_CLK_DUMMY>;
1987ef62cebSEmmanuel Vadot        clock-names = "bus", "mclk0", "mclk1", "mclk2", "mclk3";
1997ef62cebSEmmanuel Vadot        dmas = <&sdma2 0 2 0>, <&sdma2 1 2 0>;
2007ef62cebSEmmanuel Vadot        dma-names = "rx", "tx";
2017ef62cebSEmmanuel Vadot        fsl,dataline = <1 0xff 0xff 2 0xff 0x11>;
2027ef62cebSEmmanuel Vadot        #sound-dai-cells = <0>;
2037ef62cebSEmmanuel Vadot    };
204