xref: /linux/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml (revision 24168c5e6dfbdd5b414f048f47f75d64533296ca)
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
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          - const: renesas,rcar_sound-gen1
22      # for Gen2 SoC
23      - items:
24          - enum:
25              - renesas,rcar_sound-r8a7742   # RZ/G1H
26              - renesas,rcar_sound-r8a7743   # RZ/G1M
27              - renesas,rcar_sound-r8a7744   # RZ/G1N
28              - renesas,rcar_sound-r8a7745   # RZ/G1E
29              - renesas,rcar_sound-r8a77470  # RZ/G1C
30              - renesas,rcar_sound-r8a7790   # R-Car H2
31              - renesas,rcar_sound-r8a7791   # R-Car M2-W
32              - renesas,rcar_sound-r8a7793   # R-Car M2-N
33              - renesas,rcar_sound-r8a7794   # R-Car E2
34          - const: renesas,rcar_sound-gen2
35      # for Gen3 SoC
36      - items:
37          - enum:
38              - renesas,rcar_sound-r8a774a1  # RZ/G2M
39              - renesas,rcar_sound-r8a774b1  # RZ/G2N
40              - renesas,rcar_sound-r8a774c0  # RZ/G2E
41              - renesas,rcar_sound-r8a774e1  # RZ/G2H
42              - renesas,rcar_sound-r8a7795   # R-Car H3
43              - renesas,rcar_sound-r8a7796   # R-Car M3-W
44              - renesas,rcar_sound-r8a77961  # R-Car M3-W+
45              - renesas,rcar_sound-r8a77965  # R-Car M3-N
46              - renesas,rcar_sound-r8a77990  # R-Car E3
47              - renesas,rcar_sound-r8a77995  # R-Car D3
48          - const: renesas,rcar_sound-gen3
49      # for Gen4 SoC
50      - items:
51          - enum:
52              - renesas,rcar_sound-r8a779g0  # R-Car V4H
53              - renesas,rcar_sound-r8a779h0  # R-Car V4M
54          - const: renesas,rcar_sound-gen4
55      # for Generic
56      - enum:
57          - renesas,rcar_sound-gen1
58          - renesas,rcar_sound-gen2
59          - renesas,rcar_sound-gen3
60          - renesas,rcar_sound-gen4
61
62  reg:
63    minItems: 1
64    maxItems: 5
65
66  reg-names:
67    minItems: 1
68    maxItems: 5
69
70  "#sound-dai-cells":
71    description: |
72      it must be 0 if your system is using single DAI
73      it must be 1 if your system is using multi  DAIs
74      This is used on simple-audio-card
75    enum: [0, 1]
76
77  "#clock-cells":
78    description: |
79      it must be 0 if your system has audio_clkout
80      it must be 1 if your system has audio_clkout0/1/2/3
81    enum: [0, 1]
82
83  "#address-cells":
84    const: 1
85
86  "#size-cells":
87    const: 0
88
89  clock-frequency:
90    description: for audio_clkout0/1/2/3
91
92  clkout-lr-asynchronous:
93    description: audio_clkoutn is asynchronizes with lr-clock.
94    $ref: /schemas/types.yaml#/definitions/flag
95
96  power-domains: true
97
98  resets:
99    minItems: 1
100    maxItems: 11
101
102  reset-names:
103    minItems: 1
104    maxItems: 11
105
106  clocks:
107    description: References to SSI/SRC/MIX/CTU/DVC/AUDIO_CLK clocks.
108    minItems: 1
109    maxItems: 31
110
111  clock-names:
112    description: List of necessary clock names.
113    # details are defined below
114
115  # ports is below
116  port:
117    $ref: audio-graph-port.yaml#/definitions/port-base
118    unevaluatedProperties: false
119    patternProperties:
120      "^endpoint(@[0-9a-f]+)?":
121        $ref: audio-graph-port.yaml#/definitions/endpoint-base
122        properties:
123          playback:
124            $ref: /schemas/types.yaml#/definitions/phandle-array
125          capture:
126            $ref: /schemas/types.yaml#/definitions/phandle-array
127        unevaluatedProperties: false
128
129  rcar_sound,dvc:
130    description: DVC subnode.
131    type: object
132    patternProperties:
133      "^dvc-[0-1]$":
134        type: object
135        additionalProperties: false
136
137        properties:
138          dmas:
139            maxItems: 1
140          dma-names:
141            const: tx
142        required:
143          - dmas
144          - dma-names
145    additionalProperties: false
146
147  rcar_sound,mix:
148    description: MIX subnode.
149    type: object
150    patternProperties:
151      "^mix-[0-1]$":
152        type: object
153        additionalProperties: false
154    additionalProperties: false
155
156  rcar_sound,ctu:
157    description: CTU subnode.
158    type: object
159    patternProperties:
160      "^ctu-[0-7]$":
161        type: object
162        additionalProperties: false
163    additionalProperties: false
164
165  rcar_sound,src:
166    description: SRC subnode.
167    type: object
168    patternProperties:
169      "^src-[0-9]$":
170        type: object
171        additionalProperties: false
172
173        properties:
174          interrupts:
175            maxItems: 1
176          dmas:
177            maxItems: 2
178          dma-names:
179            allOf:
180              - items:
181                  enum:
182                    - tx
183                    - rx
184    additionalProperties: false
185
186  rcar_sound,ssiu:
187    description: SSIU subnode.
188    type: object
189    patternProperties:
190      "^ssiu-[0-9]+$":
191        type: object
192        additionalProperties: false
193
194        properties:
195          dmas:
196            maxItems: 2
197          dma-names:
198            allOf:
199              - items:
200                  enum:
201                    - tx
202                    - rx
203        required:
204          - dmas
205          - dma-names
206    additionalProperties: false
207
208  rcar_sound,ssi:
209    description: SSI subnode.
210    type: object
211    patternProperties:
212      "^ssi-[0-9]$":
213        type: object
214        additionalProperties: false
215
216        properties:
217          interrupts:
218            maxItems: 1
219          dmas:
220            minItems: 2
221            maxItems: 4
222          dma-names:
223            allOf:
224              - items:
225                  enum:
226                    - tx
227                    - rx
228                    - txu # if no ssiu node
229                    - rxu # if no ssiu node
230
231          shared-pin:
232            description: shared clock pin
233            $ref: /schemas/types.yaml#/definitions/flag
234          pio-transfer:
235            description: PIO transfer mode
236            $ref: /schemas/types.yaml#/definitions/flag
237          no-busif:
238            description: BUSIF is not used when [mem -> SSI] via DMA case
239            $ref: /schemas/types.yaml#/definitions/flag
240        required:
241          - interrupts
242    additionalProperties: false
243
244patternProperties:
245  # For DAI base
246  'rcar_sound,dai(@[0-9a-f]+)?$':
247    description: DAI subnode.
248    type: object
249    patternProperties:
250      "^dai([0-9]+)?$":
251        type: object
252        additionalProperties: false
253
254        properties:
255          playback:
256            $ref: /schemas/types.yaml#/definitions/phandle-array
257          capture:
258            $ref: /schemas/types.yaml#/definitions/phandle-array
259        anyOf:
260          - required:
261              - playback
262          - required:
263              - capture
264    additionalProperties: false
265
266  'ports(@[0-9a-f]+)?$':
267    $ref: audio-graph-port.yaml#/definitions/port-base
268    unevaluatedProperties: false
269    patternProperties:
270      '^port(@[0-9a-f]+)?$':
271        $ref: "#/properties/port"
272
273required:
274  - compatible
275  - reg
276  - reg-names
277  - clocks
278  - clock-names
279
280allOf:
281  - $ref: dai-common.yaml#
282
283  # --------------------
284  # reg/reg-names
285  # --------------------
286  # for Gen1
287  - if:
288      properties:
289        compatible:
290          contains:
291            const: renesas,rcar_sound-gen1
292    then:
293      properties:
294        reg:
295          maxItems: 3
296        reg-names:
297          items:
298            enum:
299              - scu
300              - ssi
301              - adg
302  # for Gen2/Gen3
303  - if:
304      properties:
305        compatible:
306          contains:
307            enum:
308              - renesas,rcar_sound-gen2
309              - renesas,rcar_sound-gen3
310    then:
311      properties:
312        reg:
313          minItems: 5
314        reg-names:
315          items:
316            enum:
317              - scu
318              - adg
319              - ssiu
320              - ssi
321              - audmapp
322  # for Gen4
323  - if:
324      properties:
325        compatible:
326          contains:
327            const: renesas,rcar_sound-gen4
328    then:
329      properties:
330        reg:
331          maxItems: 4
332        reg-names:
333          items:
334            enum:
335              - adg
336              - ssiu
337              - ssi
338              - sdmc
339
340  # --------------------
341  # clock-names
342  # --------------------
343  - if:
344      properties:
345        compatible:
346          contains:
347            const: renesas,rcar_sound-gen4
348    then:
349      properties:
350        clock-names:
351          maxItems: 3
352          items:
353            enum:
354              - ssi.0
355              - ssiu.0
356              - clkin
357    else:
358      properties:
359        clock-names:
360          minItems: 1
361          maxItems: 31
362          items:
363            oneOf:
364              - const: ssi-all
365              - pattern: '^ssi\.[0-9]$'
366              - pattern: '^src\.[0-9]$'
367              - pattern: '^mix\.[0-1]$'
368              - pattern: '^ctu\.[0-1]$'
369              - pattern: '^dvc\.[0-1]$'
370              - pattern: '^clk_(a|b|c|i)$'
371
372unevaluatedProperties: false
373
374examples:
375  - |
376    #include <dt-bindings/clock/r8a7790-cpg-mssr.h>
377    #include <dt-bindings/interrupt-controller/arm-gic.h>
378    #include <dt-bindings/power/r8a7790-sysc.h>
379    rcar_sound: sound@ec500000 {
380        #sound-dai-cells = <1>;
381        compatible = "renesas,rcar_sound-r8a7790", "renesas,rcar_sound-gen2";
382        reg = <0xec500000 0x1000>, /* SCU  */
383              <0xec5a0000 0x100>,  /* ADG  */
384              <0xec540000 0x1000>, /* SSIU */
385              <0xec541000 0x280>,  /* SSI  */
386              <0xec740000 0x200>;  /* Audio DMAC peri peri*/
387        reg-names = "scu", "adg", "ssiu", "ssi", "audmapp";
388
389        clocks = <&cpg CPG_MOD 1005>,                      /* SSI-ALL    */
390                 <&cpg CPG_MOD 1006>, <&cpg CPG_MOD 1007>, /* SSI9, SSI8 */
391                 <&cpg CPG_MOD 1008>, <&cpg CPG_MOD 1009>, /* SSI7, SSI6 */
392                 <&cpg CPG_MOD 1010>, <&cpg CPG_MOD 1011>, /* SSI5, SSI4 */
393                 <&cpg CPG_MOD 1012>, <&cpg CPG_MOD 1013>, /* SSI3, SSI2 */
394                 <&cpg CPG_MOD 1014>, <&cpg CPG_MOD 1015>, /* SSI1, SSI0 */
395                 <&cpg CPG_MOD 1022>, <&cpg CPG_MOD 1023>, /* SRC9, SRC8 */
396                 <&cpg CPG_MOD 1024>, <&cpg CPG_MOD 1025>, /* SRC7, SRC6 */
397                 <&cpg CPG_MOD 1026>, <&cpg CPG_MOD 1027>, /* SRC5, SRC4 */
398                 <&cpg CPG_MOD 1028>, <&cpg CPG_MOD 1029>, /* SRC3, SRC2 */
399                 <&cpg CPG_MOD 1030>, <&cpg CPG_MOD 1031>, /* SRC1, SRC0 */
400                 <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>, /* MIX1, MIX0 */
401                 <&cpg CPG_MOD 1020>, <&cpg CPG_MOD 1021>, /* CTU1, CTU0 */
402                 <&cpg CPG_MOD 1019>, <&cpg CPG_MOD 1018>, /* DVC0, DVC1 */
403                 <&audio_clk_a>, <&audio_clk_b>,           /* CLKA, CLKB */
404                 <&audio_clk_c>, <&audio_clk_i>;           /* CLKC, CLKI */
405
406        clock-names = "ssi-all",
407                      "ssi.9", "ssi.8",
408                      "ssi.7", "ssi.6",
409                      "ssi.5", "ssi.4",
410                      "ssi.3", "ssi.2",
411                      "ssi.1", "ssi.0",
412                      "src.9", "src.8",
413                      "src.7", "src.6",
414                      "src.5", "src.4",
415                      "src.3", "src.2",
416                      "src.1", "src.0",
417                      "mix.1", "mix.0",
418                      "ctu.1", "ctu.0",
419                      "dvc.0", "dvc.1",
420                      "clk_a", "clk_b",
421                      "clk_c", "clk_i";
422
423        power-domains = <&sysc R8A7790_PD_ALWAYS_ON>;
424
425        resets = <&cpg 1005>,
426                 <&cpg 1006>, <&cpg 1007>, <&cpg 1008>, <&cpg 1009>,
427                 <&cpg 1010>, <&cpg 1011>, <&cpg 1012>, <&cpg 1013>,
428                 <&cpg 1014>, <&cpg 1015>;
429        reset-names = "ssi-all",
430                      "ssi.9", "ssi.8", "ssi.7", "ssi.6",
431                      "ssi.5", "ssi.4", "ssi.3", "ssi.2",
432                      "ssi.1", "ssi.0";
433
434        rcar_sound,dvc {
435               dvc0: dvc-0 {
436                    dmas = <&audma0 0xbc>;
437                    dma-names = "tx";
438               };
439               dvc1: dvc-1 {
440                    dmas = <&audma0 0xbe>;
441                    dma-names = "tx";
442               };
443        };
444
445        rcar_sound,mix {
446            mix0: mix-0 { };
447            mix1: mix-1 { };
448        };
449
450        rcar_sound,ctu {
451            ctu00: ctu-0 { };
452            ctu01: ctu-1 { };
453            ctu02: ctu-2 { };
454            ctu03: ctu-3 { };
455            ctu10: ctu-4 { };
456            ctu11: ctu-5 { };
457            ctu12: ctu-6 { };
458            ctu13: ctu-7 { };
459        };
460
461        rcar_sound,src {
462            src0: src-0 {
463                status = "disabled";
464            };
465            src1: src-1 {
466                interrupts = <GIC_SPI 353 IRQ_TYPE_LEVEL_HIGH>;
467                dmas = <&audma0 0x87>, <&audma1 0x9c>;
468                dma-names = "rx", "tx";
469            };
470            /* skip after src-2 */
471        };
472
473        rcar_sound,ssiu {
474            ssiu00: ssiu-0 {
475                dmas = <&audma0 0x15>, <&audma1 0x16>;
476                dma-names = "rx", "tx";
477            };
478            ssiu01: ssiu-1 {
479                dmas = <&audma0 0x35>, <&audma1 0x36>;
480                dma-names = "rx", "tx";
481            };
482            /* skip after ssiu-2 */
483        };
484
485        rcar_sound,ssi {
486            ssi0: ssi-0 {
487                interrupts = <GIC_SPI 370 IRQ_TYPE_LEVEL_HIGH>;
488                dmas = <&audma0 0x01>, <&audma1 0x02>;
489                dma-names = "rx", "tx";
490            };
491            ssi1: ssi-1 {
492                interrupts = <GIC_SPI 371 IRQ_TYPE_LEVEL_HIGH>;
493                dmas = <&audma0 0x03>, <&audma1 0x04>;
494                dma-names = "rx", "tx";
495            };
496            /* skip other ssi-2 */
497        };
498
499        /* DAI base */
500        rcar_sound,dai {
501            dai0 {
502                playback = <&ssi5>, <&src5>;
503                capture = <&ssi6>;
504            };
505            dai1 {
506                playback = <&ssi3>;
507            };
508            dai2 {
509                capture = <&ssi4>;
510            };
511            dai3 {
512                playback = <&ssi7>;
513            };
514            dai4 {
515                capture = <&ssi8>;
516            };
517        };
518
519        /* assume audio-graph */
520        port {
521            rsnd_endpoint: endpoint {
522                remote-endpoint = <&codec_endpoint>;
523
524                dai-format = "left_j";
525                bitclock-master = <&rsnd_endpoint0>;
526                frame-master = <&rsnd_endpoint0>;
527
528                playback = <&ssi0>, <&src0>, <&dvc0>;
529                capture = <&ssi1>, <&src1>, <&dvc1>;
530            };
531        };
532    };
533
534    /* assume audio-graph */
535    codec {
536        port {
537            codec_endpoint: endpoint {
538                remote-endpoint = <&rsnd_endpoint>;
539            };
540        };
541    };
542