xref: /openbmc/linux/sound/soc/intel/common/soc-acpi-intel-adl-match.c (revision cd57272c4e686d4ad2d2e775a40a3eac9f96ec7c)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * soc-apci-intel-adl-match.c - tables and support for ADL ACPI enumeration.
4  *
5  * Copyright (c) 2020, Intel Corporation.
6  */
7 
8 #include <sound/soc-acpi.h>
9 #include <sound/soc-acpi-intel-match.h>
10 
11 static const struct snd_soc_acpi_endpoint single_endpoint = {
12 	.num = 0,
13 	.aggregated = 0,
14 	.group_position = 0,
15 	.group_id = 0,
16 };
17 
18 static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
19 	.num = 0,
20 	.aggregated = 1,
21 	.group_position = 0,
22 	.group_id = 1,
23 };
24 
25 static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
26 	.num = 0,
27 	.aggregated = 1,
28 	.group_position = 1,
29 	.group_id = 1,
30 };
31 
32 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
33 	{
34 		.adr = 0x000020025D071100ull,
35 		.num_endpoints = 1,
36 		.endpoints = &single_endpoint,
37 		.name_prefix = "rt711"
38 	}
39 };
40 
41 static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = {
42 	{
43 		.adr = 0x000120025D130800ull,
44 		.num_endpoints = 1,
45 		.endpoints = &spk_l_endpoint,
46 		.name_prefix = "rt1308-1"
47 	}
48 };
49 
50 static const struct snd_soc_acpi_adr_device rt1308_2_group1_adr[] = {
51 	{
52 		.adr = 0x000220025D130800ull,
53 		.num_endpoints = 1,
54 		.endpoints = &spk_r_endpoint,
55 		.name_prefix = "rt1308-2"
56 	}
57 };
58 
59 static const struct snd_soc_acpi_adr_device rt715_3_adr[] = {
60 	{
61 		.adr = 0x000320025D071500ull,
62 		.num_endpoints = 1,
63 		.endpoints = &single_endpoint,
64 		.name_prefix = "rt715"
65 	}
66 };
67 
68 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
69 	{
70 		.adr = 0x000030025D071101ull,
71 		.num_endpoints = 1,
72 		.endpoints = &single_endpoint,
73 		.name_prefix = "rt711"
74 	}
75 };
76 
77 static const struct snd_soc_acpi_adr_device rt711_sdca_2_adr[] = {
78 	{
79 		.adr = 0x000230025D071101ull,
80 		.num_endpoints = 1,
81 		.endpoints = &single_endpoint,
82 		.name_prefix = "rt711"
83 	}
84 };
85 
86 static const struct snd_soc_acpi_adr_device rt1316_1_group1_adr[] = {
87 	{
88 		.adr = 0x000131025D131601ull, /* unique ID is set for some reason */
89 		.num_endpoints = 1,
90 		.endpoints = &spk_l_endpoint,
91 		.name_prefix = "rt1316-1"
92 	}
93 };
94 
95 static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = {
96 	{
97 		.adr = 0x000230025D131601ull,
98 		.num_endpoints = 1,
99 		.endpoints = &spk_r_endpoint,
100 		.name_prefix = "rt1316-2"
101 	}
102 };
103 
104 static const struct snd_soc_acpi_adr_device rt1316_3_group1_adr[] = {
105 	{
106 		.adr = 0x000330025D131601ull,
107 		.num_endpoints = 1,
108 		.endpoints = &spk_r_endpoint,
109 		.name_prefix = "rt1316-2"
110 	}
111 };
112 
113 static const struct snd_soc_acpi_adr_device rt1316_0_group2_adr[] = {
114 	{
115 		.adr = 0x000031025D131601ull,
116 		.num_endpoints = 1,
117 		.endpoints = &spk_l_endpoint,
118 		.name_prefix = "rt1316-1"
119 	}
120 };
121 
122 static const struct snd_soc_acpi_adr_device rt1316_1_group2_adr[] = {
123 	{
124 		.adr = 0x000130025D131601ull,
125 		.num_endpoints = 1,
126 		.endpoints = &spk_r_endpoint,
127 		.name_prefix = "rt1316-2"
128 	}
129 };
130 
131 static const struct snd_soc_acpi_adr_device rt1316_2_single_adr[] = {
132 	{
133 		.adr = 0x000230025D131601ull,
134 		.num_endpoints = 1,
135 		.endpoints = &single_endpoint,
136 		.name_prefix = "rt1316-1"
137 	}
138 };
139 
140 static const struct snd_soc_acpi_adr_device rt1316_3_single_adr[] = {
141 	{
142 		.adr = 0x000330025D131601ull,
143 		.num_endpoints = 1,
144 		.endpoints = &single_endpoint,
145 		.name_prefix = "rt1316-1"
146 	}
147 };
148 
149 static const struct snd_soc_acpi_adr_device rt714_0_adr[] = {
150 	{
151 		.adr = 0x000030025D071401ull,
152 		.num_endpoints = 1,
153 		.endpoints = &single_endpoint,
154 		.name_prefix = "rt714"
155 	}
156 };
157 
158 static const struct snd_soc_acpi_adr_device rt714_2_adr[] = {
159 	{
160 		.adr = 0x000230025D071401ull,
161 		.num_endpoints = 1,
162 		.endpoints = &single_endpoint,
163 		.name_prefix = "rt714"
164 	}
165 };
166 
167 static const struct snd_soc_acpi_adr_device rt714_3_adr[] = {
168 	{
169 		.adr = 0x000330025D071401ull,
170 		.num_endpoints = 1,
171 		.endpoints = &single_endpoint,
172 		.name_prefix = "rt714"
173 	}
174 };
175 
176 static const struct snd_soc_acpi_link_adr adl_default[] = {
177 	{
178 		.mask = BIT(0),
179 		.num_adr = ARRAY_SIZE(rt711_0_adr),
180 		.adr_d = rt711_0_adr,
181 	},
182 	{
183 		.mask = BIT(1),
184 		.num_adr = ARRAY_SIZE(rt1308_1_group1_adr),
185 		.adr_d = rt1308_1_group1_adr,
186 	},
187 	{
188 		.mask = BIT(2),
189 		.num_adr = ARRAY_SIZE(rt1308_2_group1_adr),
190 		.adr_d = rt1308_2_group1_adr,
191 	},
192 	{
193 		.mask = BIT(3),
194 		.num_adr = ARRAY_SIZE(rt715_3_adr),
195 		.adr_d = rt715_3_adr,
196 	},
197 	{}
198 };
199 
200 static const struct snd_soc_acpi_link_adr adl_sdca_default[] = {
201 	{
202 		.mask = BIT(0),
203 		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
204 		.adr_d = rt711_sdca_0_adr,
205 	},
206 	{
207 		.mask = BIT(1),
208 		.num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
209 		.adr_d = rt1316_1_group1_adr,
210 	},
211 	{
212 		.mask = BIT(2),
213 		.num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
214 		.adr_d = rt1316_2_group1_adr,
215 	},
216 	{
217 		.mask = BIT(3),
218 		.num_adr = ARRAY_SIZE(rt714_3_adr),
219 		.adr_d = rt714_3_adr,
220 	},
221 	{}
222 };
223 
224 static const struct snd_soc_acpi_link_adr adl_sdca_3_in_1[] = {
225 	{
226 		.mask = BIT(0),
227 		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
228 		.adr_d = rt711_sdca_0_adr,
229 	},
230 	{
231 		.mask = BIT(1),
232 		.num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
233 		.adr_d = rt1316_1_group1_adr,
234 	},
235 	{
236 		.mask = BIT(2),
237 		.num_adr = ARRAY_SIZE(rt714_2_adr),
238 		.adr_d = rt714_2_adr,
239 	},
240 	{
241 		.mask = BIT(3),
242 		.num_adr = ARRAY_SIZE(rt1316_3_group1_adr),
243 		.adr_d = rt1316_3_group1_adr,
244 	},
245 	{}
246 };
247 
248 static const struct snd_soc_acpi_link_adr adl_sdw_rt711_link2_rt1316_link01_rt714_link3[] = {
249 	{
250 		.mask = BIT(2),
251 		.num_adr = ARRAY_SIZE(rt711_sdca_2_adr),
252 		.adr_d = rt711_sdca_2_adr,
253 	},
254 	{
255 		.mask = BIT(0),
256 		.num_adr = ARRAY_SIZE(rt1316_0_group2_adr),
257 		.adr_d = rt1316_0_group2_adr,
258 	},
259 	{
260 		.mask = BIT(1),
261 		.num_adr = ARRAY_SIZE(rt1316_1_group2_adr),
262 		.adr_d = rt1316_1_group2_adr,
263 	},
264 	{
265 		.mask = BIT(3),
266 		.num_adr = ARRAY_SIZE(rt714_3_adr),
267 		.adr_d = rt714_3_adr,
268 	},
269 	{}
270 };
271 
272 static const struct snd_soc_acpi_link_adr adl_sdw_rt711_link2_rt1316_link01[] = {
273 	{
274 		.mask = BIT(2),
275 		.num_adr = ARRAY_SIZE(rt711_sdca_2_adr),
276 		.adr_d = rt711_sdca_2_adr,
277 	},
278 	{
279 		.mask = BIT(0),
280 		.num_adr = ARRAY_SIZE(rt1316_0_group2_adr),
281 		.adr_d = rt1316_0_group2_adr,
282 	},
283 	{
284 		.mask = BIT(1),
285 		.num_adr = ARRAY_SIZE(rt1316_1_group2_adr),
286 		.adr_d = rt1316_1_group2_adr,
287 	},
288 	{}
289 };
290 
291 static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link12_rt714_link0[] = {
292 	{
293 		.mask = BIT(1),
294 		.num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
295 		.adr_d = rt1316_1_group1_adr,
296 	},
297 	{
298 		.mask = BIT(2),
299 		.num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
300 		.adr_d = rt1316_2_group1_adr,
301 	},
302 	{
303 		.mask = BIT(0),
304 		.num_adr = ARRAY_SIZE(rt714_0_adr),
305 		.adr_d = rt714_0_adr,
306 	},
307 	{}
308 };
309 
310 static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link2_rt714_link3[] = {
311 	{
312 		.mask = BIT(2),
313 		.num_adr = ARRAY_SIZE(rt1316_2_single_adr),
314 		.adr_d = rt1316_2_single_adr,
315 	},
316 	{
317 		.mask = BIT(3),
318 		.num_adr = ARRAY_SIZE(rt714_3_adr),
319 		.adr_d = rt714_3_adr,
320 	},
321 	{}
322 };
323 
324 static const struct snd_soc_acpi_link_adr adl_sdw_rt1316_link2_rt714_link0[] = {
325 	{
326 		.mask = BIT(2),
327 		.num_adr = ARRAY_SIZE(rt1316_2_single_adr),
328 		.adr_d = rt1316_2_single_adr,
329 	},
330 	{
331 		.mask = BIT(0),
332 		.num_adr = ARRAY_SIZE(rt714_0_adr),
333 		.adr_d = rt714_0_adr,
334 	},
335 	{}
336 };
337 
338 static const struct snd_soc_acpi_link_adr adl_sdw_rt711_link0_rt1316_link3[] = {
339 	{
340 		.mask = BIT(0),
341 		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
342 		.adr_d = rt711_sdca_0_adr,
343 	},
344 	{
345 		.mask = BIT(3),
346 		.num_adr = ARRAY_SIZE(rt1316_3_single_adr),
347 		.adr_d = rt1316_3_single_adr,
348 	},
349 	{}
350 };
351 
352 static const struct snd_soc_acpi_adr_device mx8373_2_adr[] = {
353 	{
354 		.adr = 0x000223019F837300ull,
355 		.num_endpoints = 1,
356 		.endpoints = &spk_l_endpoint,
357 		.name_prefix = "Left"
358 	},
359 	{
360 		.adr = 0x000227019F837300ull,
361 		.num_endpoints = 1,
362 		.endpoints = &spk_r_endpoint,
363 		.name_prefix = "Right"
364 	}
365 };
366 
367 static const struct snd_soc_acpi_adr_device rt5682_0_adr[] = {
368 	{
369 		.adr = 0x000021025D568200ull,
370 		.num_endpoints = 1,
371 		.endpoints = &single_endpoint,
372 		.name_prefix = "rt5682"
373 	}
374 };
375 
376 static const struct snd_soc_acpi_link_adr adl_rvp[] = {
377 	{
378 		.mask = BIT(0),
379 		.num_adr = ARRAY_SIZE(rt711_0_adr),
380 		.adr_d = rt711_0_adr,
381 	},
382 	{}
383 };
384 
385 static const struct snd_soc_acpi_link_adr adlps_rvp[] = {
386 	{
387 		.mask = BIT(0),
388 		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
389 		.adr_d = rt711_sdca_0_adr,
390 	},
391 	{}
392 };
393 
394 static const struct snd_soc_acpi_link_adr adl_chromebook_base[] = {
395 	{
396 		.mask = BIT(0),
397 		.num_adr = ARRAY_SIZE(rt5682_0_adr),
398 		.adr_d = rt5682_0_adr,
399 	},
400 	{
401 		.mask = BIT(2),
402 		.num_adr = ARRAY_SIZE(mx8373_2_adr),
403 		.adr_d = mx8373_2_adr,
404 	},
405 	{}
406 };
407 
408 static const struct snd_soc_acpi_codecs adl_max98373_amp = {
409 	.num_codecs = 1,
410 	.codecs = {"MX98373"}
411 };
412 
413 static const struct snd_soc_acpi_codecs adl_max98357a_amp = {
414 	.num_codecs = 1,
415 	.codecs = {"MX98357A"}
416 };
417 
418 static const struct snd_soc_acpi_codecs adl_max98360a_amp = {
419 	.num_codecs = 1,
420 	.codecs = {"MX98360A"}
421 };
422 
423 static const struct snd_soc_acpi_codecs adl_rt5682_rt5682s_hp = {
424 	.num_codecs = 2,
425 	.codecs = {"10EC5682", "RTL5682"},
426 };
427 
428 static const struct snd_soc_acpi_codecs adl_rt1019p_amp = {
429 	.num_codecs = 1,
430 	.codecs = {"RTL1019"}
431 };
432 
433 static const struct snd_soc_acpi_codecs adl_max98390_amp = {
434 	.num_codecs = 1,
435 	.codecs = {"MX98390"}
436 };
437 
438 struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_machines[] = {
439 	{
440 		.comp_ids = &adl_rt5682_rt5682s_hp,
441 		.drv_name = "adl_mx98373_rt5682",
442 		.machine_quirk = snd_soc_acpi_codec_list,
443 		.quirk_data = &adl_max98373_amp,
444 		.sof_tplg_filename = "sof-adl-max98373-rt5682.tplg",
445 	},
446 	{
447 		.comp_ids = &adl_rt5682_rt5682s_hp,
448 		.drv_name = "adl_mx98357_rt5682",
449 		.machine_quirk = snd_soc_acpi_codec_list,
450 		.quirk_data = &adl_max98357a_amp,
451 		.sof_tplg_filename = "sof-adl-max98357a-rt5682.tplg",
452 	},
453 	{
454 		.comp_ids = &adl_rt5682_rt5682s_hp,
455 		.drv_name = "adl_mx98360_rt5682",
456 		.machine_quirk = snd_soc_acpi_codec_list,
457 		.quirk_data = &adl_max98360a_amp,
458 		.sof_tplg_filename = "sof-adl-max98360a-rt5682.tplg",
459 	},
460 	{
461 		.id = "10508825",
462 		.drv_name = "adl_rt1019p_nau8825",
463 		.machine_quirk = snd_soc_acpi_codec_list,
464 		.quirk_data = &adl_rt1019p_amp,
465 		.sof_tplg_filename = "sof-adl-rt1019-nau8825.tplg",
466 	},
467 	{
468 		.id = "10508825",
469 		.drv_name = "adl_max98373_nau8825",
470 		.machine_quirk = snd_soc_acpi_codec_list,
471 		.quirk_data = &adl_max98373_amp,
472 		.sof_tplg_filename = "sof-adl-max98373-nau8825.tplg",
473 	},
474 	{
475 		.id = "10508825",
476 		.drv_name = "adl_mx98360a_nau8825",
477 		.machine_quirk = snd_soc_acpi_codec_list,
478 		.quirk_data = &adl_max98360a_amp,
479 		.sof_tplg_filename = "sof-adl-max98360a-nau8825.tplg",
480 	},
481 	{
482 		.id = "RTL5682",
483 		.drv_name = "adl_rt1019_rt5682s",
484 		.machine_quirk = snd_soc_acpi_codec_list,
485 		.quirk_data = &adl_rt1019p_amp,
486 		.sof_tplg_filename = "sof-adl-rt1019-rt5682.tplg",
487 	},
488 	{
489 		.id = "10508825",
490 		.drv_name = "sof_nau8825",
491 		.sof_tplg_filename = "sof-adl-nau8825.tplg",
492 	},
493 	{
494 		.comp_ids = &adl_rt5682_rt5682s_hp,
495 		.drv_name = "adl_max98390_rt5682",
496 		.machine_quirk = snd_soc_acpi_codec_list,
497 		.quirk_data = &adl_max98390_amp,
498 		.sof_tplg_filename = "sof-adl-max98390-rt5682.tplg",
499 	},
500 	{
501 		.comp_ids = &adl_rt5682_rt5682s_hp,
502 		.drv_name = "adl_rt5682",
503 		.sof_tplg_filename = "sof-adl-rt5682.tplg",
504 	},
505 	{
506 		.id = "10134242",
507 		.drv_name = "adl_mx98360a_cs4242",
508 		.machine_quirk = snd_soc_acpi_codec_list,
509 		.quirk_data = &adl_max98360a_amp,
510 		.sof_tplg_filename = "sof-adl-max98360a-cs42l42.tplg",
511 	},
512 	/* place amp-only boards in the end of table */
513 	{
514 		.id = "CSC3541",
515 		.drv_name = "adl_cs35l41",
516 		.sof_tplg_filename = "sof-adl-cs35l41.tplg",
517 	},
518 	{},
519 };
520 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_adl_machines);
521 
522 /* this table is used when there is no I2S codec present */
523 struct snd_soc_acpi_mach snd_soc_acpi_intel_adl_sdw_machines[] = {
524 	{
525 		.link_mask = 0xF, /* 4 active links required */
526 		.links = adl_default,
527 		.drv_name = "sof_sdw",
528 		.sof_tplg_filename = "sof-adl-rt711-l0-rt1308-l12-rt715-l3.tplg",
529 	},
530 	{
531 		.link_mask = 0xF, /* 4 active links required */
532 		.links = adl_sdca_default,
533 		.drv_name = "sof_sdw",
534 		.sof_tplg_filename = "sof-adl-rt711-l0-rt1316-l12-rt714-l3.tplg",
535 	},
536 	{
537 		.link_mask = 0xF, /* 4 active links required */
538 		.links = adl_sdca_3_in_1,
539 		.drv_name = "sof_sdw",
540 		.sof_tplg_filename = "sof-adl-rt711-l0-rt1316-l13-rt714-l2.tplg",
541 	},
542 	{
543 		.link_mask = 0xF, /* 4 active links required */
544 		.links = adl_sdw_rt711_link2_rt1316_link01_rt714_link3,
545 		.drv_name = "sof_sdw",
546 		.sof_tplg_filename = "sof-adl-rt711-l2-rt1316-l01-rt714-l3.tplg",
547 	},
548 	{
549 		.link_mask = 0x7, /* rt1316 on link0 and link1 & rt711 on link2*/
550 		.links = adl_sdw_rt711_link2_rt1316_link01,
551 		.drv_name = "sof_sdw",
552 		.sof_tplg_filename = "sof-adl-rt711-l2-rt1316-l01.tplg",
553 	},
554 	{
555 		.link_mask = 0xC, /* rt1316 on link2 & rt714 on link3 */
556 		.links = adl_sdw_rt1316_link2_rt714_link3,
557 		.drv_name = "sof_sdw",
558 		.sof_tplg_filename = "sof-adl-rt1316-l2-mono-rt714-l3.tplg",
559 	},
560 	{
561 		.link_mask = 0x7, /* rt714 on link0 & two rt1316s on link1 and link2 */
562 		.links = adl_sdw_rt1316_link12_rt714_link0,
563 		.drv_name = "sof_sdw",
564 		.sof_tplg_filename = "sof-adl-rt1316-l12-rt714-l0.tplg",
565 	},
566 	{
567 		.link_mask = 0x5, /* 2 active links required */
568 		.links = adl_sdw_rt1316_link2_rt714_link0,
569 		.drv_name = "sof_sdw",
570 		.sof_tplg_filename = "sof-adl-rt1316-l2-mono-rt714-l0.tplg",
571 	},
572 	{
573 		.link_mask = 0x9, /* 2 active links required */
574 		.links = adl_sdw_rt711_link0_rt1316_link3,
575 		.drv_name = "sof_sdw",
576 		.sof_tplg_filename = "sof-adl-rt711-l0-rt1316-l3.tplg",
577 	},
578 	{
579 		.link_mask = 0x1, /* link0 required */
580 		.links = adl_rvp,
581 		.drv_name = "sof_sdw",
582 		.sof_tplg_filename = "sof-adl-rt711.tplg",
583 	},
584 	{
585 		.link_mask = 0x1, /* link0 required */
586 		.links = adlps_rvp,
587 		.drv_name = "sof_sdw",
588 		.sof_tplg_filename = "sof-adl-rt711.tplg",
589 	},
590 	{
591 		.link_mask = 0x5, /* rt5682 on link0 & 2xmax98373 on link 2 */
592 		.links = adl_chromebook_base,
593 		.drv_name = "sof_sdw",
594 		.sof_tplg_filename = "sof-adl-sdw-max98373-rt5682.tplg",
595 	},
596 	{},
597 };
598 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_adl_sdw_machines);
599