GNU Linux-libre 5.19-rc6-gnu
[releases.git] / sound / soc / generic / audio-graph-card2-custom-sample.dtsi
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * audio-graph-card2-custom-sample.dtsi
4  *
5  * Copyright (C) 2020 Renesas Electronics Corp.
6  * Copyright (C) 2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
7  *
8  * This sample indicates how to use audio-graph-card2 and its
9  * custom driver. "audio-graph-card2-custom-sample" is the custome driver
10  * which is using audio-graph-card2.
11  *
12  * You can easily use this sample by adding below line on your DT file,
13  * and add new CONFIG to your .config.
14  *
15  *      #include "../../../../../sound/soc/generic/audio-graph-card2-custom-sample.dtsi"
16  *
17  *      CONFIG_SND_AUDIO_GRAPH_CARD2
18  *      CONFIG_SND_AUDIO_GRAPH_CARD2_CUSTOM_SAMPLE
19  *      CONFIG_SND_TEST_COMPONENT
20  */
21 / {
22         /*
23          * @ : used at links
24          *
25          * [Normal]
26          *      cpu0 <-@-----------------> codec0
27          *
28          * [Multi-CPU/Codec]
29          *              +-+             +-+
30          *      cpu1 <--| |<-@--------->| |-> codec1
31          *      cpu2 <--| |             | |-> codec2
32          *              +-+             +-+
33          *
34          * [DPCM]
35          *      FE              BE
36          *                ****
37          *      cpu3 <-@--*  *--@-> codec3
38          *      cpu4 <-@--*  *
39          *                ****
40          *
41          * [DPCM-Multi]
42          *
43          * --NOTE--
44          * Multi-FE is not supported by ASoC.
45          *
46          *      FE              BE
47          *                ****      +-+
48          *      cpu5 <-@--*  *--@-> | | -> codec4
49          *      cpu6 <-@--*  *      | | -> codec5
50          *                ****      +-+
51          *
52          * [Codec2Codec]
53          *                         +-@-> codec6
54          *                         |
55          *                         +---> codec7
56          *
57          * [Codec2Codec-Multi]
58          *
59          * --NOTE--
60          * Multi connect N:M is not supported by ASoC.
61          *
62          *                              +-+
63          *                         +-@->| |-> codec8
64          *                         |    | |-> codec9
65          *                         |    +-+
66          *                         |    +-+
67          *                         +--->| |-> codec10
68          *                              | |-> codec11
69          *                              +-+
70          */
71         audio-graph-card2-custom-sample {
72                 /*
73                  * You can use audio-graph-card2 directly by using
74                  *
75                  * compatible = "audio-graph-card2";
76                  */
77                 compatible = "audio-graph-card2-custom-sample";
78
79                         /* for [DPCM]              */
80                         /* BE                   FE */
81                 routing = "TC DAI3 Playback",   "DAI3 Playback",
82                           "TC DAI3 Playback",   "DAI4 Playback",
83                           "DAI3 Capture",       "TC DAI3 Capture",
84                           "DAI4 Capture",       "TC DAI3 Capture",
85                         /* for [DPCM-Multi]        */
86                         /* BE                   FE */
87                           "TC DAI4 Playback",   "DAI5 Playback",
88                           "TC DAI5 Playback",   "DAI5 Playback",
89                           "TC DAI4 Playback",   "DAI6 Playback",
90                           "TC DAI5 Playback",   "DAI6 Playback",
91                           "DAI5 Capture",       "TC DAI4 Capture",
92                           "DAI5 Capture",       "TC DAI5 Capture",
93                           "DAI6 Capture",       "TC DAI4 Capture",
94                           "DAI6 Capture",       "TC DAI5 Capture",
95                         /* for [Codec2Codec] */
96                           "TC OUT",             "TC DAI7 Playback",
97                           "TC DAI6 Capture",    "TC IN",
98                         /* for [Codec2Codec-Multi] */
99                           "TC OUT",             "TC DAI10 Playback",
100                           "TC DAI8 Capture",    "TC IN",
101                           "TC OUT",             "TC DAI11 Playback",
102                           "TC DAI9 Capture",    "TC IN";
103
104                 links = <&cpu0                  /* normal: cpu side only */
105                          &mcpu0                 /* multi:  cpu side only */
106                          &fe00 &fe01 &be0       /* dpcm:   both FE / BE  */
107                          &fe10 &fe11 &be1       /* dpcm-m: both FE / BE  */
108                          &c2c                   /* c2c:    cpu side only */
109                          &c2c_m                 /* c2c:    cpu side only */
110                 >;
111
112                 multi {
113                         ports@0 {
114                         mcpu0:  port@0 { mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; };
115                                 port@1 { mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>;    }; };
116                                 port@2 { mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>;    }; };
117                         };
118                         ports@1 {
119                                 port@0 { mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>;  }; };
120                                 port@1 { mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; };
121                                 port@2 { mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; };
122                         };
123                         ports@2 {
124                                 port@0 { mbe_ep:  endpoint { remote-endpoint = <&be10_ep>;  }; };
125                                 port@1 { mbe1_ep: endpoint { remote-endpoint = <&codec4_ep>; }; };
126                                 port@2 { mbe2_ep: endpoint { remote-endpoint = <&codec5_ep>; }; };
127                         };
128                         ports@3 {
129                                 port@0 { mc2c0_ep:  endpoint { remote-endpoint = <&c2cmf_ep>;  }; };
130                                 port@1 { mc2c00_ep: endpoint { remote-endpoint = <&codec8_ep>; }; };
131                                 port@2 { mc2c01_ep: endpoint { remote-endpoint = <&codec9_ep>; }; };
132                         };
133                         ports@4 {
134                                 port@0 { mc2c1_ep:  endpoint { remote-endpoint = <&c2cmb_ep>;  }; };
135                                 port@1 { mc2c10_ep: endpoint { remote-endpoint = <&codec10_ep>; }; };
136                                 port@2 { mc2c11_ep: endpoint { remote-endpoint = <&codec11_ep>; }; };
137                         };
138                 };
139
140                 dpcm {
141                         /* FE */
142                         ports@0 {
143                         fe00:   port@0 { fe00_ep: endpoint { remote-endpoint = <&cpu3_ep>; }; };
144                         fe01:   port@1 { fe01_ep: endpoint { remote-endpoint = <&cpu4_ep>; }; };
145                         fe10:   port@2 { fe10_ep: endpoint { remote-endpoint = <&cpu5_ep>; }; };
146                         fe11:   port@3 { fe11_ep: endpoint { remote-endpoint = <&cpu6_ep>; }; };
147                         };
148                         /* BE */
149                         ports@1 {
150                         be0:    port@0 { be00_ep: endpoint { remote-endpoint = <&codec3_ep>; }; };
151                         be1:    port@1 { be10_ep: endpoint { remote-endpoint = <&mbe_ep>; }; };
152                         };
153                 };
154
155                 codec2codec {
156                         ports@0 {
157                                 rate = <48000>;
158                         c2c:    port@0 { c2cf_ep: endpoint { remote-endpoint = <&codec6_ep>; }; };
159                                 port@1 { c2cb_ep: endpoint { remote-endpoint = <&codec7_ep>; }; };
160                         };
161                         ports@1 {
162                                 rate = <48000>;
163                         c2c_m:  port@0 { c2cmf_ep: endpoint { remote-endpoint = <&mc2c0_ep>; }; };
164                                 port@1 { c2cmb_ep: endpoint { remote-endpoint = <&mc2c1_ep>; }; };
165                         };
166                 };
167         };
168
169         test_cpu {
170                 /*
171                  * update compatible to indicate more detail behaviour
172                  * if you want. see test-compatible for more detail.
173                  *
174                  * ex)
175                  *      - compatible = "test-cpu";
176                  *      + compatible = "test-cpu-verbose";
177                  */
178                 compatible = "test-cpu";
179                 ports {
180                         bitclock-master;
181                         frame-master;
182                         cpu0: port@0 { cpu0_ep: endpoint { remote-endpoint = <&codec0_ep>; }; };
183                               port@1 { cpu1_ep: endpoint { remote-endpoint = <&mcpu1_ep>; }; };
184                               port@2 { cpu2_ep: endpoint { remote-endpoint = <&mcpu2_ep>; }; };
185                               port@3 { cpu3_ep: endpoint { remote-endpoint = <&fe00_ep>; }; };
186                               port@4 { cpu4_ep: endpoint { remote-endpoint = <&fe01_ep>; }; };
187                               port@5 { cpu5_ep: endpoint { remote-endpoint = <&fe10_ep>; }; };
188                               port@6 { cpu6_ep: endpoint { remote-endpoint = <&fe11_ep>; }; };
189                 };
190         };
191
192         test_codec {
193                 /*
194                  * update compatible to indicate more detail behaviour
195                  * if you want. see test-compatible for more detail.
196                  *
197                  * ex)
198                  *      - compatible = "test-codec";
199                  *      + compatible = "test-codec-verbose";
200                  */
201                 compatible = "test-codec";
202                 ports {
203                         /*
204                          * prefix can be added to *component*,
205                          * see audio-graph-card2::routing
206                          */
207                         prefix = "TC";
208
209                         port@0  { codec0_ep:  endpoint { remote-endpoint = <&cpu0_ep>; }; };
210                         port@1  { codec1_ep:  endpoint { remote-endpoint = <&mcodec1_ep>; }; };
211                         port@2  { codec2_ep:  endpoint { remote-endpoint = <&mcodec2_ep>; }; };
212                         port@3  { codec3_ep:  endpoint { remote-endpoint = <&be00_ep>; }; };
213                         port@4  { codec4_ep:  endpoint { remote-endpoint = <&mbe1_ep>; }; };
214                         port@5  { codec5_ep:  endpoint { remote-endpoint = <&mbe2_ep>; }; };
215                         port@6  { bitclock-master;
216                                   frame-master;
217                                   codec6_ep:  endpoint { remote-endpoint = <&c2cf_ep>; }; };
218                         port@7  { codec7_ep:  endpoint { remote-endpoint = <&c2cb_ep>; }; };
219                         port@8  { bitclock-master;
220                                   frame-master;
221                                   codec8_ep:  endpoint { remote-endpoint = <&mc2c00_ep>; }; };
222                         port@9  { codec9_ep:  endpoint { remote-endpoint = <&mc2c01_ep>; }; };
223                         port@10 { codec10_ep: endpoint { remote-endpoint = <&mc2c10_ep>; }; };
224                         port@11 { codec11_ep: endpoint { remote-endpoint = <&mc2c11_ep>; }; };
225                 };
226         };
227 };