xref: /linux/sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c (revision 34dc1baba215b826e454b8d19e4f24adbeb7d00d)
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2020, Linaro Limited
3 
4 #include <sound/pcm.h>
5 #include <sound/soc.h>
6 #include <sound/pcm_params.h>
7 #include <dt-bindings/sound/qcom,q6afe.h>
8 #include "q6dsp-lpass-ports.h"
9 
10 #define Q6AFE_TDM_PB_DAI(pre, num, did) {				\
11 		.playback = {						\
12 			.stream_name = pre" TDM"#num" Playback",	\
13 			.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
14 				SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\
15 				SNDRV_PCM_RATE_176400,			\
16 			.formats = SNDRV_PCM_FMTBIT_S16_LE |		\
17 				   SNDRV_PCM_FMTBIT_S24_LE |		\
18 				   SNDRV_PCM_FMTBIT_S32_LE,		\
19 			.channels_min = 1,				\
20 			.channels_max = 8,				\
21 			.rate_min = 8000,				\
22 			.rate_max = 176400,				\
23 		},							\
24 		.name = #did,						\
25 		.id = did,						\
26 	}
27 
28 #define Q6AFE_TDM_CAP_DAI(pre, num, did) {				\
29 		.capture = {						\
30 			.stream_name = pre" TDM"#num" Capture",		\
31 			.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
32 				SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\
33 				SNDRV_PCM_RATE_176400,			\
34 			.formats = SNDRV_PCM_FMTBIT_S16_LE |		\
35 				   SNDRV_PCM_FMTBIT_S24_LE |		\
36 				   SNDRV_PCM_FMTBIT_S32_LE,		\
37 			.channels_min = 1,				\
38 			.channels_max = 8,				\
39 			.rate_min = 8000,				\
40 			.rate_max = 176400,				\
41 		},							\
42 		.name = #did,						\
43 		.id = did,						\
44 	}
45 
46 #define Q6AFE_CDC_DMA_RX_DAI(did) {				\
47 		.playback = {						\
48 			.stream_name = #did" Playback",	\
49 			.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
50 				SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\
51 				SNDRV_PCM_RATE_176400,			\
52 			.formats = SNDRV_PCM_FMTBIT_S16_LE |		\
53 				   SNDRV_PCM_FMTBIT_S24_LE |		\
54 				   SNDRV_PCM_FMTBIT_S32_LE,		\
55 			.channels_min = 1,				\
56 			.channels_max = 8,				\
57 			.rate_min = 8000,				\
58 			.rate_max = 176400,				\
59 		},							\
60 		.name = #did,						\
61 		.id = did,						\
62 	}
63 
64 #define Q6AFE_CDC_DMA_TX_DAI(did) {				\
65 		.capture = {						\
66 			.stream_name = #did" Capture",		\
67 			.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
68 				SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000 |\
69 				SNDRV_PCM_RATE_176400,			\
70 			.formats = SNDRV_PCM_FMTBIT_S16_LE |		\
71 				   SNDRV_PCM_FMTBIT_S24_LE |		\
72 				   SNDRV_PCM_FMTBIT_S32_LE,		\
73 			.channels_min = 1,				\
74 			.channels_max = 8,				\
75 			.rate_min = 8000,				\
76 			.rate_max = 176400,				\
77 		},							\
78 		.name = #did,						\
79 		.id = did,						\
80 	}
81 
82 #define Q6AFE_DP_RX_DAI(did) {						\
83 		.playback = {						\
84 			.stream_name = #did" Playback",			\
85 			.rates = SNDRV_PCM_RATE_48000 |			\
86 				SNDRV_PCM_RATE_96000 |			\
87 				SNDRV_PCM_RATE_192000,			\
88 			.formats = SNDRV_PCM_FMTBIT_S16_LE |		\
89 				   SNDRV_PCM_FMTBIT_S24_LE,		\
90 			.channels_min = 2,				\
91 			.channels_max = 8,				\
92 			.rate_min = 48000,				\
93 			.rate_max = 192000,				\
94 		},							\
95 		.name = #did,						\
96 		.id = did,						\
97 	}
98 
99 static struct snd_soc_dai_driver q6dsp_audio_fe_dais[] = {
100 	{
101 		.playback = {
102 			.stream_name = "HDMI Playback",
103 			.rates = SNDRV_PCM_RATE_48000 |
104 				 SNDRV_PCM_RATE_96000 |
105 				 SNDRV_PCM_RATE_192000,
106 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
107 				   SNDRV_PCM_FMTBIT_S24_LE,
108 			.channels_min = 2,
109 			.channels_max = 8,
110 			.rate_max =     192000,
111 			.rate_min =	48000,
112 		},
113 		.id = HDMI_RX,
114 		.name = "HDMI",
115 	}, {
116 		.name = "SLIMBUS_0_RX",
117 		.id = SLIMBUS_0_RX,
118 		.playback = {
119 			.stream_name = "Slimbus Playback",
120 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
121 				 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 |
122 				 SNDRV_PCM_RATE_192000,
123 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
124 				   SNDRV_PCM_FMTBIT_S24_LE,
125 			.channels_min = 1,
126 			.channels_max = 8,
127 			.rate_min = 8000,
128 			.rate_max = 192000,
129 		},
130 	}, {
131 		.name = "SLIMBUS_0_TX",
132 		.id = SLIMBUS_0_TX,
133 		.capture = {
134 			.stream_name = "Slimbus Capture",
135 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
136 				 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 |
137 				 SNDRV_PCM_RATE_192000,
138 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
139 				   SNDRV_PCM_FMTBIT_S24_LE,
140 			.channels_min = 1,
141 			.channels_max = 8,
142 			.rate_min = 8000,
143 			.rate_max = 192000,
144 		},
145 	}, {
146 		.playback = {
147 			.stream_name = "Slimbus1 Playback",
148 			.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |
149 				 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |
150 				 SNDRV_PCM_RATE_192000,
151 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
152 				   SNDRV_PCM_FMTBIT_S24_LE,
153 			.channels_min = 1,
154 			.channels_max = 2,
155 			.rate_min = 8000,
156 			.rate_max = 192000,
157 		},
158 		.name = "SLIMBUS_1_RX",
159 		.id = SLIMBUS_1_RX,
160 	}, {
161 		.name = "SLIMBUS_1_TX",
162 		.id = SLIMBUS_1_TX,
163 		.capture = {
164 			.stream_name = "Slimbus1 Capture",
165 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
166 				 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 |
167 				 SNDRV_PCM_RATE_192000,
168 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
169 				   SNDRV_PCM_FMTBIT_S24_LE,
170 			.channels_min = 1,
171 			.channels_max = 8,
172 			.rate_min = 8000,
173 			.rate_max = 192000,
174 		},
175 	}, {
176 		.playback = {
177 			.stream_name = "Slimbus2 Playback",
178 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
179 				 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 |
180 				 SNDRV_PCM_RATE_192000,
181 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
182 				   SNDRV_PCM_FMTBIT_S24_LE,
183 			.channels_min = 1,
184 			.channels_max = 8,
185 			.rate_min = 8000,
186 			.rate_max = 192000,
187 		},
188 		.name = "SLIMBUS_2_RX",
189 		.id = SLIMBUS_2_RX,
190 
191 	}, {
192 		.name = "SLIMBUS_2_TX",
193 		.id = SLIMBUS_2_TX,
194 		.capture = {
195 			.stream_name = "Slimbus2 Capture",
196 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
197 				 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 |
198 				 SNDRV_PCM_RATE_192000,
199 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
200 				   SNDRV_PCM_FMTBIT_S24_LE,
201 			.channels_min = 1,
202 			.channels_max = 8,
203 			.rate_min = 8000,
204 			.rate_max = 192000,
205 		},
206 	}, {
207 		.playback = {
208 			.stream_name = "Slimbus3 Playback",
209 			.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |
210 				 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |
211 				 SNDRV_PCM_RATE_192000,
212 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
213 				   SNDRV_PCM_FMTBIT_S24_LE,
214 			.channels_min = 1,
215 			.channels_max = 2,
216 			.rate_min = 8000,
217 			.rate_max = 192000,
218 		},
219 		.name = "SLIMBUS_3_RX",
220 		.id = SLIMBUS_3_RX,
221 
222 	}, {
223 		.name = "SLIMBUS_3_TX",
224 		.id = SLIMBUS_3_TX,
225 		.capture = {
226 			.stream_name = "Slimbus3 Capture",
227 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
228 				 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 |
229 				 SNDRV_PCM_RATE_192000,
230 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
231 				   SNDRV_PCM_FMTBIT_S24_LE,
232 			.channels_min = 1,
233 			.channels_max = 8,
234 			.rate_min = 8000,
235 			.rate_max = 192000,
236 		},
237 	}, {
238 		.playback = {
239 			.stream_name = "Slimbus4 Playback",
240 			.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |
241 				 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |
242 				 SNDRV_PCM_RATE_192000,
243 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
244 				   SNDRV_PCM_FMTBIT_S24_LE,
245 			.channels_min = 1,
246 			.channels_max = 2,
247 			.rate_min = 8000,
248 			.rate_max = 192000,
249 		},
250 		.name = "SLIMBUS_4_RX",
251 		.id = SLIMBUS_4_RX,
252 
253 	}, {
254 		.name = "SLIMBUS_4_TX",
255 		.id = SLIMBUS_4_TX,
256 		.capture = {
257 			.stream_name = "Slimbus4 Capture",
258 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
259 				 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 |
260 				 SNDRV_PCM_RATE_192000,
261 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
262 				   SNDRV_PCM_FMTBIT_S24_LE,
263 			.channels_min = 1,
264 			.channels_max = 8,
265 			.rate_min = 8000,
266 			.rate_max = 192000,
267 		},
268 	}, {
269 		.playback = {
270 			.stream_name = "Slimbus5 Playback",
271 			.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |
272 				 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |
273 				 SNDRV_PCM_RATE_192000,
274 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
275 				   SNDRV_PCM_FMTBIT_S24_LE,
276 			.channels_min = 1,
277 			.channels_max = 2,
278 			.rate_min = 8000,
279 			.rate_max = 192000,
280 		},
281 		.name = "SLIMBUS_5_RX",
282 		.id = SLIMBUS_5_RX,
283 
284 	}, {
285 		.name = "SLIMBUS_5_TX",
286 		.id = SLIMBUS_5_TX,
287 		.capture = {
288 			.stream_name = "Slimbus5 Capture",
289 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
290 				 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 |
291 				 SNDRV_PCM_RATE_192000,
292 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
293 				   SNDRV_PCM_FMTBIT_S24_LE,
294 			.channels_min = 1,
295 			.channels_max = 8,
296 			.rate_min = 8000,
297 			.rate_max = 192000,
298 		},
299 	}, {
300 		.playback = {
301 			.stream_name = "Slimbus6 Playback",
302 			.rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |
303 				 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |
304 				 SNDRV_PCM_RATE_192000,
305 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
306 				   SNDRV_PCM_FMTBIT_S24_LE,
307 			.channels_min = 1,
308 			.channels_max = 2,
309 			.rate_min = 8000,
310 			.rate_max = 192000,
311 		},
312 		.name = "SLIMBUS_6_RX",
313 		.id = SLIMBUS_6_RX,
314 
315 	}, {
316 		.name = "SLIMBUS_6_TX",
317 		.id = SLIMBUS_6_TX,
318 		.capture = {
319 			.stream_name = "Slimbus6 Capture",
320 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
321 				 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 |
322 				 SNDRV_PCM_RATE_192000,
323 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
324 				   SNDRV_PCM_FMTBIT_S24_LE,
325 			.channels_min = 1,
326 			.channels_max = 8,
327 			.rate_min = 8000,
328 			.rate_max = 192000,
329 		},
330 	}, {
331 		.playback = {
332 			.stream_name = "Primary MI2S Playback",
333 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
334 				 SNDRV_PCM_RATE_16000,
335 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
336 				   SNDRV_PCM_FMTBIT_S24_LE,
337 			.channels_min = 1,
338 			.channels_max = 8,
339 			.rate_min =     8000,
340 			.rate_max =     48000,
341 		},
342 		.id = PRIMARY_MI2S_RX,
343 		.name = "PRI_MI2S_RX",
344 	}, {
345 		.capture = {
346 			.stream_name = "Primary MI2S Capture",
347 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
348 				 SNDRV_PCM_RATE_16000,
349 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
350 				   SNDRV_PCM_FMTBIT_S24_LE,
351 			.channels_min = 1,
352 			.channels_max = 8,
353 			.rate_min =     8000,
354 			.rate_max =     48000,
355 		},
356 		.id = PRIMARY_MI2S_TX,
357 		.name = "PRI_MI2S_TX",
358 	}, {
359 		.playback = {
360 			.stream_name = "Secondary MI2S Playback",
361 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
362 				 SNDRV_PCM_RATE_16000,
363 			.formats = SNDRV_PCM_FMTBIT_S16_LE,
364 			.channels_min = 1,
365 			.channels_max = 8,
366 			.rate_min =     8000,
367 			.rate_max =     48000,
368 		},
369 		.name = "SEC_MI2S_RX",
370 		.id = SECONDARY_MI2S_RX,
371 	}, {
372 		.capture = {
373 			.stream_name = "Secondary MI2S Capture",
374 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
375 				 SNDRV_PCM_RATE_16000,
376 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
377 				   SNDRV_PCM_FMTBIT_S24_LE,
378 			.channels_min = 1,
379 			.channels_max = 8,
380 			.rate_min =     8000,
381 			.rate_max =     48000,
382 		},
383 		.id = SECONDARY_MI2S_TX,
384 		.name = "SEC_MI2S_TX",
385 	}, {
386 		.playback = {
387 			.stream_name = "Tertiary MI2S Playback",
388 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
389 				 SNDRV_PCM_RATE_16000,
390 			.formats = SNDRV_PCM_FMTBIT_S16_LE,
391 			.channels_min = 1,
392 			.channels_max = 8,
393 			.rate_min =     8000,
394 			.rate_max =     48000,
395 		},
396 		.name = "TERT_MI2S_RX",
397 		.id = TERTIARY_MI2S_RX,
398 	}, {
399 		.capture = {
400 			.stream_name = "Tertiary MI2S Capture",
401 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
402 				 SNDRV_PCM_RATE_16000,
403 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
404 				   SNDRV_PCM_FMTBIT_S24_LE,
405 			.channels_min = 1,
406 			.channels_max = 8,
407 			.rate_min =     8000,
408 			.rate_max =     48000,
409 		},
410 		.id = TERTIARY_MI2S_TX,
411 		.name = "TERT_MI2S_TX",
412 	}, {
413 		.playback = {
414 			.stream_name = "Quaternary MI2S Playback",
415 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
416 				 SNDRV_PCM_RATE_16000,
417 			.formats = SNDRV_PCM_FMTBIT_S16_LE,
418 			.channels_min = 1,
419 			.channels_max = 8,
420 			.rate_min =     8000,
421 			.rate_max =     48000,
422 		},
423 		.name = "QUAT_MI2S_RX",
424 		.id = QUATERNARY_MI2S_RX,
425 	}, {
426 		.capture = {
427 			.stream_name = "Quaternary MI2S Capture",
428 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
429 				 SNDRV_PCM_RATE_16000,
430 			.formats = SNDRV_PCM_FMTBIT_S16_LE |
431 				   SNDRV_PCM_FMTBIT_S24_LE,
432 			.channels_min = 1,
433 			.channels_max = 8,
434 			.rate_min =     8000,
435 			.rate_max =     48000,
436 		},
437 		.id = QUATERNARY_MI2S_TX,
438 		.name = "QUAT_MI2S_TX",
439 	}, {
440 		.playback = {
441 			.stream_name = "Quinary MI2S Playback",
442 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
443 			SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_96000 |
444 			SNDRV_PCM_RATE_192000,
445 			.formats = SNDRV_PCM_FMTBIT_S16_LE,
446 			.channels_min = 1,
447 			.channels_max = 8,
448 			.rate_min =     8000,
449 			.rate_max =     192000,
450 		},
451 		.id = QUINARY_MI2S_RX,
452 		.name = "QUIN_MI2S_RX",
453 	}, {
454 		.capture = {
455 			.stream_name = "Quinary MI2S Capture",
456 			.rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
457 				 SNDRV_PCM_RATE_16000,
458 			.formats = SNDRV_PCM_FMTBIT_S16_LE,
459 			.channels_min = 1,
460 			.channels_max = 8,
461 			.rate_min =     8000,
462 			.rate_max =     48000,
463 		},
464 		.id = QUINARY_MI2S_TX,
465 		.name = "QUIN_MI2S_TX",
466 	},
467 	Q6AFE_TDM_PB_DAI("Primary", 0, PRIMARY_TDM_RX_0),
468 	Q6AFE_TDM_PB_DAI("Primary", 1, PRIMARY_TDM_RX_1),
469 	Q6AFE_TDM_PB_DAI("Primary", 2, PRIMARY_TDM_RX_2),
470 	Q6AFE_TDM_PB_DAI("Primary", 3, PRIMARY_TDM_RX_3),
471 	Q6AFE_TDM_PB_DAI("Primary", 4, PRIMARY_TDM_RX_4),
472 	Q6AFE_TDM_PB_DAI("Primary", 5, PRIMARY_TDM_RX_5),
473 	Q6AFE_TDM_PB_DAI("Primary", 6, PRIMARY_TDM_RX_6),
474 	Q6AFE_TDM_PB_DAI("Primary", 7, PRIMARY_TDM_RX_7),
475 	Q6AFE_TDM_CAP_DAI("Primary", 0, PRIMARY_TDM_TX_0),
476 	Q6AFE_TDM_CAP_DAI("Primary", 1, PRIMARY_TDM_TX_1),
477 	Q6AFE_TDM_CAP_DAI("Primary", 2, PRIMARY_TDM_TX_2),
478 	Q6AFE_TDM_CAP_DAI("Primary", 3, PRIMARY_TDM_TX_3),
479 	Q6AFE_TDM_CAP_DAI("Primary", 4, PRIMARY_TDM_TX_4),
480 	Q6AFE_TDM_CAP_DAI("Primary", 5, PRIMARY_TDM_TX_5),
481 	Q6AFE_TDM_CAP_DAI("Primary", 6, PRIMARY_TDM_TX_6),
482 	Q6AFE_TDM_CAP_DAI("Primary", 7, PRIMARY_TDM_TX_7),
483 	Q6AFE_TDM_PB_DAI("Secondary", 0, SECONDARY_TDM_RX_0),
484 	Q6AFE_TDM_PB_DAI("Secondary", 1, SECONDARY_TDM_RX_1),
485 	Q6AFE_TDM_PB_DAI("Secondary", 2, SECONDARY_TDM_RX_2),
486 	Q6AFE_TDM_PB_DAI("Secondary", 3, SECONDARY_TDM_RX_3),
487 	Q6AFE_TDM_PB_DAI("Secondary", 4, SECONDARY_TDM_RX_4),
488 	Q6AFE_TDM_PB_DAI("Secondary", 5, SECONDARY_TDM_RX_5),
489 	Q6AFE_TDM_PB_DAI("Secondary", 6, SECONDARY_TDM_RX_6),
490 	Q6AFE_TDM_PB_DAI("Secondary", 7, SECONDARY_TDM_RX_7),
491 	Q6AFE_TDM_CAP_DAI("Secondary", 0, SECONDARY_TDM_TX_0),
492 	Q6AFE_TDM_CAP_DAI("Secondary", 1, SECONDARY_TDM_TX_1),
493 	Q6AFE_TDM_CAP_DAI("Secondary", 2, SECONDARY_TDM_TX_2),
494 	Q6AFE_TDM_CAP_DAI("Secondary", 3, SECONDARY_TDM_TX_3),
495 	Q6AFE_TDM_CAP_DAI("Secondary", 4, SECONDARY_TDM_TX_4),
496 	Q6AFE_TDM_CAP_DAI("Secondary", 5, SECONDARY_TDM_TX_5),
497 	Q6AFE_TDM_CAP_DAI("Secondary", 6, SECONDARY_TDM_TX_6),
498 	Q6AFE_TDM_CAP_DAI("Secondary", 7, SECONDARY_TDM_TX_7),
499 	Q6AFE_TDM_PB_DAI("Tertiary", 0, TERTIARY_TDM_RX_0),
500 	Q6AFE_TDM_PB_DAI("Tertiary", 1, TERTIARY_TDM_RX_1),
501 	Q6AFE_TDM_PB_DAI("Tertiary", 2, TERTIARY_TDM_RX_2),
502 	Q6AFE_TDM_PB_DAI("Tertiary", 3, TERTIARY_TDM_RX_3),
503 	Q6AFE_TDM_PB_DAI("Tertiary", 4, TERTIARY_TDM_RX_4),
504 	Q6AFE_TDM_PB_DAI("Tertiary", 5, TERTIARY_TDM_RX_5),
505 	Q6AFE_TDM_PB_DAI("Tertiary", 6, TERTIARY_TDM_RX_6),
506 	Q6AFE_TDM_PB_DAI("Tertiary", 7, TERTIARY_TDM_RX_7),
507 	Q6AFE_TDM_CAP_DAI("Tertiary", 0, TERTIARY_TDM_TX_0),
508 	Q6AFE_TDM_CAP_DAI("Tertiary", 1, TERTIARY_TDM_TX_1),
509 	Q6AFE_TDM_CAP_DAI("Tertiary", 2, TERTIARY_TDM_TX_2),
510 	Q6AFE_TDM_CAP_DAI("Tertiary", 3, TERTIARY_TDM_TX_3),
511 	Q6AFE_TDM_CAP_DAI("Tertiary", 4, TERTIARY_TDM_TX_4),
512 	Q6AFE_TDM_CAP_DAI("Tertiary", 5, TERTIARY_TDM_TX_5),
513 	Q6AFE_TDM_CAP_DAI("Tertiary", 6, TERTIARY_TDM_TX_6),
514 	Q6AFE_TDM_CAP_DAI("Tertiary", 7, TERTIARY_TDM_TX_7),
515 	Q6AFE_TDM_PB_DAI("Quaternary", 0, QUATERNARY_TDM_RX_0),
516 	Q6AFE_TDM_PB_DAI("Quaternary", 1, QUATERNARY_TDM_RX_1),
517 	Q6AFE_TDM_PB_DAI("Quaternary", 2, QUATERNARY_TDM_RX_2),
518 	Q6AFE_TDM_PB_DAI("Quaternary", 3, QUATERNARY_TDM_RX_3),
519 	Q6AFE_TDM_PB_DAI("Quaternary", 4, QUATERNARY_TDM_RX_4),
520 	Q6AFE_TDM_PB_DAI("Quaternary", 5, QUATERNARY_TDM_RX_5),
521 	Q6AFE_TDM_PB_DAI("Quaternary", 6, QUATERNARY_TDM_RX_6),
522 	Q6AFE_TDM_PB_DAI("Quaternary", 7, QUATERNARY_TDM_RX_7),
523 	Q6AFE_TDM_CAP_DAI("Quaternary", 0, QUATERNARY_TDM_TX_0),
524 	Q6AFE_TDM_CAP_DAI("Quaternary", 1, QUATERNARY_TDM_TX_1),
525 	Q6AFE_TDM_CAP_DAI("Quaternary", 2, QUATERNARY_TDM_TX_2),
526 	Q6AFE_TDM_CAP_DAI("Quaternary", 3, QUATERNARY_TDM_TX_3),
527 	Q6AFE_TDM_CAP_DAI("Quaternary", 4, QUATERNARY_TDM_TX_4),
528 	Q6AFE_TDM_CAP_DAI("Quaternary", 5, QUATERNARY_TDM_TX_5),
529 	Q6AFE_TDM_CAP_DAI("Quaternary", 6, QUATERNARY_TDM_TX_6),
530 	Q6AFE_TDM_CAP_DAI("Quaternary", 7, QUATERNARY_TDM_TX_7),
531 	Q6AFE_TDM_PB_DAI("Quinary", 0, QUINARY_TDM_RX_0),
532 	Q6AFE_TDM_PB_DAI("Quinary", 1, QUINARY_TDM_RX_1),
533 	Q6AFE_TDM_PB_DAI("Quinary", 2, QUINARY_TDM_RX_2),
534 	Q6AFE_TDM_PB_DAI("Quinary", 3, QUINARY_TDM_RX_3),
535 	Q6AFE_TDM_PB_DAI("Quinary", 4, QUINARY_TDM_RX_4),
536 	Q6AFE_TDM_PB_DAI("Quinary", 5, QUINARY_TDM_RX_5),
537 	Q6AFE_TDM_PB_DAI("Quinary", 6, QUINARY_TDM_RX_6),
538 	Q6AFE_TDM_PB_DAI("Quinary", 7, QUINARY_TDM_RX_7),
539 	Q6AFE_TDM_CAP_DAI("Quinary", 0, QUINARY_TDM_TX_0),
540 	Q6AFE_TDM_CAP_DAI("Quinary", 1, QUINARY_TDM_TX_1),
541 	Q6AFE_TDM_CAP_DAI("Quinary", 2, QUINARY_TDM_TX_2),
542 	Q6AFE_TDM_CAP_DAI("Quinary", 3, QUINARY_TDM_TX_3),
543 	Q6AFE_TDM_CAP_DAI("Quinary", 4, QUINARY_TDM_TX_4),
544 	Q6AFE_TDM_CAP_DAI("Quinary", 5, QUINARY_TDM_TX_5),
545 	Q6AFE_TDM_CAP_DAI("Quinary", 6, QUINARY_TDM_TX_6),
546 	Q6AFE_TDM_CAP_DAI("Quinary", 7, QUINARY_TDM_TX_7),
547 	Q6AFE_DP_RX_DAI(DISPLAY_PORT_RX_0),
548 	Q6AFE_DP_RX_DAI(DISPLAY_PORT_RX_1),
549 	Q6AFE_DP_RX_DAI(DISPLAY_PORT_RX_2),
550 	Q6AFE_DP_RX_DAI(DISPLAY_PORT_RX_3),
551 	Q6AFE_DP_RX_DAI(DISPLAY_PORT_RX_4),
552 	Q6AFE_DP_RX_DAI(DISPLAY_PORT_RX_5),
553 	Q6AFE_DP_RX_DAI(DISPLAY_PORT_RX_6),
554 	Q6AFE_DP_RX_DAI(DISPLAY_PORT_RX_7),
555 	Q6AFE_CDC_DMA_RX_DAI(WSA_CODEC_DMA_RX_0),
556 	Q6AFE_CDC_DMA_TX_DAI(WSA_CODEC_DMA_TX_0),
557 	Q6AFE_CDC_DMA_RX_DAI(WSA_CODEC_DMA_RX_1),
558 	Q6AFE_CDC_DMA_TX_DAI(WSA_CODEC_DMA_TX_1),
559 	Q6AFE_CDC_DMA_TX_DAI(WSA_CODEC_DMA_TX_2),
560 	Q6AFE_CDC_DMA_TX_DAI(VA_CODEC_DMA_TX_0),
561 	Q6AFE_CDC_DMA_TX_DAI(VA_CODEC_DMA_TX_1),
562 	Q6AFE_CDC_DMA_TX_DAI(VA_CODEC_DMA_TX_2),
563 	Q6AFE_CDC_DMA_RX_DAI(RX_CODEC_DMA_RX_0),
564 	Q6AFE_CDC_DMA_TX_DAI(TX_CODEC_DMA_TX_0),
565 	Q6AFE_CDC_DMA_RX_DAI(RX_CODEC_DMA_RX_1),
566 	Q6AFE_CDC_DMA_TX_DAI(TX_CODEC_DMA_TX_1),
567 	Q6AFE_CDC_DMA_RX_DAI(RX_CODEC_DMA_RX_2),
568 	Q6AFE_CDC_DMA_TX_DAI(TX_CODEC_DMA_TX_2),
569 	Q6AFE_CDC_DMA_RX_DAI(RX_CODEC_DMA_RX_3),
570 	Q6AFE_CDC_DMA_TX_DAI(TX_CODEC_DMA_TX_3),
571 	Q6AFE_CDC_DMA_RX_DAI(RX_CODEC_DMA_RX_4),
572 	Q6AFE_CDC_DMA_TX_DAI(TX_CODEC_DMA_TX_4),
573 	Q6AFE_CDC_DMA_RX_DAI(RX_CODEC_DMA_RX_5),
574 	Q6AFE_CDC_DMA_TX_DAI(TX_CODEC_DMA_TX_5),
575 	Q6AFE_CDC_DMA_RX_DAI(RX_CODEC_DMA_RX_6),
576 	Q6AFE_CDC_DMA_RX_DAI(RX_CODEC_DMA_RX_7),
577 };
578 
579 int q6dsp_audio_ports_of_xlate_dai_name(struct snd_soc_component *component,
580 					const struct of_phandle_args *args,
581 					const char **dai_name)
582 {
583 	int id = args->args[0];
584 	int ret = -EINVAL;
585 	int i;
586 
587 	for (i = 0; i  < ARRAY_SIZE(q6dsp_audio_fe_dais); i++) {
588 		if (q6dsp_audio_fe_dais[i].id == id) {
589 			*dai_name = q6dsp_audio_fe_dais[i].name;
590 			ret = 0;
591 			break;
592 		}
593 	}
594 
595 	return ret;
596 }
597 EXPORT_SYMBOL_GPL(q6dsp_audio_ports_of_xlate_dai_name);
598 
599 struct snd_soc_dai_driver *q6dsp_audio_ports_set_config(struct device *dev,
600 				struct q6dsp_audio_port_dai_driver_config *cfg,
601 				int *num_dais)
602 {
603 	int i;
604 
605 	for (i = 0; i  < ARRAY_SIZE(q6dsp_audio_fe_dais); i++) {
606 		switch (q6dsp_audio_fe_dais[i].id) {
607 		case HDMI_RX:
608 		case DISPLAY_PORT_RX:
609 			q6dsp_audio_fe_dais[i].ops = cfg->q6hdmi_ops;
610 			break;
611 		case DISPLAY_PORT_RX_1 ... DISPLAY_PORT_RX_7:
612 			q6dsp_audio_fe_dais[i].ops = cfg->q6hdmi_ops;
613 			break;
614 		case SLIMBUS_0_RX ... SLIMBUS_6_TX:
615 			q6dsp_audio_fe_dais[i].ops = cfg->q6slim_ops;
616 			break;
617 		case QUINARY_MI2S_RX ... QUINARY_MI2S_TX:
618 		case PRIMARY_MI2S_RX ... QUATERNARY_MI2S_TX:
619 			q6dsp_audio_fe_dais[i].ops = cfg->q6i2s_ops;
620 			break;
621 		case PRIMARY_TDM_RX_0 ... QUINARY_TDM_TX_7:
622 			q6dsp_audio_fe_dais[i].ops = cfg->q6tdm_ops;
623 			break;
624 		case WSA_CODEC_DMA_RX_0 ... RX_CODEC_DMA_RX_7:
625 			q6dsp_audio_fe_dais[i].ops = cfg->q6dma_ops;
626 			break;
627 		default:
628 			break;
629 		}
630 	}
631 
632 	*num_dais = ARRAY_SIZE(q6dsp_audio_fe_dais);
633 	return q6dsp_audio_fe_dais;
634 }
635 EXPORT_SYMBOL_GPL(q6dsp_audio_ports_set_config);
636