xref: /freebsd/sys/contrib/device-tree/Bindings/sound/st,stm32-sai.yaml (revision aa1a8ff2d6dbc51ef058f46f3db5a8bb77967145)
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:
108cc087a1SEmmanuel 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
637ef62cebSEmmanuel Vadot    additionalProperties: false
645def4c47SEmmanuel Vadot    description:
655def4c47SEmmanuel Vadot      Two subnodes corresponding to SAI sub-block instances A et B
66*aa1a8ff2SEmmanuel Vadot      can be defined. Subnode can be omitted for unused sub-block.
675def4c47SEmmanuel Vadot
685def4c47SEmmanuel Vadot    properties:
695def4c47SEmmanuel Vadot      compatible:
705def4c47SEmmanuel Vadot        description: Compatible for SAI sub-block A or B.
715def4c47SEmmanuel Vadot        pattern: "st,stm32-sai-sub-[ab]"
725def4c47SEmmanuel Vadot
735def4c47SEmmanuel Vadot      "#sound-dai-cells":
745def4c47SEmmanuel Vadot        const: 0
755def4c47SEmmanuel Vadot
765def4c47SEmmanuel Vadot      reg:
775def4c47SEmmanuel Vadot        maxItems: 1
785def4c47SEmmanuel Vadot
795def4c47SEmmanuel Vadot      clocks:
805def4c47SEmmanuel Vadot        items:
815def4c47SEmmanuel Vadot          - description: sai_ck clock feeding the internal clock generator.
825def4c47SEmmanuel Vadot          - description: MCLK clock from a SAI set as master clock provider.
835def4c47SEmmanuel Vadot        minItems: 1
845def4c47SEmmanuel Vadot
855def4c47SEmmanuel Vadot      clock-names:
865def4c47SEmmanuel Vadot        items:
875def4c47SEmmanuel Vadot          - const: sai_ck
885def4c47SEmmanuel Vadot          - const: MCLK
895def4c47SEmmanuel Vadot        minItems: 1
905def4c47SEmmanuel Vadot
915def4c47SEmmanuel Vadot      dmas:
925def4c47SEmmanuel Vadot        maxItems: 1
935def4c47SEmmanuel Vadot
945def4c47SEmmanuel Vadot      dma-names:
955def4c47SEmmanuel Vadot        description: |
965def4c47SEmmanuel Vadot          rx: SAI sub-block is configured as a capture DAI.
975def4c47SEmmanuel Vadot          tx: SAI sub-block is configured as a playback DAI.
985def4c47SEmmanuel Vadot        enum: [ rx, tx ]
995def4c47SEmmanuel Vadot
1005def4c47SEmmanuel Vadot      st,sync:
1015def4c47SEmmanuel Vadot        description:
1025def4c47SEmmanuel Vadot          Configure the SAI sub-block as slave of another SAI sub-block.
1035def4c47SEmmanuel Vadot          By default SAI sub-block is in asynchronous mode.
1045def4c47SEmmanuel Vadot          Must contain the phandle and index of the SAI sub-block providing
1055def4c47SEmmanuel Vadot          the synchronization.
106c9ccf3a3SEmmanuel Vadot        $ref: /schemas/types.yaml#/definitions/phandle-array
107c9ccf3a3SEmmanuel Vadot        items:
108c9ccf3a3SEmmanuel Vadot          - items:
109c9ccf3a3SEmmanuel Vadot              - description: phandle of the SAI sub-block
110c9ccf3a3SEmmanuel Vadot              - description: index of the SAI sub-block
1115def4c47SEmmanuel Vadot
1125def4c47SEmmanuel Vadot      st,iec60958:
1135def4c47SEmmanuel Vadot        description:
1145def4c47SEmmanuel Vadot          If set, support S/PDIF IEC6958 protocol for playback.
1155def4c47SEmmanuel Vadot          IEC60958 protocol is not available for capture.
1165def4c47SEmmanuel Vadot          By default, custom protocol is assumed, meaning that protocol is
1175def4c47SEmmanuel Vadot          configured according to protocol defined in related DAI link node,
1185def4c47SEmmanuel Vadot          such as i2s, left justified, right justified, dsp and pdm protocols.
119c9ccf3a3SEmmanuel Vadot        $ref: /schemas/types.yaml#/definitions/flag
1205def4c47SEmmanuel Vadot
1215def4c47SEmmanuel Vadot      "#clock-cells":
1225def4c47SEmmanuel Vadot        description: Configure the SAI device as master clock provider.
1235def4c47SEmmanuel Vadot        const: 0
1245def4c47SEmmanuel Vadot
1257ef62cebSEmmanuel Vadot      port:
1267ef62cebSEmmanuel Vadot        $ref: audio-graph-port.yaml#
1277ef62cebSEmmanuel Vadot        unevaluatedProperties: false
1287ef62cebSEmmanuel Vadot
1295def4c47SEmmanuel Vadot    required:
1305def4c47SEmmanuel Vadot      - compatible
1315def4c47SEmmanuel Vadot      - "#sound-dai-cells"
1325def4c47SEmmanuel Vadot      - reg
1335def4c47SEmmanuel Vadot      - clocks
1345def4c47SEmmanuel Vadot      - clock-names
1355def4c47SEmmanuel Vadot      - dmas
1365def4c47SEmmanuel Vadot      - dma-names
1375def4c47SEmmanuel Vadot
1385def4c47SEmmanuel VadotallOf:
1395def4c47SEmmanuel Vadot  - if:
1405def4c47SEmmanuel Vadot      properties:
1415def4c47SEmmanuel Vadot        compatible:
1425def4c47SEmmanuel Vadot          contains:
1435def4c47SEmmanuel Vadot            const: st,stm32f4-sai
144c9ccf3a3SEmmanuel Vadot    then:
1455def4c47SEmmanuel Vadot      properties:
1465def4c47SEmmanuel Vadot        clocks:
1475def4c47SEmmanuel Vadot          items:
1485def4c47SEmmanuel Vadot            - description: x8k, SAI parent clock for sampling rates multiple of 8kHz.
1495def4c47SEmmanuel Vadot            - description: x11k, SAI parent clock for sampling rates multiple of 11.025kHz.
1505def4c47SEmmanuel Vadot
1515def4c47SEmmanuel Vadot        clock-names:
1525def4c47SEmmanuel Vadot          items:
1535def4c47SEmmanuel Vadot            - const: x8k
1545def4c47SEmmanuel Vadot            - const: x11k
155c9ccf3a3SEmmanuel Vadot    else:
1565def4c47SEmmanuel Vadot      properties:
1575def4c47SEmmanuel Vadot        clocks:
1585def4c47SEmmanuel Vadot          items:
1595def4c47SEmmanuel Vadot            - description: pclk feeds the peripheral bus interface.
1605def4c47SEmmanuel Vadot            - description: x8k, SAI parent clock for sampling rates multiple of 8kHz.
1615def4c47SEmmanuel Vadot            - description: x11k, SAI parent clock for sampling rates multiple of 11.025kHz.
1625def4c47SEmmanuel Vadot
1635def4c47SEmmanuel Vadot        clock-names:
1645def4c47SEmmanuel Vadot          items:
1655def4c47SEmmanuel Vadot            - const: pclk
1665def4c47SEmmanuel Vadot            - const: x8k
1675def4c47SEmmanuel Vadot            - const: x11k
1685def4c47SEmmanuel Vadot
1695def4c47SEmmanuel VadotadditionalProperties: false
1705def4c47SEmmanuel Vadot
1715def4c47SEmmanuel Vadotexamples:
1725def4c47SEmmanuel Vadot  - |
1735def4c47SEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
1745def4c47SEmmanuel Vadot    #include <dt-bindings/clock/stm32mp1-clks.h>
1755def4c47SEmmanuel Vadot    #include <dt-bindings/reset/stm32mp1-resets.h>
1765def4c47SEmmanuel Vadot    sai2: sai@4400b000 {
1775def4c47SEmmanuel Vadot      compatible = "st,stm32h7-sai";
1785def4c47SEmmanuel Vadot      #address-cells = <1>;
1795def4c47SEmmanuel Vadot      #size-cells = <1>;
1805def4c47SEmmanuel Vadot      ranges = <0 0x4400b000 0x400>;
1815def4c47SEmmanuel Vadot      reg = <0x4400b000 0x4>, <0x4400b3f0 0x10>;
1825def4c47SEmmanuel Vadot      clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
1835def4c47SEmmanuel Vadot      clock-names = "pclk", "x8k", "x11k";
1845def4c47SEmmanuel Vadot      pinctrl-names = "default", "sleep";
1855def4c47SEmmanuel Vadot      pinctrl-0 = <&sai2a_pins_a>, <&sai2b_pins_b>;
1865def4c47SEmmanuel Vadot      pinctrl-1 = <&sai2a_sleep_pins_a>, <&sai2b_sleep_pins_b>;
1875def4c47SEmmanuel Vadot
1885def4c47SEmmanuel Vadot      sai2a: audio-controller@4400b004 {
1895def4c47SEmmanuel Vadot        #sound-dai-cells = <0>;
1905def4c47SEmmanuel Vadot        compatible = "st,stm32-sai-sub-a";
1915def4c47SEmmanuel Vadot        reg = <0x4 0x1c>;
1925def4c47SEmmanuel Vadot        dmas = <&dmamux1 89 0x400 0x01>;
1935def4c47SEmmanuel Vadot        dma-names = "tx";
1945def4c47SEmmanuel Vadot        clocks = <&rcc SAI2_K>;
1955def4c47SEmmanuel Vadot        clock-names = "sai_ck";
1965def4c47SEmmanuel Vadot      };
1975def4c47SEmmanuel Vadot    };
1985def4c47SEmmanuel Vadot
1995def4c47SEmmanuel Vadot...
200