1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Device Tree for ULCB + Kingfisher + Audio Graph Card2 (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) CPU3 (2ch)  ----> (8ch) (Y)	PCM3168A-p (TDM-0 : 0,1ch)
15 *	(D) CPU2 (2ch)  --/			   (TDM-1 : 2,3ch)
16 *	(E) CPU4 (2ch)  --/			   (TDM-2 : 4,5ch)
17 *	(F) CPU5 (2ch)  --/			   (TDM-3 : 6,7ch)
18 *	(G) CPU6 (6ch) <----  (6ch) (Z)	PCM3168A-c
19 *
20 *	(A) aplay   -D plughw:0,0 xxx.wav (MIX-0)
21 *	(B) aplay   -D plughw:0,1 xxx.wav (MIX-1)
22 *	(C) aplay   -D plughw:0,2 xxx.wav (TDM-0)
23 *	(D) aplay   -D plughw:0,3 xxx.wav (TDM-1)
24 *	(E) aplay   -D plughw:0,4 xxx.wav (TDM-2)
25 *	(F) aplay   -D plughw:0,5 xxx.wav (TDM-3)
26 *
27 *	(A) arecord -D plughw:0,0 xxx.wav
28 *	(G) arecord -D plughw:0,6 xxx.wav
29 */
30&sound_card {
31	routing = "ak4613 Playback",   "DAI0 Playback",
32		  "ak4613 Playback",   "DAI1 Playback",
33		  "DAI0 Capture",      "ak4613 Capture",
34		  "pcm3168a Playback", "DAI2 Playback",
35		  "pcm3168a Playback", "DAI3 Playback",
36		  "pcm3168a Playback", "DAI4 Playback",
37		  "pcm3168a Playback", "DAI5 Playback",
38		  "DAI6 Capture",      "pcm3168a Capture";
39
40	/delete-property/ dais;
41	links = <&fe_a		/* (A) CPU0	  */
42		 &fe_b		/* (B) CPU1	  */
43		 &fe_c		/* (C) CPU2	  */
44		 &fe_d		/* (D) CPU3	  */
45		 &fe_e		/* (E) CPU4	  */
46		 &fe_f		/* (F) CPU5	  */
47		 &rsnd_g	/* (G) CPU6	  */
48		 &be_x		/* (X) ak4613	  */
49		 &be_y		/* (Y) PCM3168A-p */
50	>;
51
52	dpcm {
53		ports@0 {
54		/*
55		 * FE
56		 *
57		 * (A)/(B) are defined on ulcb
58		 * (C) CPU2
59		 * (D) CPU3
60		 * (E) CPU4
61		 * (F) CPU5
62		 */
63		fe_c:	port@2 { reg = <2>; fe_c_ep: endpoint { remote-endpoint = <&rsnd_c_ep>; }; };
64		fe_d:	port@3 { reg = <3>; fe_d_ep: endpoint { remote-endpoint = <&rsnd_d_ep>; }; };
65		fe_e:	port@4 { reg = <4>; fe_e_ep: endpoint { remote-endpoint = <&rsnd_e_ep>; }; };
66		fe_f:	port@5 { reg = <5>; fe_f_ep: endpoint { remote-endpoint = <&rsnd_f_ep>; }; };
67		};
68
69		ports@1 {
70		/*
71		 * BE
72		 *
73		 * (X) is defined on ulcb
74		 * (Y) PCM3168A-p
75		 */
76		be_y:	port@1 { reg = <1>; be_y_ep: endpoint { remote-endpoint = <&pcm3168a_y_ep>; }; };
77		};
78	};
79};
80
81&pcm3168a {
82	ports {
83		#address-cells = <1>;
84		#size-cells = <0>;
85
86		mclk-fs = <512>;
87		prefix = "pcm3168a";
88
89		/*
90		 * (Y) PCM3168A-p
91		 */
92		port@0 {
93			reg = <0>;
94			convert-channels = <8>; /* to 8ch TDM */
95			pcm3168a_y_ep: endpoint {
96				remote-endpoint = <&be_y_ep>;
97				clocks = <&clksndsel>;
98			};
99		};
100		/*
101		 * (Z) PCM3168A-c
102		 */
103		port@1 {
104			reg = <1>;
105			pcm3168a_z_ep: endpoint {
106				remote-endpoint = <&rsnd_g_ep>;
107				clocks = <&clksndsel>;
108			};
109		};
110	};
111};
112
113&rcar_sound {
114	ports {
115		/* (A)/(B) are defined in ulcb.dtsi */
116
117		/*
118		 * (C) CPU2
119		 */
120		port@2 {
121			reg = <2>;
122			rsnd_c_ep: endpoint {
123				remote-endpoint = <&fe_c_ep>;
124				bitclock-master;
125				frame-master;
126				playback = <&ssiu30 &ssi3>;
127			};
128		};
129		/*
130		 * (D) CPU3
131		 */
132		port@3 {
133			reg = <3>;
134			rsnd_d_ep: endpoint {
135				remote-endpoint = <&fe_d_ep>;
136				bitclock-master;
137				frame-master;
138				playback = <&ssiu31 &ssi3>;
139			};
140		};
141		/*
142		 * (E) CPU4
143		 */
144		port@4 {
145			reg = <4>;
146			rsnd_e_ep: endpoint {
147				remote-endpoint = <&fe_e_ep>;
148				bitclock-master;
149				frame-master;
150				playback = <&ssiu32 &ssi3>;
151			};
152		};
153		/*
154		 * (F) CPU5
155		 */
156		port@5 {
157			reg = <5>;
158			rsnd_f_ep: endpoint {
159				remote-endpoint = <&fe_f_ep>;
160				bitclock-master;
161				frame-master;
162				playback = <&ssiu33 &ssi3>;
163			};
164		};
165		/*
166		 * (G) CPU6
167		 */
168		rsnd_g: port@6 {
169			reg = <6>;
170			rsnd_g_ep: endpoint {
171				remote-endpoint = <&pcm3168a_z_ep>;
172				bitclock-master;
173				frame-master;
174				capture = <&ssi4>;
175			};
176		};
177	};
178};
179