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  - if:
278      properties:
279        compatible:
280          contains:
281            const: renesas,rcar_sound-gen1
282    then:
283      properties:
284        reg:
285          maxItems: 3
286        reg-names:
287          maxItems: 3
288          items:
289            enum:
290              - scu
291              - ssi
292              - adg
293    else:
294      properties:
295        reg:
296          maxItems: 5
297        reg-names:
298          maxItems: 5
299          items:
300            enum:
301              - scu
302              - adg
303              - ssiu
304              - ssi
305              - audmapp
306
307additionalProperties: false
308
309examples:
310  - |
311    rcar_sound: sound@ec500000 {
312        #sound-dai-cells = <1>;
313        compatible = "renesas,rcar_sound-r8a7790", "renesas,rcar_sound-gen2";
314        reg = <0xec500000 0x1000>, /* SCU  */
315              <0xec5a0000 0x100>,  /* ADG  */
316              <0xec540000 0x1000>, /* SSIU */
317              <0xec541000 0x1280>, /* SSI  */
318              <0xec740000 0x200>;  /* Audio DMAC peri peri*/
319        reg-names = "scu", "adg", "ssiu", "ssi", "audmapp";
320
321        clocks = <&mstp10_clks 1005>,                      /* SSI-ALL    */
322                 <&mstp10_clks 1006>, <&mstp10_clks 1007>, /* SSI9, SSI8 */
323                 <&mstp10_clks 1008>, <&mstp10_clks 1009>, /* SSI7, SSI6 */
324                 <&mstp10_clks 1010>, <&mstp10_clks 1011>, /* SSI5, SSI4 */
325                 <&mstp10_clks 1012>, <&mstp10_clks 1013>, /* SSI3, SSI2 */
326                 <&mstp10_clks 1014>, <&mstp10_clks 1015>, /* SSI1, SSI0 */
327                 <&mstp10_clks 1022>, <&mstp10_clks 1023>, /* SRC9, SRC8 */
328                 <&mstp10_clks 1024>, <&mstp10_clks 1025>, /* SRC7, SRC6 */
329                 <&mstp10_clks 1026>, <&mstp10_clks 1027>, /* SRC5, SRC4 */
330                 <&mstp10_clks 1028>, <&mstp10_clks 1029>, /* SRC3, SRC2 */
331                 <&mstp10_clks 1030>, <&mstp10_clks 1031>, /* SRC1, SRC0 */
332                 <&mstp10_clks 1020>, <&mstp10_clks 1021>, /* MIX1, MIX0 */
333                 <&mstp10_clks 1020>, <&mstp10_clks 1021>, /* CTU1, CTU0 */
334                 <&mstp10_clks 1019>, <&mstp10_clks 1018>, /* DVC0, DVC1 */
335                 <&audio_clk_a>, <&audio_clk_b>,           /* CLKA, CLKB */
336                 <&audio_clk_c>, <&audio_clk_i>;           /* CLKC, CLKI */
337
338        clock-names = "ssi-all",
339                      "ssi.9", "ssi.8",
340                      "ssi.7", "ssi.6",
341                      "ssi.5", "ssi.4",
342                      "ssi.3", "ssi.2",
343                      "ssi.1", "ssi.0",
344                      "src.9", "src.8",
345                      "src.7", "src.6",
346                      "src.5", "src.4",
347                      "src.3", "src.2",
348                      "src.1", "src.0",
349                      "mix.1", "mix.0",
350                      "ctu.1", "ctu.0",
351                      "dvc.0", "dvc.1",
352                      "clk_a", "clk_b",
353                      "clk_c", "clk_i";
354
355        rcar_sound,dvc {
356               dvc0: dvc-0 {
357                    dmas = <&audma0 0xbc>;
358                    dma-names = "tx";
359               };
360               dvc1: dvc-1 {
361                    dmas = <&audma0 0xbe>;
362                    dma-names = "tx";
363               };
364        };
365
366        rcar_sound,mix {
367            mix0: mix-0 { };
368            mix1: mix-1 { };
369        };
370
371        rcar_sound,ctu {
372            ctu00: ctu-0 { };
373            ctu01: ctu-1 { };
374            ctu02: ctu-2 { };
375            ctu03: ctu-3 { };
376            ctu10: ctu-4 { };
377            ctu11: ctu-5 { };
378            ctu12: ctu-6 { };
379            ctu13: ctu-7 { };
380        };
381
382        rcar_sound,src {
383            src0: src-0 {
384                status = "disabled";
385            };
386            src1: src-1 {
387                interrupts = <0 353 0>;
388                dmas = <&audma0 0x87>, <&audma1 0x9c>;
389                dma-names = "rx", "tx";
390            };
391            /* skip after src-2 */
392        };
393
394        rcar_sound,ssiu {
395            ssiu00: ssiu-0 {
396                dmas = <&audma0 0x15>, <&audma1 0x16>;
397                dma-names = "rx", "tx";
398            };
399            ssiu01: ssiu-1 {
400                dmas = <&audma0 0x35>, <&audma1 0x36>;
401                dma-names = "rx", "tx";
402            };
403            /* skip after ssiu-2 */
404        };
405
406        rcar_sound,ssi {
407            ssi0: ssi-0 {
408                interrupts = <0 370 1>;
409                dmas = <&audma0 0x01>, <&audma1 0x02>;
410                dma-names = "rx", "tx";
411            };
412            ssi1: ssi-1 {
413                interrupts = <0 371 1>;
414                dmas = <&audma0 0x03>, <&audma1 0x04>;
415                dma-names = "rx", "tx";
416            };
417            /* skip other ssi-2 */
418        };
419
420        /* DAI base */
421        rcar_sound,dai {
422            dai0 {
423                playback = <&ssi5>, <&src5>;
424                capture  = <&ssi6>;
425            };
426            dai1 {
427                playback = <&ssi3>;
428            };
429            dai2 {
430                capture  = <&ssi4>;
431            };
432            dai3 {
433                playback = <&ssi7>;
434            };
435            dai4 {
436                capture  = <&ssi8>;
437            };
438        };
439
440        /* assume audio-graph */
441        port {
442            rsnd_endpoint: endpoint {
443                remote-endpoint = <&codec_endpoint>;
444
445                dai-format = "left_j";
446                bitclock-master = <&rsnd_endpoint0>;
447                frame-master = <&rsnd_endpoint0>;
448
449                playback = <&ssi0>, <&src0>, <&dvc0>;
450                capture  = <&ssi1>, <&src1>, <&dvc1>;
451            };
452        };
453    };
454
455
456    /* assume audio-graph */
457    codec {
458        port {
459            codec_endpoint: endpoint {
460                remote-endpoint = <&rsnd_endpoint>;
461            };
462        };
463    };
464