1Audio Graph Card:
2
3Audio Graph Card specifies audio DAI connections of SoC <-> codec.
4It is based on common bindings for device graphs.
5see ${LINUX}/Documentation/devicetree/bindings/graph.txt
6
7Basically, Audio Graph Card property is same as Simple Card.
8see ${LINUX}/Documentation/devicetree/bindings/sound/simple-card.yaml
9
10Below are same as Simple-Card.
11
12- label
13- widgets
14- routing
15- dai-format
16- frame-master
17- bitclock-master
18- bitclock-inversion
19- frame-inversion
20- mclk-fs
21- hp-det-gpio
22- mic-det-gpio
23- dai-tdm-slot-num
24- dai-tdm-slot-width
25- clocks / system-clock-frequency
26
27Required properties:
28
29- compatible				: "audio-graph-card";
30- dais					: list of CPU DAI port{s}
31
32Optional properties:
33- pa-gpios: GPIO used to control external amplifier.
34
35-----------------------
36Example: Single DAI case
37-----------------------
38
39	sound_card {
40		compatible = "audio-graph-card";
41
42		dais = <&cpu_port>;
43	};
44
45	dai-controller {
46		...
47		cpu_port: port {
48			cpu_endpoint: endpoint {
49				remote-endpoint = <&codec_endpoint>;
50
51				dai-format = "left_j";
52				...
53			};
54		};
55	};
56
57	audio-codec {
58		...
59		port {
60			codec_endpoint: endpoint {
61				remote-endpoint = <&cpu_endpoint>;
62			};
63		};
64	};
65
66-----------------------
67Example: Multi DAI case
68-----------------------
69
70	sound-card {
71		compatible = "audio-graph-card";
72
73		label = "sound-card";
74
75		dais = <&cpu_port0
76			&cpu_port1
77			&cpu_port2>;
78	};
79
80	audio-codec@0 {
81		...
82		port {
83			codec0_endpoint: endpoint {
84				remote-endpoint = <&cpu_endpoint0>;
85			};
86		};
87	};
88
89	audio-codec@1 {
90		...
91		port {
92			codec1_endpoint: endpoint {
93				remote-endpoint = <&cpu_endpoint1>;
94			};
95		};
96	};
97
98	audio-codec@2 {
99		...
100		port {
101			codec2_endpoint: endpoint {
102				remote-endpoint = <&cpu_endpoint2>;
103			};
104		};
105	};
106
107	dai-controller {
108		...
109		ports {
110			cpu_port0: port@0 {
111				cpu_endpoint0: endpoint {
112					remote-endpoint = <&codec0_endpoint>;
113
114					dai-format = "left_j";
115					...
116				};
117			};
118			cpu_port1: port@1 {
119				cpu_endpoint1: endpoint {
120					remote-endpoint = <&codec1_endpoint>;
121
122					dai-format = "i2s";
123					...
124				};
125			};
126			cpu_port2: port@2 {
127				cpu_endpoint2: endpoint {
128					remote-endpoint = <&codec2_endpoint>;
129
130					dai-format = "i2s";
131					...
132				};
133			};
134		};
135	};
136
137
138-----------------------
139Example: Sampling Rate Conversion
140-----------------------
141
142	sound_card {
143		compatible = "audio-graph-card";
144
145		label = "sound-card";
146		prefix = "codec";
147		routing = "codec Playback", "DAI0 Playback",
148			  "DAI0 Capture",   "codec Capture";
149		convert-rate = <48000>;
150
151		dais = <&cpu_port>;
152	};
153
154	audio-codec {
155		...
156		port {
157			codec_endpoint: endpoint {
158				remote-endpoint = <&cpu_endpoint>;
159			};
160		};
161	};
162
163	dai-controller {
164		...
165		cpu_port: port {
166			cpu_endpoint: endpoint {
167				remote-endpoint = <&codec_endpoint>;
168
169				dai-format = "left_j";
170				...
171			};
172		};
173	};
174
175-----------------------
176Example: 2 CPU 1 Codec (Mixing)
177-----------------------
178
179	sound_card {
180		compatible = "audio-graph-card";
181
182		label = "sound-card";
183		routing = "codec Playback", "DAI0 Playback",
184			  "codec Playback", "DAI1 Playback",
185			  "DAI0 Capture",   "codec Capture";
186
187		dais = <&cpu_port>;
188	};
189
190	audio-codec {
191		...
192
193		audio-graph-card,prefix = "codec";
194		audio-graph-card,convert-rate = <48000>;
195		port {
196			reg = <0>;
197			codec_endpoint0: endpoint@0 {
198				remote-endpoint = <&cpu_endpoint0>;
199			};
200			codec_endpoint1: endpoint@1 {
201				remote-endpoint = <&cpu_endpoint1>;
202			};
203		};
204	};
205
206	dai-controller {
207		...
208		cpu_port: port {
209			cpu_endpoint0: endpoint@0 {
210				remote-endpoint = <&codec_endpoint0>;
211
212				dai-format = "left_j";
213				...
214			};
215			cpu_endpoint1: endpoint@1 {
216				remote-endpoint = <&codec_endpoint1>;
217
218				dai-format = "left_j";
219				...
220			};
221		};
222	};
223
224-----------------------
225Example: Multi DAI with DPCM
226-----------------------
227
228	CPU0 ------ ak4613
229	CPU1 ------ HDMI
230	CPU2 ------ PCM3168A-p	/* DPCM 1ch/2ch */
231	CPU3 --/		/* DPCM 3ch/4ch */
232	CPU4 --/		/* DPCM 5ch/6ch */
233	CPU5 --/		/* DPCM 7ch/8ch */
234	CPU6 ------ PCM3168A-c
235
236	sound_card: sound {
237		compatible = "audio-graph-card";
238
239		label = "sound-card";
240
241		routing =	"pcm3168a Playback", "DAI2 Playback",
242				"pcm3168a Playback", "DAI3 Playback",
243				"pcm3168a Playback", "DAI4 Playback",
244				"pcm3168a Playback", "DAI5 Playback";
245
246		dais = <&snd_port0	/* ak4613 */
247			&snd_port1	/* HDMI0  */
248			&snd_port2	/* pcm3168a playback */
249			&snd_port3	/* pcm3168a capture  */
250			>;
251	};
252
253	ak4613: codec@10 {
254		...
255		port {
256			ak4613_endpoint: endpoint {
257				remote-endpoint = <&rsnd_endpoint0>;
258			};
259		};
260	};
261
262	pcm3168a: audio-codec@44 {
263		...
264		audio-graph-card,prefix = "pcm3168a";
265		audio-graph-card,convert-channels = <8>; /* TDM Split */
266		ports {
267			port@0 {
268				reg = <0>;
269				pcm3168a_endpoint_p1: endpoint@1 {
270					remote-endpoint = <&rsnd_endpoint2>;
271					...
272				};
273				pcm3168a_endpoint_p2: endpoint@2 {
274					remote-endpoint = <&rsnd_endpoint3>;
275					...
276				};
277				pcm3168a_endpoint_p3: endpoint@3 {
278					remote-endpoint = <&rsnd_endpoint4>;
279					...
280				};
281				pcm3168a_endpoint_p4: endpoint@4 {
282					remote-endpoint = <&rsnd_endpoint5>;
283					...
284				};
285			};
286			port@1 {
287				reg = <1>;
288				pcm3168a_endpoint_c: endpoint {
289					remote-endpoint = <&rsnd_endpoint6>;
290					...
291				};
292			};
293		};
294	};
295
296	&sound {
297		ports {
298			snd_port0: port@0 {
299				rsnd_endpoint0: endpoint {
300					remote-endpoint = <&ak4613_endpoint>;
301					...
302				};
303			};
304			snd_port1: port@1 {
305				rsnd_endpoint1: endpoint {
306					remote-endpoint = <&dw_hdmi0_snd_in>;
307					...
308				};
309			};
310			snd_port2: port@2 {
311				#address-cells = <1>;
312				#size-cells = <0>;
313				rsnd_endpoint2: endpoint@2 {
314					remote-endpoint = <&pcm3168a_endpoint_p1>;
315					...
316				};
317				rsnd_endpoint3: endpoint@3 {
318					remote-endpoint = <&pcm3168a_endpoint_p2>;
319					...
320				};
321				rsnd_endpoint4: endpoint@4 {
322					remote-endpoint = <&pcm3168a_endpoint_p3>;
323					...
324				};
325				rsnd_endpoint5: endpoint@5 {
326					remote-endpoint = <&pcm3168a_endpoint_p4>;
327					...
328				};
329			};
330			snd_port3: port@6 {
331				rsnd_endpoint6: endpoint {
332					remote-endpoint = <&pcm3168a_endpoint_c>;
333					...
334				};
335			};
336		};
337	};
338