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