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