xref: /linux/Documentation/devicetree/bindings/sound/st,stm32-sai.yaml (revision dca669354e6ff494222dfc461bed1087264f3755)
149491418SOlivier Moysan# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
249491418SOlivier Moysan%YAML 1.2
349491418SOlivier Moysan---
449491418SOlivier Moysan$id: http://devicetree.org/schemas/sound/st,stm32-sai.yaml#
549491418SOlivier Moysan$schema: http://devicetree.org/meta-schemas/core.yaml#
649491418SOlivier Moysan
749491418SOlivier Moysantitle: STMicroelectronics STM32 Serial Audio Interface (SAI)
849491418SOlivier Moysan
949491418SOlivier Moysanmaintainers:
10f4eedebdSPatrice Chotard  - Olivier Moysan <olivier.moysan@foss.st.com>
1149491418SOlivier Moysan
1249491418SOlivier Moysandescription:
1349491418SOlivier Moysan  The SAI interface (Serial Audio Interface) offers a wide set of audio
1449491418SOlivier Moysan  protocols as I2S standards, LSB or MSB-justified, PCM/DSP, TDM, and AC'97.
1549491418SOlivier Moysan  The SAI contains two independent audio sub-blocks. Each sub-block has
1649491418SOlivier Moysan  its own clock generator and I/O lines controller.
1749491418SOlivier Moysan
1849491418SOlivier Moysanproperties:
1949491418SOlivier Moysan  compatible:
2049491418SOlivier Moysan    enum:
2149491418SOlivier Moysan      - st,stm32f4-sai
2249491418SOlivier Moysan      - st,stm32h7-sai
2349491418SOlivier Moysan
2449491418SOlivier Moysan  reg:
2549491418SOlivier Moysan    items:
2649491418SOlivier Moysan      - description: Base address and size of SAI common register set.
2749491418SOlivier Moysan      - description: Base address and size of SAI identification register set.
2849491418SOlivier Moysan    minItems: 1
2949491418SOlivier Moysan
3049491418SOlivier Moysan  ranges:
3149491418SOlivier Moysan    maxItems: 1
3249491418SOlivier Moysan
3349491418SOlivier Moysan  interrupts:
3449491418SOlivier Moysan    maxItems: 1
3549491418SOlivier Moysan
3649491418SOlivier Moysan  resets:
3749491418SOlivier Moysan    maxItems: 1
3849491418SOlivier Moysan
3949491418SOlivier Moysan  "#address-cells":
4049491418SOlivier Moysan    const: 1
4149491418SOlivier Moysan
4249491418SOlivier Moysan  "#size-cells":
4349491418SOlivier Moysan    const: 1
4449491418SOlivier Moysan
4549491418SOlivier Moysan  clocks:
4649491418SOlivier Moysan    maxItems: 3
4749491418SOlivier Moysan
4849491418SOlivier Moysan  clock-names:
4949491418SOlivier Moysan    maxItems: 3
5049491418SOlivier Moysan
5149491418SOlivier Moysanrequired:
5249491418SOlivier Moysan  - compatible
5349491418SOlivier Moysan  - reg
5449491418SOlivier Moysan  - ranges
5549491418SOlivier Moysan  - "#address-cells"
5649491418SOlivier Moysan  - "#size-cells"
5749491418SOlivier Moysan  - clocks
5849491418SOlivier Moysan  - clock-names
5949491418SOlivier Moysan
6049491418SOlivier MoysanpatternProperties:
6149491418SOlivier Moysan  "^audio-controller@[0-9a-f]+$":
6249491418SOlivier Moysan    type: object
6349491418SOlivier Moysan    description:
6449491418SOlivier Moysan      Two subnodes corresponding to SAI sub-block instances A et B
6549491418SOlivier Moysan      can be defined. Subnode can be omitted for unsused sub-block.
6649491418SOlivier Moysan
6749491418SOlivier Moysan    properties:
6849491418SOlivier Moysan      compatible:
6949491418SOlivier Moysan        description: Compatible for SAI sub-block A or B.
7049491418SOlivier Moysan        pattern: "st,stm32-sai-sub-[ab]"
7149491418SOlivier Moysan
7249491418SOlivier Moysan      "#sound-dai-cells":
7349491418SOlivier Moysan        const: 0
7449491418SOlivier Moysan
7549491418SOlivier Moysan      reg:
7649491418SOlivier Moysan        maxItems: 1
7749491418SOlivier Moysan
7849491418SOlivier Moysan      clocks:
7949491418SOlivier Moysan        items:
8049491418SOlivier Moysan          - description: sai_ck clock feeding the internal clock generator.
8149491418SOlivier Moysan          - description: MCLK clock from a SAI set as master clock provider.
8249491418SOlivier Moysan        minItems: 1
8349491418SOlivier Moysan
8449491418SOlivier Moysan      clock-names:
8549491418SOlivier Moysan        items:
8649491418SOlivier Moysan          - const: sai_ck
8749491418SOlivier Moysan          - const: MCLK
8849491418SOlivier Moysan        minItems: 1
8949491418SOlivier Moysan
9049491418SOlivier Moysan      dmas:
9149491418SOlivier Moysan        maxItems: 1
9249491418SOlivier Moysan
9349491418SOlivier Moysan      dma-names:
9449491418SOlivier Moysan        description: |
9549491418SOlivier Moysan          rx: SAI sub-block is configured as a capture DAI.
9649491418SOlivier Moysan          tx: SAI sub-block is configured as a playback DAI.
9749491418SOlivier Moysan        enum: [ rx, tx ]
9849491418SOlivier Moysan
9949491418SOlivier Moysan      st,sync:
10049491418SOlivier Moysan        description:
10149491418SOlivier Moysan          Configure the SAI sub-block as slave of another SAI sub-block.
10249491418SOlivier Moysan          By default SAI sub-block is in asynchronous mode.
10349491418SOlivier Moysan          Must contain the phandle and index of the SAI sub-block providing
10449491418SOlivier Moysan          the synchronization.
10539bd2b6aSRob Herring        $ref: /schemas/types.yaml#/definitions/phandle-array
10639bd2b6aSRob Herring        items:
10739bd2b6aSRob Herring          - items:
10839bd2b6aSRob Herring              - description: phandle of the SAI sub-block
10939bd2b6aSRob Herring              - description: index of the SAI sub-block
11049491418SOlivier Moysan
11149491418SOlivier Moysan      st,iec60958:
11249491418SOlivier Moysan        description:
11349491418SOlivier Moysan          If set, support S/PDIF IEC6958 protocol for playback.
11449491418SOlivier Moysan          IEC60958 protocol is not available for capture.
11549491418SOlivier Moysan          By default, custom protocol is assumed, meaning that protocol is
11649491418SOlivier Moysan          configured according to protocol defined in related DAI link node,
11749491418SOlivier Moysan          such as i2s, left justified, right justified, dsp and pdm protocols.
118*dca66935SRob Herring        $ref: /schemas/types.yaml#/definitions/flag
11949491418SOlivier Moysan
12049491418SOlivier Moysan      "#clock-cells":
12149491418SOlivier Moysan        description: Configure the SAI device as master clock provider.
12249491418SOlivier Moysan        const: 0
12349491418SOlivier Moysan
12449491418SOlivier Moysan    required:
12549491418SOlivier Moysan      - compatible
12649491418SOlivier Moysan      - "#sound-dai-cells"
12749491418SOlivier Moysan      - reg
12849491418SOlivier Moysan      - clocks
12949491418SOlivier Moysan      - clock-names
13049491418SOlivier Moysan      - dmas
13149491418SOlivier Moysan      - dma-names
13249491418SOlivier Moysan
13349491418SOlivier MoysanallOf:
13449491418SOlivier Moysan  - if:
13549491418SOlivier Moysan      properties:
13649491418SOlivier Moysan        compatible:
13749491418SOlivier Moysan          contains:
13849491418SOlivier Moysan            const: st,stm32f4-sai
13949491418SOlivier Moysan
14049491418SOlivier Moysan  - then:
14149491418SOlivier Moysan      properties:
14249491418SOlivier Moysan        clocks:
14349491418SOlivier Moysan          items:
14449491418SOlivier Moysan            - description: x8k, SAI parent clock for sampling rates multiple of 8kHz.
14549491418SOlivier Moysan            - description: x11k, SAI parent clock for sampling rates multiple of 11.025kHz.
14649491418SOlivier Moysan
14749491418SOlivier Moysan        clock-names:
14849491418SOlivier Moysan          items:
14949491418SOlivier Moysan            - const: x8k
15049491418SOlivier Moysan            - const: x11k
15149491418SOlivier Moysan
15249491418SOlivier Moysan  - else:
15349491418SOlivier Moysan      properties:
15449491418SOlivier Moysan        clocks:
15549491418SOlivier Moysan          items:
15649491418SOlivier Moysan            - description: pclk feeds the peripheral bus interface.
15749491418SOlivier Moysan            - description: x8k, SAI parent clock for sampling rates multiple of 8kHz.
15849491418SOlivier Moysan            - description: x11k, SAI parent clock for sampling rates multiple of 11.025kHz.
15949491418SOlivier Moysan
16049491418SOlivier Moysan        clock-names:
16149491418SOlivier Moysan          items:
16249491418SOlivier Moysan            - const: pclk
16349491418SOlivier Moysan            - const: x8k
16449491418SOlivier Moysan            - const: x11k
16549491418SOlivier Moysan
16649491418SOlivier MoysanadditionalProperties: false
16749491418SOlivier Moysan
16849491418SOlivier Moysanexamples:
16949491418SOlivier Moysan  - |
17049491418SOlivier Moysan    #include <dt-bindings/interrupt-controller/arm-gic.h>
17149491418SOlivier Moysan    #include <dt-bindings/clock/stm32mp1-clks.h>
17249491418SOlivier Moysan    #include <dt-bindings/reset/stm32mp1-resets.h>
17349491418SOlivier Moysan    sai2: sai@4400b000 {
17449491418SOlivier Moysan      compatible = "st,stm32h7-sai";
17549491418SOlivier Moysan      #address-cells = <1>;
17649491418SOlivier Moysan      #size-cells = <1>;
17749491418SOlivier Moysan      ranges = <0 0x4400b000 0x400>;
17849491418SOlivier Moysan      reg = <0x4400b000 0x4>, <0x4400b3f0 0x10>;
17949491418SOlivier Moysan      clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
18049491418SOlivier Moysan      clock-names = "pclk", "x8k", "x11k";
18149491418SOlivier Moysan      pinctrl-names = "default", "sleep";
18249491418SOlivier Moysan      pinctrl-0 = <&sai2a_pins_a>, <&sai2b_pins_b>;
18349491418SOlivier Moysan      pinctrl-1 = <&sai2a_sleep_pins_a>, <&sai2b_sleep_pins_b>;
18449491418SOlivier Moysan
18549491418SOlivier Moysan      sai2a: audio-controller@4400b004 {
18649491418SOlivier Moysan        #sound-dai-cells = <0>;
18749491418SOlivier Moysan        compatible = "st,stm32-sai-sub-a";
18849491418SOlivier Moysan        reg = <0x4 0x1c>;
18949491418SOlivier Moysan        dmas = <&dmamux1 89 0x400 0x01>;
19049491418SOlivier Moysan        dma-names = "tx";
19149491418SOlivier Moysan        clocks = <&rcc SAI2_K>;
19249491418SOlivier Moysan        clock-names = "sai_ck";
19349491418SOlivier Moysan      };
19449491418SOlivier Moysan    };
19549491418SOlivier Moysan
19649491418SOlivier Moysan...
197