forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/Documentation/devicetree/bindings/sound/audio-graph-card.txt
....@@ -5,7 +5,7 @@
55 see ${LINUX}/Documentation/devicetree/bindings/graph.txt
66
77 Basically, Audio Graph Card property is same as Simple Card.
8
-see ${LINUX}/Documentation/devicetree/bindings/sound/simple-card.txt
8
+see ${LINUX}/Documentation/devicetree/bindings/sound/simple-card.yaml
99
1010 Below are same as Simple-Card.
1111
....@@ -32,7 +32,9 @@
3232 Optional properties:
3333 - pa-gpios: GPIO used to control external amplifier.
3434
35
+-----------------------
3536 Example: Single DAI case
37
+-----------------------
3638
3739 sound_card {
3840 compatible = "audio-graph-card";
....@@ -61,7 +63,9 @@
6163 };
6264 };
6365
66
+-----------------------
6467 Example: Multi DAI case
68
+-----------------------
6569
6670 sound-card {
6771 compatible = "audio-graph-card";
....@@ -130,3 +134,204 @@
130134 };
131135 };
132136
137
+
138
+-----------------------
139
+Example: 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
+-----------------------
176
+Example: 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
+-----------------------
225
+Example: 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
+ };