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