summaryrefslogtreecommitdiffstats
path: root/Documentation/devicetree/bindings/sound/st,stm32-sai.yaml
blob: 56d206f97a96cc0a33e17dd3d5417c959d226838 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/st,stm32-sai.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: STMicroelectronics STM32 Serial Audio Interface (SAI)

maintainers:
  - Olivier Moysan <olivier.moysan@foss.st.com>

description:
  The SAI interface (Serial Audio Interface) offers a wide set of audio
  protocols as I2S standards, LSB or MSB-justified, PCM/DSP, TDM, and AC'97.
  The SAI contains two independent audio sub-blocks. Each sub-block has
  its own clock generator and I/O lines controller.

properties:
  compatible:
    enum:
      - st,stm32f4-sai
      - st,stm32h7-sai

  reg:
    items:
      - description: Base address and size of SAI common register set.
      - description: Base address and size of SAI identification register set.
    minItems: 1

  ranges:
    maxItems: 1

  interrupts:
    maxItems: 1

  resets:
    maxItems: 1

  "#address-cells":
    const: 1

  "#size-cells":
    const: 1

  clocks:
    maxItems: 3

  clock-names:
    maxItems: 3

required:
  - compatible
  - reg
  - ranges
  - "#address-cells"
  - "#size-cells"
  - clocks
  - clock-names

patternProperties:
  "^audio-controller@[0-9a-f]+$":
    type: object
    additionalProperties: false
    description:
      Two subnodes corresponding to SAI sub-block instances A et B
      can be defined. Subnode can be omitted for unsused sub-block.

    properties:
      compatible:
        description: Compatible for SAI sub-block A or B.
        pattern: "st,stm32-sai-sub-[ab]"

      "#sound-dai-cells":
        const: 0

      reg:
        maxItems: 1

      clocks:
        items:
          - description: sai_ck clock feeding the internal clock generator.
          - description: MCLK clock from a SAI set as master clock provider.
        minItems: 1

      clock-names:
        items:
          - const: sai_ck
          - const: MCLK
        minItems: 1

      dmas:
        maxItems: 1

      dma-names:
        description: |
          rx: SAI sub-block is configured as a capture DAI.
          tx: SAI sub-block is configured as a playback DAI.
        enum: [ rx, tx ]

      st,sync:
        description:
          Configure the SAI sub-block as slave of another SAI sub-block.
          By default SAI sub-block is in asynchronous mode.
          Must contain the phandle and index of the SAI sub-block providing
          the synchronization.
        $ref: /schemas/types.yaml#/definitions/phandle-array
        items:
          - items:
              - description: phandle of the SAI sub-block
              - description: index of the SAI sub-block

      st,iec60958:
        description:
          If set, support S/PDIF IEC6958 protocol for playback.
          IEC60958 protocol is not available for capture.
          By default, custom protocol is assumed, meaning that protocol is
          configured according to protocol defined in related DAI link node,
          such as i2s, left justified, right justified, dsp and pdm protocols.
        $ref: /schemas/types.yaml#/definitions/flag

      "#clock-cells":
        description: Configure the SAI device as master clock provider.
        const: 0

      port:
        $ref: audio-graph-port.yaml#
        unevaluatedProperties: false

    required:
      - compatible
      - "#sound-dai-cells"
      - reg
      - clocks
      - clock-names
      - dmas
      - dma-names

allOf:
  - if:
      properties:
        compatible:
          contains:
            const: st,stm32f4-sai
    then:
      properties:
        clocks:
          items:
            - description: x8k, SAI parent clock for sampling rates multiple of 8kHz.
            - description: x11k, SAI parent clock for sampling rates multiple of 11.025kHz.

        clock-names:
          items:
            - const: x8k
            - const: x11k
    else:
      properties:
        clocks:
          items:
            - description: pclk feeds the peripheral bus interface.
            - description: x8k, SAI parent clock for sampling rates multiple of 8kHz.
            - description: x11k, SAI parent clock for sampling rates multiple of 11.025kHz.

        clock-names:
          items:
            - const: pclk
            - const: x8k
            - const: x11k

additionalProperties: false

examples:
  - |
    #include <dt-bindings/interrupt-controller/arm-gic.h>
    #include <dt-bindings/clock/stm32mp1-clks.h>
    #include <dt-bindings/reset/stm32mp1-resets.h>
    sai2: sai@4400b000 {
      compatible = "st,stm32h7-sai";
      #address-cells = <1>;
      #size-cells = <1>;
      ranges = <0 0x4400b000 0x400>;
      reg = <0x4400b000 0x4>, <0x4400b3f0 0x10>;
      clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
      clock-names = "pclk", "x8k", "x11k";
      pinctrl-names = "default", "sleep";
      pinctrl-0 = <&sai2a_pins_a>, <&sai2b_pins_b>;
      pinctrl-1 = <&sai2a_sleep_pins_a>, <&sai2b_sleep_pins_b>;

      sai2a: audio-controller@4400b004 {
        #sound-dai-cells = <0>;
        compatible = "st,stm32-sai-sub-a";
        reg = <0x4 0x1c>;
        dmas = <&dmamux1 89 0x400 0x01>;
        dma-names = "tx";
        clocks = <&rcc SAI2_K>;
        clock-names = "sai_ck";
      };
    };

...