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