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