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          - enum:
22              - renesas,rcar_sound-gen1
23      # for Gen2 SoC
24      - items:
25          - enum:
26              - renesas,rcar_sound-r8a7742   # RZ/G1H
27              - renesas,rcar_sound-r8a7743   # RZ/G1M
28              - renesas,rcar_sound-r8a7744   # RZ/G1N
29              - renesas,rcar_sound-r8a7745   # RZ/G1E
30              - renesas,rcar_sound-r8a77470  # RZ/G1C
31              - renesas,rcar_sound-r8a7790   # R-Car H2
32              - renesas,rcar_sound-r8a7791   # R-Car M2-W
33              - renesas,rcar_sound-r8a7793   # R-Car M2-N
34              - renesas,rcar_sound-r8a7794   # R-Car E2
35          - enum:
36              - renesas,rcar_sound-gen2
37      # for Gen3 SoC
38      - items:
39          - enum:
40              - renesas,rcar_sound-r8a774a1  # RZ/G2M
41              - renesas,rcar_sound-r8a774b1  # RZ/G2N
42              - renesas,rcar_sound-r8a774c0  # RZ/G2E
43              - renesas,rcar_sound-r8a774e1  # RZ/G2H
44              - renesas,rcar_sound-r8a7795   # R-Car H3
45              - renesas,rcar_sound-r8a7796   # R-Car M3-W
46              - renesas,rcar_sound-r8a77961  # R-Car M3-W+
47              - renesas,rcar_sound-r8a77965  # R-Car M3-N
48              - renesas,rcar_sound-r8a77990  # R-Car E3
49              - renesas,rcar_sound-r8a77995  # R-Car D3
50          - enum:
51              - renesas,rcar_sound-gen3
52      # for Generic
53      - items:
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    enum: [0, 1]
72
73  "#clock-cells":
74    description: |
75      it must be 0 if your system has audio_clkout
76      it must be 1 if your system has audio_clkout0/1/2/3
77    enum: [0, 1]
78
79  clock-frequency:
80    description: for audio_clkout0/1/2/3
81
82  clkout-lr-asynchronous:
83    description: audio_clkoutn is asynchronizes with lr-clock.
84    $ref: /schemas/types.yaml#/definitions/flag
85
86  power-domains: true
87
88  resets:
89    minItems: 1
90    maxItems: 11
91
92  reset-names:
93    minItems: 1
94    maxItems: 11
95
96  clocks:
97    description: References to SSI/SRC/MIX/CTU/DVC/AUDIO_CLK clocks.
98    minItems: 1
99    maxItems: 31
100
101  clock-names:
102    description: List of necessary clock names.
103    minItems: 1
104    maxItems: 31
105    items:
106      oneOf:
107        - const: ssi-all
108        - pattern: '^ssi\.[0-9]$'
109        - pattern: '^src\.[0-9]$'
110        - pattern: '^mix\.[0-1]$'
111        - pattern: '^ctu\.[0-1]$'
112        - pattern: '^dvc\.[0-1]$'
113        - pattern: '^clk_(a|b|c|i)$'
114
115  ports:
116    $ref: /schemas/graph.yaml#/properties/ports
117    patternProperties:
118      '^port(@[0-9a-f]+)?$':
119        $ref: audio-graph-port.yaml#
120        unevaluatedProperties: false
121
122  port:
123    $ref: audio-graph-port.yaml#
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        required:
182          - interrupts
183          - dmas
184          - dma-names
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          - dmas
244          - dma-names
245    additionalProperties: false
246
247  # For DAI base
248  rcar_sound,dai:
249    description: DAI subnode.
250    type: object
251    patternProperties:
252      "^dai([0-9]+)?$":
253        type: object
254        additionalProperties: false
255
256        properties:
257          playback:
258            $ref: /schemas/types.yaml#/definitions/phandle-array
259          capture:
260            $ref: /schemas/types.yaml#/definitions/phandle-array
261        anyOf:
262          - required:
263              - playback
264          - required:
265              - capture
266    additionalProperties: false
267
268required:
269  - compatible
270  - reg
271  - reg-names
272  - clocks
273  - clock-names
274  - "#sound-dai-cells"
275
276allOf:
277  - $ref: dai-common.yaml#
278  - if:
279      properties:
280        compatible:
281          contains:
282            const: renesas,rcar_sound-gen1
283    then:
284      properties:
285        reg:
286          maxItems: 3
287        reg-names:
288          maxItems: 3
289          items:
290            enum:
291              - scu
292              - ssi
293              - adg
294    else:
295      properties:
296        reg:
297          maxItems: 5
298        reg-names:
299          maxItems: 5
300          items:
301            enum:
302              - scu
303              - adg
304              - ssiu
305              - ssi
306              - audmapp
307
308unevaluatedProperties: false
309
310examples:
311  - |
312    rcar_sound: sound@ec500000 {
313        #sound-dai-cells = <1>;
314        compatible = "renesas,rcar_sound-r8a7790", "renesas,rcar_sound-gen2";
315        reg = <0xec500000 0x1000>, /* SCU  */
316              <0xec5a0000 0x100>,  /* ADG  */
317              <0xec540000 0x1000>, /* SSIU */
318              <0xec541000 0x1280>, /* SSI  */
319              <0xec740000 0x200>;  /* Audio DMAC peri peri*/
320        reg-names = "scu", "adg", "ssiu", "ssi", "audmapp";
321
322        clocks = <&mstp10_clks 1005>,                      /* SSI-ALL    */
323                 <&mstp10_clks 1006>, <&mstp10_clks 1007>, /* SSI9, SSI8 */
324                 <&mstp10_clks 1008>, <&mstp10_clks 1009>, /* SSI7, SSI6 */
325                 <&mstp10_clks 1010>, <&mstp10_clks 1011>, /* SSI5, SSI4 */
326                 <&mstp10_clks 1012>, <&mstp10_clks 1013>, /* SSI3, SSI2 */
327                 <&mstp10_clks 1014>, <&mstp10_clks 1015>, /* SSI1, SSI0 */
328                 <&mstp10_clks 1022>, <&mstp10_clks 1023>, /* SRC9, SRC8 */
329                 <&mstp10_clks 1024>, <&mstp10_clks 1025>, /* SRC7, SRC6 */
330                 <&mstp10_clks 1026>, <&mstp10_clks 1027>, /* SRC5, SRC4 */
331                 <&mstp10_clks 1028>, <&mstp10_clks 1029>, /* SRC3, SRC2 */
332                 <&mstp10_clks 1030>, <&mstp10_clks 1031>, /* SRC1, SRC0 */
333                 <&mstp10_clks 1020>, <&mstp10_clks 1021>, /* MIX1, MIX0 */
334                 <&mstp10_clks 1020>, <&mstp10_clks 1021>, /* CTU1, CTU0 */
335                 <&mstp10_clks 1019>, <&mstp10_clks 1018>, /* DVC0, DVC1 */
336                 <&audio_clk_a>, <&audio_clk_b>,           /* CLKA, CLKB */
337                 <&audio_clk_c>, <&audio_clk_i>;           /* CLKC, CLKI */
338
339        clock-names = "ssi-all",
340                      "ssi.9", "ssi.8",
341                      "ssi.7", "ssi.6",
342                      "ssi.5", "ssi.4",
343                      "ssi.3", "ssi.2",
344                      "ssi.1", "ssi.0",
345                      "src.9", "src.8",
346                      "src.7", "src.6",
347                      "src.5", "src.4",
348                      "src.3", "src.2",
349                      "src.1", "src.0",
350                      "mix.1", "mix.0",
351                      "ctu.1", "ctu.0",
352                      "dvc.0", "dvc.1",
353                      "clk_a", "clk_b",
354                      "clk_c", "clk_i";
355
356        rcar_sound,dvc {
357               dvc0: dvc-0 {
358                    dmas = <&audma0 0xbc>;
359                    dma-names = "tx";
360               };
361               dvc1: dvc-1 {
362                    dmas = <&audma0 0xbe>;
363                    dma-names = "tx";
364               };
365        };
366
367        rcar_sound,mix {
368            mix0: mix-0 { };
369            mix1: mix-1 { };
370        };
371
372        rcar_sound,ctu {
373            ctu00: ctu-0 { };
374            ctu01: ctu-1 { };
375            ctu02: ctu-2 { };
376            ctu03: ctu-3 { };
377            ctu10: ctu-4 { };
378            ctu11: ctu-5 { };
379            ctu12: ctu-6 { };
380            ctu13: ctu-7 { };
381        };
382
383        rcar_sound,src {
384            src0: src-0 {
385                status = "disabled";
386            };
387            src1: src-1 {
388                interrupts = <0 353 0>;
389                dmas = <&audma0 0x87>, <&audma1 0x9c>;
390                dma-names = "rx", "tx";
391            };
392            /* skip after src-2 */
393        };
394
395        rcar_sound,ssiu {
396            ssiu00: ssiu-0 {
397                dmas = <&audma0 0x15>, <&audma1 0x16>;
398                dma-names = "rx", "tx";
399            };
400            ssiu01: ssiu-1 {
401                dmas = <&audma0 0x35>, <&audma1 0x36>;
402                dma-names = "rx", "tx";
403            };
404            /* skip after ssiu-2 */
405        };
406
407        rcar_sound,ssi {
408            ssi0: ssi-0 {
409                interrupts = <0 370 1>;
410                dmas = <&audma0 0x01>, <&audma1 0x02>;
411                dma-names = "rx", "tx";
412            };
413            ssi1: ssi-1 {
414                interrupts = <0 371 1>;
415                dmas = <&audma0 0x03>, <&audma1 0x04>;
416                dma-names = "rx", "tx";
417            };
418            /* skip other ssi-2 */
419        };
420
421        /* DAI base */
422        rcar_sound,dai {
423            dai0 {
424                playback = <&ssi5>, <&src5>;
425                capture  = <&ssi6>;
426            };
427            dai1 {
428                playback = <&ssi3>;
429            };
430            dai2 {
431                capture  = <&ssi4>;
432            };
433            dai3 {
434                playback = <&ssi7>;
435            };
436            dai4 {
437                capture  = <&ssi8>;
438            };
439        };
440
441        /* assume audio-graph */
442        port {
443            rsnd_endpoint: endpoint {
444                remote-endpoint = <&codec_endpoint>;
445
446                dai-format = "left_j";
447                bitclock-master = <&rsnd_endpoint0>;
448                frame-master = <&rsnd_endpoint0>;
449
450                playback = <&ssi0>, <&src0>, <&dvc0>;
451                capture  = <&ssi1>, <&src1>, <&dvc1>;
452            };
453        };
454    };
455
456
457    /* assume audio-graph */
458    codec {
459        port {
460            codec_endpoint: endpoint {
461                remote-endpoint = <&rsnd_endpoint>;
462            };
463        };
464    };
465