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