1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Device Tree for ULCB + Kingfisher + Audio Graph Card (MIX + TDM Split)
4 *
5 * Copyright (C) 2022 Renesas Electronics Corp.
6 */
7
8/*
9 * Note:
10 * The HDMI output is ignored due to the limited number of subdevices
11 *
12 *	(A) CPU0 (2ch) <----> (2ch) (X) ak4613	   (MIX-0)
13 *	(B) CPU1 (2ch)  --/			   (MIX-1)
14 *	(C) CPU2 (2ch)  ----> (8ch) (Y) PCM3168A-p (TDM-0 : 0,1ch)
15 *	(D) CPU3 (2ch)  --/			   (TDM-1 : 2,3ch)
16 *	(E) CPU4 (2ch)  --/			   (TDM-2 : 4,5ch)
17 *	(F) CPU5 (2ch)  --/			   (TDM-3 : 6,7ch)
18 *	(G) CPU6 (2ch) <----  (6ch) (Z) PCM3168A-c (TDM-a: 0,1ch)
19 *	(H) CPU7 (2ch) <--/			   (TDM-b: 2,3ch)
20 *	(I) CPU8 (2ch) <--/			   (TDM-c: 4,5ch)
21 *
22 *	(A) aplay   -D plughw:0,0 xxx.wav (MIX-0)
23 *	(B) aplay   -D plughw:0,1 xxx.wav (MIX-1)
24 *	(C) aplay   -D plughw:1,0 xxx.wav (TDM-0)
25 *	(D) aplay   -D plughw:1,1 xxx.wav (TDM-1)
26 *	(E) aplay   -D plughw:1,2 xxx.wav (TDM-2)
27 *	(F) aplay   -D plughw:1,3 xxx.wav (TDM-3)
28 *
29 *	(A) arecord -D plughw:0,0 xxx.wav
30 *	(G) arecord -D plughw:1,4 xxx.wav (TDM-a)
31 *	(H) arecord -D plughw:1,5 xxx.wav (TDM-b)
32 *	(I) arecord -D plughw:1,6 xxx.wav (TDM-c)
33 */
34/ {
35	sound_card_kf: expand-sound {
36		compatible = "audio-graph-scu-card";
37		label = "snd-kf-split";
38
39		routing = "pcm3168a Playback", "DAI2 Playback",
40			  "pcm3168a Playback", "DAI3 Playback",
41			  "pcm3168a Playback", "DAI4 Playback",
42			  "pcm3168a Playback", "DAI5 Playback",
43			  "DAI6 Capture", "pcm3168a Capture",
44			  "DAI7 Capture", "pcm3168a Capture",
45			  "DAI8 Capture", "pcm3168a Capture";
46
47		dais = <&snd_kf1 /* (C) CPU2 */
48			&snd_kf2 /* (D) CPU3 */
49			&snd_kf3 /* (E) CPU4 */
50			&snd_kf4 /* (F) CPU5 */
51			&snd_kf5 /* (G) CPU6 */
52			&snd_kf6 /* (H) CPU7 */
53			&snd_kf7 /* (I) CPU8 */
54		>;
55	};
56};
57
58&pcm3168a {
59	ports {
60		#address-cells = <1>;
61		#size-cells = <0>;
62
63		mclk-fs = <512>;
64		prefix = "pcm3168a";
65
66		/*
67		 * (Y) PCM3168A-p
68		 */
69		port@0 {
70			#address-cells = <1>;
71			#size-cells = <0>;
72			reg = <0>;
73			convert-channels = <8>; /* to 8ch TDM */
74
75			/* (C) CPU2 -> (Y) PCM3168A-p */
76			pcm3168a_endpoint_p1: endpoint@0 {
77				reg = <0>;
78				remote-endpoint = <&rsnd_for_pcm3168a_play1>;
79				clocks = <&clksndsel>;
80			};
81			/* (D) CPU3 -> (Y) PCM3168A-p */
82			pcm3168a_endpoint_p2: endpoint@1 {
83				reg = <1>;
84				remote-endpoint = <&rsnd_for_pcm3168a_play2>;
85				clocks = <&clksndsel>;
86			};
87			/* (E) CPU4 -> (Y) PCM3168A-p */
88			pcm3168a_endpoint_p3: endpoint@2 {
89				reg = <2>;
90				remote-endpoint = <&rsnd_for_pcm3168a_play3>;
91				clocks = <&clksndsel>;
92			};
93			/* (F) CPU5 -> (Y) PCM3168A-p */
94			pcm3168a_endpoint_p4: endpoint@3 {
95				reg = <3>;
96				remote-endpoint = <&rsnd_for_pcm3168a_play4>;
97				clocks = <&clksndsel>;
98			};
99		};
100		/*
101		 * (Z) PCM3168A-c
102		 */
103		port@1 {
104			#address-cells = <1>;
105			#size-cells = <0>;
106			reg = <1>;
107
108			convert-channels = <6>; /* to 6ch TDM */
109
110			/* (G) CPU6 <- PCM3168A-c */
111			pcm3168a_endpoint_c1: endpoint@0 {
112				reg = <0>;
113				remote-endpoint = <&rsnd_for_pcm3168a_capture1>;
114				clocks = <&clksndsel>;
115			};
116			/* (H) CPU7 <- PCM3168A-c */
117			pcm3168a_endpoint_c2: endpoint@1 {
118				reg = <1>;
119				remote-endpoint = <&rsnd_for_pcm3168a_capture2>;
120				clocks = <&clksndsel>;
121			};
122			/* (I) CPU8 <- PCM3168A-c */
123			pcm3168a_endpoint_c3: endpoint@2 {
124				reg = <2>;
125				remote-endpoint = <&rsnd_for_pcm3168a_capture3>;
126				clocks = <&clksndsel>;
127			};
128		};
129	};
130};
131
132&rcar_sound {
133	ports@1 {
134		#address-cells = <1>;
135		#size-cells = <0>;
136		reg = <1>;
137
138		/*
139		 * (C) CPU2
140		 */
141		snd_kf1: port@2 {
142			reg = <2>;
143			rsnd_for_pcm3168a_play1: endpoint {
144				remote-endpoint = <&pcm3168a_endpoint_p1>;
145				bitclock-master;
146				frame-master;
147				playback = <&ssiu30 &ssi3>;
148			};
149		};
150		/*
151		 * (D) CPU3
152		 */
153		snd_kf2: port@3 {
154			reg = <3>;
155			rsnd_for_pcm3168a_play2: endpoint {
156				remote-endpoint = <&pcm3168a_endpoint_p2>;
157				bitclock-master;
158				frame-master;
159				playback = <&ssiu31 &ssi3>;
160			};
161		};
162		/*
163		 * (E) CPU4
164		 */
165		snd_kf3: port@4 {
166			reg = <4>;
167			rsnd_for_pcm3168a_play3: endpoint {
168				remote-endpoint = <&pcm3168a_endpoint_p3>;
169				bitclock-master;
170				frame-master;
171				playback = <&ssiu32 &ssi3>;
172			};
173		};
174		/*
175		 * (F) CPU5
176		 */
177		snd_kf4: port@5 {
178			reg = <5>;
179			rsnd_for_pcm3168a_play4: endpoint {
180				remote-endpoint = <&pcm3168a_endpoint_p4>;
181				bitclock-master;
182				frame-master;
183				playback = <&ssiu33 &ssi3>;
184			};
185		};
186		/*
187		 * (G) CPU6
188		 */
189		snd_kf5: port@6 {
190			reg = <6>;
191			rsnd_for_pcm3168a_capture1: endpoint {
192				remote-endpoint = <&pcm3168a_endpoint_c1>;
193				bitclock-master;
194				frame-master;
195				capture = <&ssiu40 &ssi4>;
196			};
197		};
198		/*
199		 * (H) CPU7
200		 */
201		snd_kf6: port@7 {
202			reg = <7>;
203			rsnd_for_pcm3168a_capture2: endpoint {
204				remote-endpoint = <&pcm3168a_endpoint_c2>;
205				bitclock-master;
206				frame-master;
207				capture = <&ssiu41 &ssi4>;
208			};
209		};
210		/*
211		 * (I) CPU8
212		 */
213		snd_kf7: port@8 {
214			reg = <8>;
215			rsnd_for_pcm3168a_capture3: endpoint {
216				remote-endpoint = <&pcm3168a_endpoint_c3>;
217				bitclock-master;
218				frame-master;
219				capture = <&ssiu42 &ssi4>;
220			};
221		};
222	};
223};
224