xref: /freebsd/sys/contrib/device-tree/Bindings/sound/renesas,rsnd.yaml (revision cab6a39d7b343596a5823e65c0f7b426551ec22d)
1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/sound/renesas,rsnd.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Renesas R-Car Sound Driver Device Tree Bindings
8
9maintainers:
10  - Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
11
12properties:
13
14  compatible:
15    oneOf:
16      # for Gen1 SoC
17      - items:
18          - enum:
19              - renesas,rcar_sound-r8a7778   # R-Car M1A
20              - renesas,rcar_sound-r8a7779   # R-Car H1
21          - enum:
22              - renesas,rcar_sound-gen1
23      # for Gen2 SoC
24      - items:
25          - enum:
26              - renesas,rcar_sound-r8a7742   # RZ/G1H
27              - renesas,rcar_sound-r8a7743   # RZ/G1M
28              - renesas,rcar_sound-r8a7744   # RZ/G1N
29              - renesas,rcar_sound-r8a7745   # RZ/G1E
30              - renesas,rcar_sound-r8a77470  # RZ/G1C
31              - renesas,rcar_sound-r8a7790   # R-Car H2
32              - renesas,rcar_sound-r8a7791   # R-Car M2-W
33              - renesas,rcar_sound-r8a7793   # R-Car M2-N
34              - renesas,rcar_sound-r8a7794   # R-Car E2
35          - enum:
36              - renesas,rcar_sound-gen2
37      # for Gen3 SoC
38      - items:
39          - enum:
40              - renesas,rcar_sound-r8a774a1  # RZ/G2M
41              - renesas,rcar_sound-r8a774b1  # RZ/G2N
42              - renesas,rcar_sound-r8a774c0  # RZ/G2E
43              - renesas,rcar_sound-r8a774e1  # RZ/G2H
44              - renesas,rcar_sound-r8a7795   # R-Car H3
45              - renesas,rcar_sound-r8a7796   # R-Car M3-W
46              - renesas,rcar_sound-r8a77961  # R-Car M3-W+
47              - renesas,rcar_sound-r8a77965  # R-Car M3-N
48              - renesas,rcar_sound-r8a77990  # R-Car E3
49              - renesas,rcar_sound-r8a77995  # R-Car D3
50          - enum:
51              - renesas,rcar_sound-gen3
52      # for Generic
53      - items:
54          - enum:
55              - renesas,rcar_sound-gen1
56              - renesas,rcar_sound-gen2
57              - renesas,rcar_sound-gen3
58
59  reg:
60    minItems: 1
61    maxItems: 5
62
63  reg-names:
64    minItems: 1
65    maxItems: 5
66
67  "#sound-dai-cells":
68    description: |
69      it must be 0 if your system is using single DAI
70      it must be 1 if your system is using multi  DAIs
71    enum: [0, 1]
72
73  "#clock-cells":
74    description: |
75      it must be 0 if your system has audio_clkout
76      it must be 1 if your system has audio_clkout0/1/2/3
77    enum: [0, 1]
78
79  clock-frequency:
80    description: for audio_clkout0/1/2/3
81
82  clkout-lr-asynchronous:
83    description: audio_clkoutn is asynchronizes with lr-clock.
84    $ref: /schemas/types.yaml#/definitions/flag
85
86  power-domains: true
87
88  resets:
89    maxItems: 11
90
91  reset-names:
92    maxItems: 11
93
94  clocks:
95    description: References to SSI/SRC/MIX/CTU/DVC/AUDIO_CLK clocks.
96    minItems: 1
97    maxItems: 31
98
99  clock-names:
100    description: List of necessary clock names.
101    minItems: 1
102    maxItems: 31
103    items:
104      oneOf:
105        - const: ssi-all
106        - pattern: '^ssi\.[0-9]$'
107        - pattern: '^src\.[0-9]$'
108        - pattern: '^mix\.[0-1]$'
109        - pattern: '^ctu\.[0-1]$'
110        - pattern: '^dvc\.[0-1]$'
111        - pattern: '^clk_(a|b|c|i)$'
112
113  port:
114    $ref: audio-graph-port.yaml#
115    unevaluatedProperties: false
116
117# use patternProperties to avoid naming "xxx,yyy" issue
118patternProperties:
119  "^rcar_sound,dvc$":
120    description: DVC subnode.
121    type: object
122    patternProperties:
123      "^dvc-[0-1]$":
124        type: object
125        properties:
126          dmas:
127            maxItems: 1
128          dma-names:
129            const: "tx"
130        required:
131          - dmas
132          - dma-names
133    additionalProperties: false
134
135  "^rcar_sound,mix$":
136    description: MIX subnode.
137    type: object
138    patternProperties:
139      "^mix-[0-1]$":
140        type: object
141        # no properties
142    additionalProperties: false
143
144  "^rcar_sound,ctu$":
145    description: CTU subnode.
146    type: object
147    patternProperties:
148      "^ctu-[0-7]$":
149        type: object
150        # no properties
151    additionalProperties: false
152
153  "^rcar_sound,src$":
154    description: SRC subnode.
155    type: object
156    patternProperties:
157      "^src-[0-9]$":
158        type: object
159        properties:
160          interrupts:
161            maxItems: 1
162          dmas:
163            maxItems: 2
164          dma-names:
165            allOf:
166              - items:
167                  enum:
168                    - tx
169                    - rx
170        required:
171          - interrupts
172          - dmas
173          - dma-names
174    additionalProperties: false
175
176  "^rcar_sound,ssiu$":
177    description: SSIU subnode.
178    type: object
179    patternProperties:
180      "^ssiu-[0-9]+$":
181        type: object
182        properties:
183          dmas:
184            maxItems: 2
185          dma-names:
186            allOf:
187              - items:
188                  enum:
189                    - tx
190                    - rx
191        required:
192          - dmas
193          - dma-names
194    additionalProperties: false
195
196  "^rcar_sound,ssi$":
197    description: SSI subnode.
198    type: object
199    patternProperties:
200      "^ssi-[0-9]$":
201        type: object
202        properties:
203          interrupts:
204            maxItems: 1
205          dmas:
206            minItems: 2
207            maxItems: 4
208          dma-names:
209            allOf:
210              - items:
211                  enum:
212                    - tx
213                    - rx
214                    - txu # if no ssiu node
215                    - rxu # if no ssiu node
216
217          shared-pin:
218            description: shared clock pin
219            $ref: /schemas/types.yaml#/definitions/flag
220          pio-transfer:
221            description: PIO transfer mode
222            $ref: /schemas/types.yaml#/definitions/flag
223          no-busif:
224            description: BUSIF is not used when [mem -> SSI] via DMA case
225            $ref: /schemas/types.yaml#/definitions/flag
226        required:
227          - interrupts
228          - dmas
229          - dma-names
230    additionalProperties: false
231
232  # For DAI base
233  "^rcar_sound,dai$":
234    description: DAI subnode.
235    type: object
236    patternProperties:
237      "^dai([0-9]+)?$":
238        type: object
239        properties:
240          playback:
241            $ref: /schemas/types.yaml#/definitions/phandle-array
242          capture:
243            $ref: /schemas/types.yaml#/definitions/phandle-array
244        anyOf:
245          - required:
246              - playback
247          - required:
248              - capture
249    additionalProperties: false
250
251required:
252  - compatible
253  - reg
254  - reg-names
255  - clocks
256  - clock-names
257  - "#sound-dai-cells"
258
259allOf:
260  - $ref: audio-graph.yaml#
261  - if:
262      properties:
263        compatible:
264          contains:
265            const: renesas,rcar_sound-gen1
266    then:
267      properties:
268        reg:
269          maxItems: 3
270        reg-names:
271          maxItems: 3
272          items:
273            enum:
274              - scu
275              - ssi
276              - adg
277    else:
278      properties:
279        reg:
280          maxItems: 5
281        reg-names:
282          maxItems: 5
283          items:
284            enum:
285              - scu
286              - adg
287              - ssiu
288              - ssi
289              - audmapp
290
291additionalProperties: false
292
293examples:
294  - |
295    rcar_sound: sound@ec500000 {
296        #sound-dai-cells = <1>;
297        compatible = "renesas,rcar_sound-r8a7790", "renesas,rcar_sound-gen2";
298        reg = <0xec500000 0x1000>, /* SCU  */
299              <0xec5a0000 0x100>,  /* ADG  */
300              <0xec540000 0x1000>, /* SSIU */
301              <0xec541000 0x1280>, /* SSI  */
302              <0xec740000 0x200>;  /* Audio DMAC peri peri*/
303        reg-names = "scu", "adg", "ssiu", "ssi", "audmapp";
304
305        clocks = <&mstp10_clks 1005>,                      /* SSI-ALL    */
306                 <&mstp10_clks 1006>, <&mstp10_clks 1007>, /* SSI9, SSI8 */
307                 <&mstp10_clks 1008>, <&mstp10_clks 1009>, /* SSI7, SSI6 */
308                 <&mstp10_clks 1010>, <&mstp10_clks 1011>, /* SSI5, SSI4 */
309                 <&mstp10_clks 1012>, <&mstp10_clks 1013>, /* SSI3, SSI2 */
310                 <&mstp10_clks 1014>, <&mstp10_clks 1015>, /* SSI1, SSI0 */
311                 <&mstp10_clks 1022>, <&mstp10_clks 1023>, /* SRC9, SRC8 */
312                 <&mstp10_clks 1024>, <&mstp10_clks 1025>, /* SRC7, SRC6 */
313                 <&mstp10_clks 1026>, <&mstp10_clks 1027>, /* SRC5, SRC4 */
314                 <&mstp10_clks 1028>, <&mstp10_clks 1029>, /* SRC3, SRC2 */
315                 <&mstp10_clks 1030>, <&mstp10_clks 1031>, /* SRC1, SRC0 */
316                 <&mstp10_clks 1020>, <&mstp10_clks 1021>, /* MIX1, MIX0 */
317                 <&mstp10_clks 1020>, <&mstp10_clks 1021>, /* CTU1, CTU0 */
318                 <&mstp10_clks 1019>, <&mstp10_clks 1018>, /* DVC0, DVC1 */
319                 <&audio_clk_a>, <&audio_clk_b>,           /* CLKA, CLKB */
320                 <&audio_clk_c>, <&audio_clk_i>;           /* CLKC, CLKI */
321
322        clock-names = "ssi-all",
323                      "ssi.9", "ssi.8",
324                      "ssi.7", "ssi.6",
325                      "ssi.5", "ssi.4",
326                      "ssi.3", "ssi.2",
327                      "ssi.1", "ssi.0",
328                      "src.9", "src.8",
329                      "src.7", "src.6",
330                      "src.5", "src.4",
331                      "src.3", "src.2",
332                      "src.1", "src.0",
333                      "mix.1", "mix.0",
334                      "ctu.1", "ctu.0",
335                      "dvc.0", "dvc.1",
336                      "clk_a", "clk_b",
337                      "clk_c", "clk_i";
338
339        rcar_sound,dvc {
340               dvc0: dvc-0 {
341                    dmas = <&audma0 0xbc>;
342                    dma-names = "tx";
343               };
344               dvc1: dvc-1 {
345                    dmas = <&audma0 0xbe>;
346                    dma-names = "tx";
347               };
348        };
349
350        rcar_sound,mix {
351            mix0: mix-0 { };
352            mix1: mix-1 { };
353        };
354
355        rcar_sound,ctu {
356            ctu00: ctu-0 { };
357            ctu01: ctu-1 { };
358            ctu02: ctu-2 { };
359            ctu03: ctu-3 { };
360            ctu10: ctu-4 { };
361            ctu11: ctu-5 { };
362            ctu12: ctu-6 { };
363            ctu13: ctu-7 { };
364        };
365
366        rcar_sound,src {
367            src0: src-0 {
368                status = "disabled";
369            };
370            src1: src-1 {
371                interrupts = <0 353 0>;
372                dmas = <&audma0 0x87>, <&audma1 0x9c>;
373                dma-names = "rx", "tx";
374            };
375            /* skip after src-2 */
376        };
377
378        rcar_sound,ssiu {
379            ssiu00: ssiu-0 {
380                dmas = <&audma0 0x15>, <&audma1 0x16>;
381                dma-names = "rx", "tx";
382            };
383            ssiu01: ssiu-1 {
384                dmas = <&audma0 0x35>, <&audma1 0x36>;
385                dma-names = "rx", "tx";
386            };
387            /* skip after ssiu-2 */
388        };
389
390        rcar_sound,ssi {
391            ssi0: ssi-0 {
392                interrupts = <0 370 1>;
393                dmas = <&audma0 0x01>, <&audma1 0x02>;
394                dma-names = "rx", "tx";
395            };
396            ssi1: ssi-1 {
397                interrupts = <0 371 1>;
398                dmas = <&audma0 0x03>, <&audma1 0x04>;
399                dma-names = "rx", "tx";
400            };
401            /* skip other ssi-2 */
402        };
403
404        /* DAI base */
405        rcar_sound,dai {
406            dai0 {
407                playback = <&ssi5>, <&src5>;
408                capture  = <&ssi6>;
409            };
410            dai1 {
411                playback = <&ssi3>;
412            };
413            dai2 {
414                capture  = <&ssi4>;
415            };
416            dai3 {
417                playback = <&ssi7>;
418            };
419            dai4 {
420                capture  = <&ssi8>;
421            };
422        };
423
424        /* assume audio-graph */
425        port {
426            rsnd_endpoint: endpoint {
427                remote-endpoint = <&codec_endpoint>;
428
429                dai-format = "left_j";
430                bitclock-master = <&rsnd_endpoint0>;
431                frame-master = <&rsnd_endpoint0>;
432
433                playback = <&ssi0>, <&src0>, <&dvc0>;
434                capture  = <&ssi1>, <&src1>, <&dvc1>;
435            };
436        };
437    };
438
439
440    /* assume audio-graph */
441    codec {
442        port {
443            codec_endpoint: endpoint {
444                remote-endpoint = <&rsnd_endpoint>;
445            };
446        };
447    };
448