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 * You can indicate more detail each device behavior as debug if you modify
23 * "compatible" on each test-component. see below
24 *
25 *	test_cpu {
26 *	-	compatible = "test-cpu";
27 *	+	compatible = "test-cpu-verbose";
28 *		...
29 *	};
30 *
31 *	test_codec {
32 *	-	compatible = "test-codec";
33 *	+	compatible = "test-codec-verbose";
34 *		...
35 *	};
36 *
37 */
38/ {
39	/*
40	 * @ : used at links
41	 *
42	 * [Normal]
43	 *	cpu0 <-@-----------------> codec0
44	 *
45	 * [Multi-CPU/Codec]
46	 *		+-+		+-+
47	 *	cpu1 <--| |<-@--------->| |-> codec1
48	 *	cpu2 <--| |		| |-> codec2
49	 *		+-+		+-+
50	 *
51	 * [DPCM]
52	 *
53	 *	CPU3/CPU4 are converting rate to 44100
54	 *
55	 *	FE		BE
56	 *		  ****
57	 *	cpu3 <-@--*  *--@-> codec3
58	 *	cpu4 <-@--*  *  (44.1kHz)
59	 *		  ****
60	 *
61	 * [DPCM-Multi]
62	 *
63	 * --NOTE--
64	 * Multi-FE is not supported by ASoC.
65	 *
66	 *	FE		BE
67	 *		  ****	    +-+
68	 *	cpu5 <-@--*  *--@-> | | -> codec4
69	 *	cpu6 <-@--*  *	    | | -> codec5
70	 *		  ****	    +-+
71	 *
72	 * [Codec2Codec]
73	 *			   +-@-> codec6
74	 *			   |
75	 *			   +---> codec7
76	 *
77	 * [Codec2Codec-Multi]
78	 *
79	 * --NOTE--
80	 * Multi connect N:M is not supported by ASoC.
81	 *
82	 *				+-+
83	 *			   +-@->| |-> codec8
84	 *			   |	| |-> codec9
85	 *			   |	+-+
86	 *			   |	+-+
87	 *			   +--->| |-> codec10
88	 *				| |-> codec11
89	 *				+-+
90	 */
91	audio-graph-card2-custom-sample {
92		/*
93		 * You can use audio-graph-card2 directly by using
94		 *
95		 * compatible = "audio-graph-card2";
96		 */
97		compatible = "audio-graph-card2-custom-sample";
98
99			/* for [DPCM]		   */
100			/* BE			FE */
101		routing = "TC DAI3 Playback",	"DAI3 Playback",
102			  "TC DAI3 Playback",	"DAI4 Playback",
103			  "DAI3 Capture",	"TC DAI3 Capture",
104			  "DAI4 Capture",	"TC DAI3 Capture",
105			/* for [DPCM-Multi]	   */
106			/* BE			FE */
107			  "TC DAI4 Playback",	"DAI5 Playback",
108			  "TC DAI5 Playback",	"DAI5 Playback",
109			  "TC DAI4 Playback",	"DAI6 Playback",
110			  "TC DAI5 Playback",	"DAI6 Playback",
111			  "DAI5 Capture",	"TC DAI4 Capture",
112			  "DAI5 Capture",	"TC DAI5 Capture",
113			  "DAI6 Capture",	"TC DAI4 Capture",
114			  "DAI6 Capture",	"TC DAI5 Capture",
115			/* for [Codec2Codec] */
116			  "TC OUT",		"TC DAI7 Playback",
117			  "TC DAI6 Capture",	"TC IN",
118			/* for [Codec2Codec-Multi] */
119			  "TC OUT",		"TC DAI10 Playback",
120			  "TC DAI8 Capture",	"TC IN",
121			  "TC OUT",		"TC DAI11 Playback",
122			  "TC DAI9 Capture",	"TC IN";
123
124		links = <
125			/*
126			 * [Normal]: cpu side only
127			 * cpu0/codec0
128			 */
129			 &cpu0
130
131			/*
132			 * [Multi-CPU/Codec]: cpu side only
133			 * cpu1/cpu2/codec1/codec2
134			 */
135			 &mcpu0
136
137			/*
138			 * [DPCM]: both FE / BE
139			 * cpu3/cpu4/codec3
140			 */
141			 &fe00 &fe01 &be0
142
143			/*
144			 * [DPCM-Multi]: both FE / BE
145			 * cpu5/cpu6/codec4/codec5
146			 */
147			 &fe10 &fe11 &be1
148
149			/*
150			 * [Codec2Codec]: cpu side only
151			 * codec6/codec7
152			 */
153			 &c2c
154
155			/*
156			 * [Codec2Codec-Multi]: cpu side only
157			 * codec8/codec9/codec10/codec11
158			 */
159			 &c2c_m
160		>;
161
162		multi {
163			ports@0 {
164			/* [Multi-CPU] */
165			mcpu0:	port@0 { mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; };
166				port@1 { mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>;    }; };
167				port@2 { mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>;    }; };
168			};
169
170			/* [Multi-Codec] */
171			ports@1 {
172				port@0 { mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>;  }; };
173				port@1 { mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; };
174				port@2 { mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; };
175			};
176
177			/* [DPCM-Multi]::BE */
178			ports@2 {
179				port@0 { mbe_ep:  endpoint { remote-endpoint = <&be10_ep>;  }; };
180				port@1 { mbe1_ep: endpoint { remote-endpoint = <&codec4_ep>; }; };
181				port@2 { mbe2_ep: endpoint { remote-endpoint = <&codec5_ep>; }; };
182			};
183
184			/* [Codec2Codec-Multi]::CPU */
185			ports@3 {
186				port@0 { mc2c0_ep:  endpoint { remote-endpoint = <&c2cmf_ep>;  }; };
187				port@1 { mc2c00_ep: endpoint { remote-endpoint = <&codec8_ep>; }; };
188				port@2 { mc2c01_ep: endpoint { remote-endpoint = <&codec9_ep>; }; };
189			};
190
191			/* [Codec2Codec-Multi]::Codec */
192			ports@4 {
193				port@0 { mc2c1_ep:  endpoint { remote-endpoint = <&c2cmb_ep>;  }; };
194				port@1 { mc2c10_ep: endpoint { remote-endpoint = <&codec10_ep>; }; };
195				port@2 { mc2c11_ep: endpoint { remote-endpoint = <&codec11_ep>; }; };
196			};
197		};
198
199		dpcm {
200			ports@0 {
201			/* [DPCM]::FE */
202			fe00:	port@0 { fe00_ep: endpoint { remote-endpoint = <&cpu3_ep>; }; };
203			fe01:	port@1 { fe01_ep: endpoint { remote-endpoint = <&cpu4_ep>; }; };
204
205			/* [DPCM-Multi]::FE */
206			fe10:	port@2 { fe10_ep: endpoint { remote-endpoint = <&cpu5_ep>; }; };
207			fe11:	port@3 { fe11_ep: endpoint { remote-endpoint = <&cpu6_ep>; }; };
208			};
209
210			ports@1 {
211			/* [DPCM]::BE */
212			be0:	port@0 { be00_ep: endpoint { remote-endpoint = <&codec3_ep>; }; };
213
214			/* [DPCM-Multi]::BE */
215			be1:	port@1 { be10_ep: endpoint { remote-endpoint = <&mbe_ep>; }; };
216			};
217		};
218
219		codec2codec {
220			/* [Codec2Codec] */
221			ports@0 {
222				/* use default settings */
223			c2c:	port@0 { c2cf_ep: endpoint { remote-endpoint = <&codec6_ep>; }; };
224				port@1 { c2cb_ep: endpoint { remote-endpoint = <&codec7_ep>; }; };
225			};
226
227			/* [Codec2Codec-Multi] */
228			ports@1 {
229				/* use original settings */
230				rate = <48000>;
231			c2c_m:	port@0 { c2cmf_ep: endpoint { remote-endpoint = <&mc2c0_ep>; }; };
232				port@1 { c2cmb_ep: endpoint { remote-endpoint = <&mc2c1_ep>; }; };
233			};
234		};
235	};
236
237	test_cpu {
238		/*
239		 * update compatible to indicate more detail behaviour
240		 * if you want. see test-compatible for more detail.
241		 *
242		 * ex)
243		 *	- compatible = "test-cpu";
244		 *	+ compatible = "test-cpu-verbose";
245		 */
246		compatible = "test-cpu";
247		ports {
248			bitclock-master;
249			frame-master;
250			/* [Normal] */
251			cpu0: port@0 { cpu0_ep: endpoint { remote-endpoint = <&codec0_ep>; }; };
252
253			/* [Multi-CPU] */
254			      port@1 { cpu1_ep: endpoint { remote-endpoint = <&mcpu1_ep>; }; };
255			      port@2 { cpu2_ep: endpoint { remote-endpoint = <&mcpu2_ep>; }; };
256
257			/* [DPCM]::FE */
258			      port@3 { cpu3_ep: endpoint { remote-endpoint = <&fe00_ep>; }; };
259			      port@4 { cpu4_ep: endpoint { remote-endpoint = <&fe01_ep>; }; };
260
261			/* [DPCM-Multi]::FE */
262			      port@5 { cpu5_ep: endpoint { remote-endpoint = <&fe10_ep>; }; };
263			      port@6 { cpu6_ep: endpoint { remote-endpoint = <&fe11_ep>; }; };
264		};
265	};
266
267	test_codec {
268		/*
269		 * update compatible to indicate more detail behaviour
270		 * if you want. see test-compatible for more detail.
271		 *
272		 * ex)
273		 *	- compatible = "test-codec";
274		 *	+ compatible = "test-codec-verbose";
275		 */
276		compatible = "test-codec";
277		ports {
278			/*
279			 * prefix can be added to *component*,
280			 * see audio-graph-card2::routing
281			 */
282			prefix = "TC";
283
284			/* [Normal] */
285			port@0  { codec0_ep:  endpoint { remote-endpoint = <&cpu0_ep>; }; };
286
287			/* [Multi-Codec] */
288			port@1  { codec1_ep:  endpoint { remote-endpoint = <&mcodec1_ep>; }; };
289			port@2  { codec2_ep:  endpoint { remote-endpoint = <&mcodec2_ep>; }; };
290
291			/* [DPCM]::BE */
292			port@3  {
293				convert-rate = <44100>;
294				codec3_ep:  endpoint { remote-endpoint = <&be00_ep>; };
295			};
296
297			/* [DPCM-Multi]::BE */
298			port@4  { codec4_ep:  endpoint { remote-endpoint = <&mbe1_ep>; }; };
299			port@5  { codec5_ep:  endpoint { remote-endpoint = <&mbe2_ep>; }; };
300
301			/* [Codec2Codec] */
302			port@6  { bitclock-master;
303				  frame-master;
304				  codec6_ep:  endpoint { remote-endpoint = <&c2cf_ep>; }; };
305			port@7  { codec7_ep:  endpoint { remote-endpoint = <&c2cb_ep>; }; };
306
307			/* [Codec2Codec-Multi] */
308			port@8  { bitclock-master;
309				  frame-master;
310				  codec8_ep:  endpoint { remote-endpoint = <&mc2c00_ep>; }; };
311			port@9  { codec9_ep:  endpoint { remote-endpoint = <&mc2c01_ep>; }; };
312			port@10 { codec10_ep: endpoint { remote-endpoint = <&mc2c10_ep>; }; };
313			port@11 { codec11_ep: endpoint { remote-endpoint = <&mc2c11_ep>; }; };
314		};
315	};
316};
317