xref: /freebsd/sys/contrib/device-tree/Bindings/sound/st,stm32-sai.yaml (revision 8cc087a1eee9ec1ca9f7ac1e63ad51bdb5a682eb)
15def4c47SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
25def4c47SEmmanuel Vadot%YAML 1.2
35def4c47SEmmanuel Vadot---
45def4c47SEmmanuel Vadot$id: http://devicetree.org/schemas/sound/st,stm32-sai.yaml#
55def4c47SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
65def4c47SEmmanuel Vadot
75def4c47SEmmanuel Vadottitle: STMicroelectronics STM32 Serial Audio Interface (SAI)
85def4c47SEmmanuel Vadot
95def4c47SEmmanuel Vadotmaintainers:
10*8cc087a1SEmmanuel Vadot  - Olivier Moysan <olivier.moysan@foss.st.com>
115def4c47SEmmanuel Vadot
125def4c47SEmmanuel Vadotdescription:
135def4c47SEmmanuel Vadot  The SAI interface (Serial Audio Interface) offers a wide set of audio
145def4c47SEmmanuel Vadot  protocols as I2S standards, LSB or MSB-justified, PCM/DSP, TDM, and AC'97.
155def4c47SEmmanuel Vadot  The SAI contains two independent audio sub-blocks. Each sub-block has
165def4c47SEmmanuel Vadot  its own clock generator and I/O lines controller.
175def4c47SEmmanuel Vadot
185def4c47SEmmanuel Vadotproperties:
195def4c47SEmmanuel Vadot  compatible:
205def4c47SEmmanuel Vadot    enum:
215def4c47SEmmanuel Vadot      - st,stm32f4-sai
225def4c47SEmmanuel Vadot      - st,stm32h7-sai
235def4c47SEmmanuel Vadot
245def4c47SEmmanuel Vadot  reg:
255def4c47SEmmanuel Vadot    items:
265def4c47SEmmanuel Vadot      - description: Base address and size of SAI common register set.
275def4c47SEmmanuel Vadot      - description: Base address and size of SAI identification register set.
285def4c47SEmmanuel Vadot    minItems: 1
295def4c47SEmmanuel Vadot
305def4c47SEmmanuel Vadot  ranges:
315def4c47SEmmanuel Vadot    maxItems: 1
325def4c47SEmmanuel Vadot
335def4c47SEmmanuel Vadot  interrupts:
345def4c47SEmmanuel Vadot    maxItems: 1
355def4c47SEmmanuel Vadot
365def4c47SEmmanuel Vadot  resets:
375def4c47SEmmanuel Vadot    maxItems: 1
385def4c47SEmmanuel Vadot
395def4c47SEmmanuel Vadot  "#address-cells":
405def4c47SEmmanuel Vadot    const: 1
415def4c47SEmmanuel Vadot
425def4c47SEmmanuel Vadot  "#size-cells":
435def4c47SEmmanuel Vadot    const: 1
445def4c47SEmmanuel Vadot
455def4c47SEmmanuel Vadot  clocks:
465def4c47SEmmanuel Vadot    maxItems: 3
475def4c47SEmmanuel Vadot
485def4c47SEmmanuel Vadot  clock-names:
495def4c47SEmmanuel Vadot    maxItems: 3
505def4c47SEmmanuel Vadot
515def4c47SEmmanuel Vadotrequired:
525def4c47SEmmanuel Vadot  - compatible
535def4c47SEmmanuel Vadot  - reg
545def4c47SEmmanuel Vadot  - ranges
555def4c47SEmmanuel Vadot  - "#address-cells"
565def4c47SEmmanuel Vadot  - "#size-cells"
575def4c47SEmmanuel Vadot  - clocks
585def4c47SEmmanuel Vadot  - clock-names
595def4c47SEmmanuel Vadot
605def4c47SEmmanuel VadotpatternProperties:
615def4c47SEmmanuel Vadot  "^audio-controller@[0-9a-f]+$":
625def4c47SEmmanuel Vadot    type: object
635def4c47SEmmanuel Vadot    description:
645def4c47SEmmanuel Vadot      Two subnodes corresponding to SAI sub-block instances A et B
655def4c47SEmmanuel Vadot      can be defined. Subnode can be omitted for unsused sub-block.
665def4c47SEmmanuel Vadot
675def4c47SEmmanuel Vadot    properties:
685def4c47SEmmanuel Vadot      compatible:
695def4c47SEmmanuel Vadot        description: Compatible for SAI sub-block A or B.
705def4c47SEmmanuel Vadot        pattern: "st,stm32-sai-sub-[ab]"
715def4c47SEmmanuel Vadot
725def4c47SEmmanuel Vadot      "#sound-dai-cells":
735def4c47SEmmanuel Vadot        const: 0
745def4c47SEmmanuel Vadot
755def4c47SEmmanuel Vadot      reg:
765def4c47SEmmanuel Vadot        maxItems: 1
775def4c47SEmmanuel Vadot
785def4c47SEmmanuel Vadot      clocks:
795def4c47SEmmanuel Vadot        items:
805def4c47SEmmanuel Vadot          - description: sai_ck clock feeding the internal clock generator.
815def4c47SEmmanuel Vadot          - description: MCLK clock from a SAI set as master clock provider.
825def4c47SEmmanuel Vadot        minItems: 1
835def4c47SEmmanuel Vadot
845def4c47SEmmanuel Vadot      clock-names:
855def4c47SEmmanuel Vadot        items:
865def4c47SEmmanuel Vadot          - const: sai_ck
875def4c47SEmmanuel Vadot          - const: MCLK
885def4c47SEmmanuel Vadot        minItems: 1
895def4c47SEmmanuel Vadot
905def4c47SEmmanuel Vadot      dmas:
915def4c47SEmmanuel Vadot        maxItems: 1
925def4c47SEmmanuel Vadot
935def4c47SEmmanuel Vadot      dma-names:
945def4c47SEmmanuel Vadot        description: |
955def4c47SEmmanuel Vadot          rx: SAI sub-block is configured as a capture DAI.
965def4c47SEmmanuel Vadot          tx: SAI sub-block is configured as a playback DAI.
975def4c47SEmmanuel Vadot        enum: [ rx, tx ]
985def4c47SEmmanuel Vadot
995def4c47SEmmanuel Vadot      st,sync:
1005def4c47SEmmanuel Vadot        description:
1015def4c47SEmmanuel Vadot          Configure the SAI sub-block as slave of another SAI sub-block.
1025def4c47SEmmanuel Vadot          By default SAI sub-block is in asynchronous mode.
1035def4c47SEmmanuel Vadot          Must contain the phandle and index of the SAI sub-block providing
1045def4c47SEmmanuel Vadot          the synchronization.
1055def4c47SEmmanuel Vadot        allOf:
1065def4c47SEmmanuel Vadot          - $ref: /schemas/types.yaml#/definitions/phandle-array
1075def4c47SEmmanuel Vadot          - maxItems: 1
1085def4c47SEmmanuel Vadot
1095def4c47SEmmanuel Vadot      st,iec60958:
1105def4c47SEmmanuel Vadot        description:
1115def4c47SEmmanuel Vadot          If set, support S/PDIF IEC6958 protocol for playback.
1125def4c47SEmmanuel Vadot          IEC60958 protocol is not available for capture.
1135def4c47SEmmanuel Vadot          By default, custom protocol is assumed, meaning that protocol is
1145def4c47SEmmanuel Vadot          configured according to protocol defined in related DAI link node,
1155def4c47SEmmanuel Vadot          such as i2s, left justified, right justified, dsp and pdm protocols.
1165def4c47SEmmanuel Vadot        allOf:
1175def4c47SEmmanuel Vadot          - $ref: /schemas/types.yaml#/definitions/flag
1185def4c47SEmmanuel Vadot
1195def4c47SEmmanuel Vadot      "#clock-cells":
1205def4c47SEmmanuel Vadot        description: Configure the SAI device as master clock provider.
1215def4c47SEmmanuel Vadot        const: 0
1225def4c47SEmmanuel Vadot
1235def4c47SEmmanuel Vadot    required:
1245def4c47SEmmanuel Vadot      - compatible
1255def4c47SEmmanuel Vadot      - "#sound-dai-cells"
1265def4c47SEmmanuel Vadot      - reg
1275def4c47SEmmanuel Vadot      - clocks
1285def4c47SEmmanuel Vadot      - clock-names
1295def4c47SEmmanuel Vadot      - dmas
1305def4c47SEmmanuel Vadot      - dma-names
1315def4c47SEmmanuel Vadot
1325def4c47SEmmanuel VadotallOf:
1335def4c47SEmmanuel Vadot  - if:
1345def4c47SEmmanuel Vadot      properties:
1355def4c47SEmmanuel Vadot        compatible:
1365def4c47SEmmanuel Vadot          contains:
1375def4c47SEmmanuel Vadot            const: st,stm32f4-sai
1385def4c47SEmmanuel Vadot
1395def4c47SEmmanuel Vadot  - then:
1405def4c47SEmmanuel Vadot      properties:
1415def4c47SEmmanuel Vadot        clocks:
1425def4c47SEmmanuel Vadot          items:
1435def4c47SEmmanuel Vadot            - description: x8k, SAI parent clock for sampling rates multiple of 8kHz.
1445def4c47SEmmanuel Vadot            - description: x11k, SAI parent clock for sampling rates multiple of 11.025kHz.
1455def4c47SEmmanuel Vadot
1465def4c47SEmmanuel Vadot        clock-names:
1475def4c47SEmmanuel Vadot          items:
1485def4c47SEmmanuel Vadot            - const: x8k
1495def4c47SEmmanuel Vadot            - const: x11k
1505def4c47SEmmanuel Vadot
1515def4c47SEmmanuel Vadot  - else:
1525def4c47SEmmanuel Vadot      properties:
1535def4c47SEmmanuel Vadot        clocks:
1545def4c47SEmmanuel Vadot          items:
1555def4c47SEmmanuel Vadot            - description: pclk feeds the peripheral bus interface.
1565def4c47SEmmanuel Vadot            - description: x8k, SAI parent clock for sampling rates multiple of 8kHz.
1575def4c47SEmmanuel Vadot            - description: x11k, SAI parent clock for sampling rates multiple of 11.025kHz.
1585def4c47SEmmanuel Vadot
1595def4c47SEmmanuel Vadot        clock-names:
1605def4c47SEmmanuel Vadot          items:
1615def4c47SEmmanuel Vadot            - const: pclk
1625def4c47SEmmanuel Vadot            - const: x8k
1635def4c47SEmmanuel Vadot            - const: x11k
1645def4c47SEmmanuel Vadot
1655def4c47SEmmanuel VadotadditionalProperties: false
1665def4c47SEmmanuel Vadot
1675def4c47SEmmanuel Vadotexamples:
1685def4c47SEmmanuel Vadot  - |
1695def4c47SEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
1705def4c47SEmmanuel Vadot    #include <dt-bindings/clock/stm32mp1-clks.h>
1715def4c47SEmmanuel Vadot    #include <dt-bindings/reset/stm32mp1-resets.h>
1725def4c47SEmmanuel Vadot    sai2: sai@4400b000 {
1735def4c47SEmmanuel Vadot      compatible = "st,stm32h7-sai";
1745def4c47SEmmanuel Vadot      #address-cells = <1>;
1755def4c47SEmmanuel Vadot      #size-cells = <1>;
1765def4c47SEmmanuel Vadot      ranges = <0 0x4400b000 0x400>;
1775def4c47SEmmanuel Vadot      reg = <0x4400b000 0x4>, <0x4400b3f0 0x10>;
1785def4c47SEmmanuel Vadot      clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
1795def4c47SEmmanuel Vadot      clock-names = "pclk", "x8k", "x11k";
1805def4c47SEmmanuel Vadot      pinctrl-names = "default", "sleep";
1815def4c47SEmmanuel Vadot      pinctrl-0 = <&sai2a_pins_a>, <&sai2b_pins_b>;
1825def4c47SEmmanuel Vadot      pinctrl-1 = <&sai2a_sleep_pins_a>, <&sai2b_sleep_pins_b>;
1835def4c47SEmmanuel Vadot
1845def4c47SEmmanuel Vadot      sai2a: audio-controller@4400b004 {
1855def4c47SEmmanuel Vadot        #sound-dai-cells = <0>;
1865def4c47SEmmanuel Vadot        compatible = "st,stm32-sai-sub-a";
1875def4c47SEmmanuel Vadot        reg = <0x4 0x1c>;
1885def4c47SEmmanuel Vadot        dmas = <&dmamux1 89 0x400 0x01>;
1895def4c47SEmmanuel Vadot        dma-names = "tx";
1905def4c47SEmmanuel Vadot        clocks = <&rcc SAI2_K>;
1915def4c47SEmmanuel Vadot        clock-names = "sai_ck";
1925def4c47SEmmanuel Vadot      };
1935def4c47SEmmanuel Vadot    };
1945def4c47SEmmanuel Vadot
1955def4c47SEmmanuel Vadot...
196