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