xref: /linux/Documentation/devicetree/bindings/sound/st,stm32-sai.yaml (revision 25768de50b1f2dbb6ea44bd5148a87fe2c9c3688)
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
23*8509bb1fSOlivier Moysan      - st,stm32mp25-sai
2449491418SOlivier Moysan
2549491418SOlivier Moysan  reg:
2649491418SOlivier Moysan    items:
2749491418SOlivier Moysan      - description: Base address and size of SAI common register set.
2849491418SOlivier Moysan      - description: Base address and size of SAI identification register set.
2949491418SOlivier Moysan    minItems: 1
3049491418SOlivier Moysan
3149491418SOlivier Moysan  ranges:
3249491418SOlivier Moysan    maxItems: 1
3349491418SOlivier Moysan
3449491418SOlivier Moysan  interrupts:
3549491418SOlivier Moysan    maxItems: 1
3649491418SOlivier Moysan
3749491418SOlivier Moysan  resets:
3849491418SOlivier Moysan    maxItems: 1
3949491418SOlivier Moysan
4049491418SOlivier Moysan  "#address-cells":
4149491418SOlivier Moysan    const: 1
4249491418SOlivier Moysan
4349491418SOlivier Moysan  "#size-cells":
4449491418SOlivier Moysan    const: 1
4549491418SOlivier Moysan
4649491418SOlivier Moysan  clocks:
47*8509bb1fSOlivier Moysan    minItems: 1
4849491418SOlivier Moysan    maxItems: 3
4949491418SOlivier Moysan
5049491418SOlivier Moysan  clock-names:
51*8509bb1fSOlivier Moysan    minItems: 1
5249491418SOlivier Moysan    maxItems: 3
5349491418SOlivier Moysan
5402ec75edSGatien Chevallier  access-controllers:
5502ec75edSGatien Chevallier    minItems: 1
5602ec75edSGatien Chevallier    maxItems: 2
5702ec75edSGatien Chevallier
5849491418SOlivier Moysanrequired:
5949491418SOlivier Moysan  - compatible
6049491418SOlivier Moysan  - reg
6149491418SOlivier Moysan  - ranges
6249491418SOlivier Moysan  - "#address-cells"
6349491418SOlivier Moysan  - "#size-cells"
6449491418SOlivier Moysan  - clocks
6549491418SOlivier Moysan  - clock-names
6649491418SOlivier Moysan
6749491418SOlivier MoysanpatternProperties:
6849491418SOlivier Moysan  "^audio-controller@[0-9a-f]+$":
6949491418SOlivier Moysan    type: object
709e10a1deSRob Herring    additionalProperties: false
7149491418SOlivier Moysan    description:
7249491418SOlivier Moysan      Two subnodes corresponding to SAI sub-block instances A et B
7347aab533SBjorn Helgaas      can be defined. Subnode can be omitted for unused sub-block.
7449491418SOlivier Moysan
7549491418SOlivier Moysan    properties:
7649491418SOlivier Moysan      compatible:
7749491418SOlivier Moysan        description: Compatible for SAI sub-block A or B.
78737ce4fbSRob Herring (Arm)        pattern: "^st,stm32-sai-sub-[ab]$"
7949491418SOlivier Moysan
8049491418SOlivier Moysan      "#sound-dai-cells":
8149491418SOlivier Moysan        const: 0
8249491418SOlivier Moysan
8349491418SOlivier Moysan      reg:
8449491418SOlivier Moysan        maxItems: 1
8549491418SOlivier Moysan
8649491418SOlivier Moysan      clocks:
8749491418SOlivier Moysan        items:
8849491418SOlivier Moysan          - description: sai_ck clock feeding the internal clock generator.
8949491418SOlivier Moysan          - description: MCLK clock from a SAI set as master clock provider.
9049491418SOlivier Moysan        minItems: 1
9149491418SOlivier Moysan
9249491418SOlivier Moysan      clock-names:
9349491418SOlivier Moysan        items:
9449491418SOlivier Moysan          - const: sai_ck
9549491418SOlivier Moysan          - const: MCLK
9649491418SOlivier Moysan        minItems: 1
9749491418SOlivier Moysan
9849491418SOlivier Moysan      dmas:
9949491418SOlivier Moysan        maxItems: 1
10049491418SOlivier Moysan
10149491418SOlivier Moysan      dma-names:
10249491418SOlivier Moysan        description: |
10349491418SOlivier Moysan          rx: SAI sub-block is configured as a capture DAI.
10449491418SOlivier Moysan          tx: SAI sub-block is configured as a playback DAI.
10549491418SOlivier Moysan        enum: [ rx, tx ]
10649491418SOlivier Moysan
10749491418SOlivier Moysan      st,sync:
10849491418SOlivier Moysan        description:
10949491418SOlivier Moysan          Configure the SAI sub-block as slave of another SAI sub-block.
11049491418SOlivier Moysan          By default SAI sub-block is in asynchronous mode.
11149491418SOlivier Moysan          Must contain the phandle and index of the SAI sub-block providing
11249491418SOlivier Moysan          the synchronization.
11339bd2b6aSRob Herring        $ref: /schemas/types.yaml#/definitions/phandle-array
11439bd2b6aSRob Herring        items:
11539bd2b6aSRob Herring          - items:
11639bd2b6aSRob Herring              - description: phandle of the SAI sub-block
11739bd2b6aSRob Herring              - description: index of the SAI sub-block
11849491418SOlivier Moysan
11949491418SOlivier Moysan      st,iec60958:
12049491418SOlivier Moysan        description:
12149491418SOlivier Moysan          If set, support S/PDIF IEC6958 protocol for playback.
12249491418SOlivier Moysan          IEC60958 protocol is not available for capture.
12349491418SOlivier Moysan          By default, custom protocol is assumed, meaning that protocol is
12449491418SOlivier Moysan          configured according to protocol defined in related DAI link node,
12549491418SOlivier Moysan          such as i2s, left justified, right justified, dsp and pdm protocols.
126dca66935SRob Herring        $ref: /schemas/types.yaml#/definitions/flag
12749491418SOlivier Moysan
12849491418SOlivier Moysan      "#clock-cells":
12949491418SOlivier Moysan        description: Configure the SAI device as master clock provider.
13049491418SOlivier Moysan        const: 0
13149491418SOlivier Moysan
132b3eec3e6SMarek Vasut      port:
133b3eec3e6SMarek Vasut        $ref: audio-graph-port.yaml#
134b3eec3e6SMarek Vasut        unevaluatedProperties: false
135b3eec3e6SMarek Vasut
13649491418SOlivier Moysan    required:
13749491418SOlivier Moysan      - compatible
13849491418SOlivier Moysan      - "#sound-dai-cells"
13949491418SOlivier Moysan      - reg
14049491418SOlivier Moysan      - clocks
14149491418SOlivier Moysan      - clock-names
14249491418SOlivier Moysan      - dmas
14349491418SOlivier Moysan      - dma-names
14449491418SOlivier Moysan
14549491418SOlivier MoysanallOf:
14649491418SOlivier Moysan  - if:
14749491418SOlivier Moysan      properties:
14849491418SOlivier Moysan        compatible:
14949491418SOlivier Moysan          contains:
15049491418SOlivier Moysan            const: st,stm32f4-sai
15127e4a85cSRob Herring    then:
15249491418SOlivier Moysan      properties:
15349491418SOlivier Moysan        clocks:
15449491418SOlivier Moysan          items:
15549491418SOlivier Moysan            - description: x8k, SAI parent clock for sampling rates multiple of 8kHz.
15649491418SOlivier Moysan            - description: x11k, SAI parent clock for sampling rates multiple of 11.025kHz.
15749491418SOlivier Moysan
15849491418SOlivier Moysan        clock-names:
15949491418SOlivier Moysan          items:
16049491418SOlivier Moysan            - const: x8k
16149491418SOlivier Moysan            - const: x11k
162*8509bb1fSOlivier Moysan
163*8509bb1fSOlivier Moysan  - if:
164*8509bb1fSOlivier Moysan      properties:
165*8509bb1fSOlivier Moysan        compatible:
166*8509bb1fSOlivier Moysan          contains:
167*8509bb1fSOlivier Moysan            const: st,stm32mph7-sai
168*8509bb1fSOlivier Moysan    then:
16949491418SOlivier Moysan      properties:
17049491418SOlivier Moysan        clocks:
17149491418SOlivier Moysan          items:
17249491418SOlivier Moysan            - description: pclk feeds the peripheral bus interface.
17349491418SOlivier Moysan            - description: x8k, SAI parent clock for sampling rates multiple of 8kHz.
17449491418SOlivier Moysan            - description: x11k, SAI parent clock for sampling rates multiple of 11.025kHz.
17549491418SOlivier Moysan
17649491418SOlivier Moysan        clock-names:
17749491418SOlivier Moysan          items:
17849491418SOlivier Moysan            - const: pclk
17949491418SOlivier Moysan            - const: x8k
18049491418SOlivier Moysan            - const: x11k
18149491418SOlivier Moysan
182*8509bb1fSOlivier Moysan  - if:
183*8509bb1fSOlivier Moysan      properties:
184*8509bb1fSOlivier Moysan        compatible:
185*8509bb1fSOlivier Moysan          contains:
186*8509bb1fSOlivier Moysan            const: st,stm32mp25-sai
187*8509bb1fSOlivier Moysan    then:
188*8509bb1fSOlivier Moysan      properties:
189*8509bb1fSOlivier Moysan        clocks:
190*8509bb1fSOlivier Moysan          items:
191*8509bb1fSOlivier Moysan            - description: pclk feeds the peripheral bus interface.
192*8509bb1fSOlivier Moysan
193*8509bb1fSOlivier Moysan        clock-names:
194*8509bb1fSOlivier Moysan          items:
195*8509bb1fSOlivier Moysan            - const: pclk
196*8509bb1fSOlivier Moysan
19749491418SOlivier MoysanadditionalProperties: false
19849491418SOlivier Moysan
19949491418SOlivier Moysanexamples:
20049491418SOlivier Moysan  - |
20149491418SOlivier Moysan    #include <dt-bindings/interrupt-controller/arm-gic.h>
20249491418SOlivier Moysan    #include <dt-bindings/clock/stm32mp1-clks.h>
20349491418SOlivier Moysan    #include <dt-bindings/reset/stm32mp1-resets.h>
20449491418SOlivier Moysan    sai2: sai@4400b000 {
20549491418SOlivier Moysan      compatible = "st,stm32h7-sai";
20649491418SOlivier Moysan      #address-cells = <1>;
20749491418SOlivier Moysan      #size-cells = <1>;
20849491418SOlivier Moysan      ranges = <0 0x4400b000 0x400>;
20949491418SOlivier Moysan      reg = <0x4400b000 0x4>, <0x4400b3f0 0x10>;
21049491418SOlivier Moysan      clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
21149491418SOlivier Moysan      clock-names = "pclk", "x8k", "x11k";
21249491418SOlivier Moysan      pinctrl-names = "default", "sleep";
21349491418SOlivier Moysan      pinctrl-0 = <&sai2a_pins_a>, <&sai2b_pins_b>;
21449491418SOlivier Moysan      pinctrl-1 = <&sai2a_sleep_pins_a>, <&sai2b_sleep_pins_b>;
21549491418SOlivier Moysan
21649491418SOlivier Moysan      sai2a: audio-controller@4400b004 {
21749491418SOlivier Moysan        #sound-dai-cells = <0>;
21849491418SOlivier Moysan        compatible = "st,stm32-sai-sub-a";
21949491418SOlivier Moysan        reg = <0x4 0x1c>;
22049491418SOlivier Moysan        dmas = <&dmamux1 89 0x400 0x01>;
22149491418SOlivier Moysan        dma-names = "tx";
22249491418SOlivier Moysan        clocks = <&rcc SAI2_K>;
22349491418SOlivier Moysan        clock-names = "sai_ck";
22449491418SOlivier Moysan      };
22549491418SOlivier Moysan    };
22649491418SOlivier Moysan
22749491418SOlivier Moysan...
228