1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * soc-acpi-intel-mtl-match.c - tables and support for MTL ACPI enumeration.
4 *
5 * Copyright (c) 2022, Intel Corporation.
6 *
7 */
8
9#include <sound/soc-acpi.h>
10#include <sound/soc-acpi-intel-match.h>
11#include "soc-acpi-intel-sdw-mockup-match.h"
12
13static const struct snd_soc_acpi_codecs mtl_max98357a_amp = {
14 .num_codecs = 1,
15 .codecs = {"MX98357A"}
16};
17
18static const struct snd_soc_acpi_codecs mtl_max98360a_amp = {
19 .num_codecs = 1,
20 .codecs = {"MX98360A"}
21};
22
23static const struct snd_soc_acpi_codecs mtl_rt1019p_amp = {
24 .num_codecs = 1,
25 .codecs = {"RTL1019"}
26};
27
28static const struct snd_soc_acpi_codecs mtl_rt5682_rt5682s_hp = {
29 .num_codecs = 2,
30 .codecs = {"10EC5682", "RTL5682"},
31};
32
33static const struct snd_soc_acpi_codecs mtl_essx_83x6 = {
34 .num_codecs = 3,
35 .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"},
36};
37
38static const struct snd_soc_acpi_codecs mtl_lt6911_hdmi = {
39 .num_codecs = 1,
40 .codecs = {"INTC10B0"}
41};
42
43static const struct snd_soc_acpi_codecs mtl_rt5650_amp = {
44 .num_codecs = 1,
45 .codecs = {"10EC5650"}
46};
47
48struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[] = {
49 {
50 .comp_ids = &mtl_rt5682_rt5682s_hp,
51 .drv_name = "mtl_mx98357_rt5682",
52 .machine_quirk = snd_soc_acpi_codec_list,
53 .quirk_data = &mtl_max98357a_amp,
54 .sof_tplg_filename = "sof-mtl-max98357a-rt5682.tplg",
55 },
56 {
57 .comp_ids = &mtl_rt5682_rt5682s_hp,
58 .drv_name = "mtl_mx98360_rt5682",
59 .machine_quirk = snd_soc_acpi_codec_list,
60 .quirk_data = &mtl_max98360a_amp,
61 .sof_tplg_filename = "sof-mtl-max98360a-rt5682.tplg",
62 },
63 {
64 .comp_ids = &mtl_rt5682_rt5682s_hp,
65 .drv_name = "mtl_rt5682_def",
66 .machine_quirk = snd_soc_acpi_codec_list,
67 .quirk_data = &mtl_rt1019p_amp,
68 .sof_tplg_filename = "sof-mtl-rt1019-rt5682.tplg",
69 },
70 {
71 .comp_ids = &mtl_essx_83x6,
72 .drv_name = "mtl_es83x6_c1_h02",
73 .machine_quirk = snd_soc_acpi_codec_list,
74 .quirk_data = &mtl_lt6911_hdmi,
75 .sof_tplg_filename = "sof-mtl-es83x6-ssp1-hdmi-ssp02.tplg",
76 },
77 {
78 .comp_ids = &mtl_essx_83x6,
79 .drv_name = "sof-essx8336",
80 .sof_tplg_filename = "sof-mtl-es8336", /* the tplg suffix is added at run time */
81 .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER |
82 SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
83 SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
84 },
85 {
86 .id = "10EC5650",
87 .drv_name = "mtl_rt5682_def",
88 .machine_quirk = snd_soc_acpi_codec_list,
89 .quirk_data = &mtl_rt5650_amp,
90 .sof_tplg_filename = "sof-mtl-rt5650.tplg",
91 },
92 /* place amp-only boards in the end of table */
93 {
94 .id = "INTC10B0",
95 .drv_name = "mtl_lt6911_hdmi_ssp",
96 .sof_tplg_filename = "sof-mtl-hdmi-ssp02.tplg",
97 },
98 {},
99};
100EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_machines);
101
102static const struct snd_soc_acpi_endpoint single_endpoint = {
103 .num = 0,
104 .aggregated = 0,
105 .group_position = 0,
106 .group_id = 0,
107};
108
109static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
110 .num = 0,
111 .aggregated = 1,
112 .group_position = 0,
113 .group_id = 1,
114};
115
116static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
117 .num = 0,
118 .aggregated = 1,
119 .group_position = 1,
120 .group_id = 1,
121};
122
123static const struct snd_soc_acpi_endpoint rt712_endpoints[] = {
124 {
125 .num = 0,
126 .aggregated = 0,
127 .group_position = 0,
128 .group_id = 0,
129 },
130 {
131 .num = 1,
132 .aggregated = 0,
133 .group_position = 0,
134 .group_id = 0,
135 },
136};
137
138/*
139 * RT722 is a multi-function codec, three endpoints are created for
140 * its headset, amp and dmic functions.
141 */
142static const struct snd_soc_acpi_endpoint rt722_endpoints[] = {
143 {
144 .num = 0,
145 .aggregated = 0,
146 .group_position = 0,
147 .group_id = 0,
148 },
149 {
150 .num = 1,
151 .aggregated = 0,
152 .group_position = 0,
153 .group_id = 0,
154 },
155 {
156 .num = 2,
157 .aggregated = 0,
158 .group_position = 0,
159 .group_id = 0,
160 },
161};
162
163static const struct snd_soc_acpi_endpoint spk_2_endpoint = {
164 .num = 0,
165 .aggregated = 1,
166 .group_position = 2,
167 .group_id = 1,
168};
169
170static const struct snd_soc_acpi_endpoint spk_3_endpoint = {
171 .num = 0,
172 .aggregated = 1,
173 .group_position = 3,
174 .group_id = 1,
175};
176
177static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
178 {
179 .adr = 0x000030025D071101ull,
180 .num_endpoints = 1,
181 .endpoints = &single_endpoint,
182 .name_prefix = "rt711"
183 }
184};
185
186static const struct snd_soc_acpi_adr_device rt712_0_single_adr[] = {
187 {
188 .adr = 0x000030025D071201ull,
189 .num_endpoints = ARRAY_SIZE(rt712_endpoints),
190 .endpoints = rt712_endpoints,
191 .name_prefix = "rt712"
192 }
193};
194
195static const struct snd_soc_acpi_adr_device rt1712_3_single_adr[] = {
196 {
197 .adr = 0x000330025D171201ull,
198 .num_endpoints = 1,
199 .endpoints = &single_endpoint,
200 .name_prefix = "rt712-dmic"
201 }
202};
203
204static const struct snd_soc_acpi_adr_device rt722_0_single_adr[] = {
205 {
206 .adr = 0x000030025d072201ull,
207 .num_endpoints = ARRAY_SIZE(rt722_endpoints),
208 .endpoints = rt722_endpoints,
209 .name_prefix = "rt722"
210 }
211};
212
213static const struct snd_soc_acpi_adr_device rt713_0_single_adr[] = {
214 {
215 .adr = 0x000031025D071301ull,
216 .num_endpoints = 1,
217 .endpoints = &single_endpoint,
218 .name_prefix = "rt713"
219 }
220};
221
222static const struct snd_soc_acpi_adr_device rt1713_3_single_adr[] = {
223 {
224 .adr = 0x000331025D171301ull,
225 .num_endpoints = 1,
226 .endpoints = &single_endpoint,
227 .name_prefix = "rt713-dmic"
228 }
229};
230
231static const struct snd_soc_acpi_adr_device mx8373_0_adr[] = {
232 {
233 .adr = 0x000023019F837300ull,
234 .num_endpoints = 1,
235 .endpoints = &spk_l_endpoint,
236 .name_prefix = "Left"
237 },
238 {
239 .adr = 0x000027019F837300ull,
240 .num_endpoints = 1,
241 .endpoints = &spk_r_endpoint,
242 .name_prefix = "Right"
243 }
244};
245
246static const struct snd_soc_acpi_adr_device rt5682_2_adr[] = {
247 {
248 .adr = 0x000221025D568200ull,
249 .num_endpoints = 1,
250 .endpoints = &single_endpoint,
251 .name_prefix = "rt5682"
252 }
253};
254
255static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = {
256 {
257 .adr = 0x000230025D131601ull,
258 .num_endpoints = 1,
259 .endpoints = &spk_l_endpoint,
260 .name_prefix = "rt1316-1"
261 }
262};
263
264static const struct snd_soc_acpi_adr_device rt1316_3_group1_adr[] = {
265 {
266 .adr = 0x000331025D131601ull,
267 .num_endpoints = 1,
268 .endpoints = &spk_r_endpoint,
269 .name_prefix = "rt1316-2"
270 }
271};
272
273static const struct snd_soc_acpi_adr_device rt1316_1_group2_adr[] = {
274 {
275 .adr = 0x000131025D131601ull,
276 .num_endpoints = 1,
277 .endpoints = &spk_l_endpoint,
278 .name_prefix = "rt1316-1"
279 }
280};
281
282static const struct snd_soc_acpi_adr_device rt1316_2_group2_adr[] = {
283 {
284 .adr = 0x000230025D131601ull,
285 .num_endpoints = 1,
286 .endpoints = &spk_r_endpoint,
287 .name_prefix = "rt1316-2"
288 }
289};
290
291static const struct snd_soc_acpi_adr_device rt1318_1_group1_adr[] = {
292 {
293 .adr = 0x000130025D131801ull,
294 .num_endpoints = 1,
295 .endpoints = &spk_l_endpoint,
296 .name_prefix = "rt1318-1"
297 }
298};
299
300static const struct snd_soc_acpi_adr_device rt1318_2_group1_adr[] = {
301 {
302 .adr = 0x000232025D131801ull,
303 .num_endpoints = 1,
304 .endpoints = &spk_r_endpoint,
305 .name_prefix = "rt1318-2"
306 }
307};
308
309static const struct snd_soc_acpi_adr_device rt714_0_adr[] = {
310 {
311 .adr = 0x000030025D071401ull,
312 .num_endpoints = 1,
313 .endpoints = &single_endpoint,
314 .name_prefix = "rt714"
315 }
316};
317
318static const struct snd_soc_acpi_adr_device rt714_1_adr[] = {
319 {
320 .adr = 0x000130025D071401ull,
321 .num_endpoints = 1,
322 .endpoints = &single_endpoint,
323 .name_prefix = "rt714"
324 }
325};
326
327static const struct snd_soc_acpi_link_adr mtl_712_only[] = {
328 {
329 .mask = BIT(0),
330 .num_adr = ARRAY_SIZE(rt712_0_single_adr),
331 .adr_d = rt712_0_single_adr,
332 },
333 {
334 .mask = BIT(3),
335 .num_adr = ARRAY_SIZE(rt1712_3_single_adr),
336 .adr_d = rt1712_3_single_adr,
337 },
338 {}
339};
340
341static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = {
342 {
343 .adr = 0x00003001FA424301ull,
344 .num_endpoints = 1,
345 .endpoints = &single_endpoint,
346 .name_prefix = "cs42l43"
347 }
348};
349
350static const struct snd_soc_acpi_adr_device cs35l56_1_adr[] = {
351 {
352 .adr = 0x00013701FA355601ull,
353 .num_endpoints = 1,
354 .endpoints = &spk_r_endpoint,
355 .name_prefix = "AMP8"
356 },
357 {
358 .adr = 0x00013601FA355601ull,
359 .num_endpoints = 1,
360 .endpoints = &spk_3_endpoint,
361 .name_prefix = "AMP7"
362 }
363};
364
365static const struct snd_soc_acpi_adr_device cs35l56_2_adr[] = {
366 {
367 .adr = 0x00023301FA355601ull,
368 .num_endpoints = 1,
369 .endpoints = &spk_l_endpoint,
370 .name_prefix = "AMP1"
371 },
372 {
373 .adr = 0x00023201FA355601ull,
374 .num_endpoints = 1,
375 .endpoints = &spk_2_endpoint,
376 .name_prefix = "AMP2"
377 }
378};
379
380static const struct snd_soc_acpi_adr_device cs35l56_2_r_adr[] = {
381 {
382 .adr = 0x00023201FA355601ull,
383 .num_endpoints = 1,
384 .endpoints = &spk_r_endpoint,
385 .name_prefix = "AMP3"
386 },
387 {
388 .adr = 0x00023301FA355601ull,
389 .num_endpoints = 1,
390 .endpoints = &spk_3_endpoint,
391 .name_prefix = "AMP4"
392 }
393
394};
395
396static const struct snd_soc_acpi_adr_device cs35l56_3_l_adr[] = {
397 {
398 .adr = 0x00033001fa355601ull,
399 .num_endpoints = 1,
400 .endpoints = &spk_l_endpoint,
401 .name_prefix = "AMP1"
402 },
403 {
404 .adr = 0x00033101fa355601ull,
405 .num_endpoints = 1,
406 .endpoints = &spk_2_endpoint,
407 .name_prefix = "AMP2"
408 }
409};
410
411static const struct snd_soc_acpi_link_adr rt5682_link2_max98373_link0[] = {
412 /* Expected order: jack -> amp */
413 {
414 .mask = BIT(2),
415 .num_adr = ARRAY_SIZE(rt5682_2_adr),
416 .adr_d = rt5682_2_adr,
417 },
418 {
419 .mask = BIT(0),
420 .num_adr = ARRAY_SIZE(mx8373_0_adr),
421 .adr_d = mx8373_0_adr,
422 },
423 {}
424};
425
426static const struct snd_soc_acpi_link_adr mtl_rvp[] = {
427 {
428 .mask = BIT(0),
429 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
430 .adr_d = rt711_sdca_0_adr,
431 },
432 {}
433};
434
435static const struct snd_soc_acpi_link_adr mtl_rt722_only[] = {
436 {
437 .mask = BIT(0),
438 .num_adr = ARRAY_SIZE(rt722_0_single_adr),
439 .adr_d = rt722_0_single_adr,
440 },
441 {}
442};
443
444static const struct snd_soc_acpi_link_adr mtl_3_in_1_sdca[] = {
445 {
446 .mask = BIT(0),
447 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
448 .adr_d = rt711_sdca_0_adr,
449 },
450 {
451 .mask = BIT(2),
452 .num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
453 .adr_d = rt1316_2_group1_adr,
454 },
455 {
456 .mask = BIT(3),
457 .num_adr = ARRAY_SIZE(rt1316_3_group1_adr),
458 .adr_d = rt1316_3_group1_adr,
459 },
460 {
461 .mask = BIT(1),
462 .num_adr = ARRAY_SIZE(rt714_1_adr),
463 .adr_d = rt714_1_adr,
464 },
465 {}
466};
467
468static const struct snd_soc_acpi_link_adr mtl_sdw_rt1318_l12_rt714_l0[] = {
469 {
470 .mask = BIT(1),
471 .num_adr = ARRAY_SIZE(rt1318_1_group1_adr),
472 .adr_d = rt1318_1_group1_adr,
473 },
474 {
475 .mask = BIT(2),
476 .num_adr = ARRAY_SIZE(rt1318_2_group1_adr),
477 .adr_d = rt1318_2_group1_adr,
478 },
479 {
480 .mask = BIT(0),
481 .num_adr = ARRAY_SIZE(rt714_0_adr),
482 .adr_d = rt714_0_adr,
483 },
484 {}
485};
486
487static const struct snd_soc_acpi_link_adr mtl_rt713_l0_rt1316_l12_rt1713_l3[] = {
488 {
489 .mask = BIT(0),
490 .num_adr = ARRAY_SIZE(rt713_0_single_adr),
491 .adr_d = rt713_0_single_adr,
492 },
493 {
494 .mask = BIT(1),
495 .num_adr = ARRAY_SIZE(rt1316_1_group2_adr),
496 .adr_d = rt1316_1_group2_adr,
497 },
498 {
499 .mask = BIT(2),
500 .num_adr = ARRAY_SIZE(rt1316_2_group2_adr),
501 .adr_d = rt1316_2_group2_adr,
502 },
503 {
504 .mask = BIT(3),
505 .num_adr = ARRAY_SIZE(rt1713_3_single_adr),
506 .adr_d = rt1713_3_single_adr,
507 },
508 {}
509};
510
511static const struct snd_soc_acpi_link_adr mtl_rt713_l0_rt1316_l12[] = {
512 {
513 .mask = BIT(0),
514 .num_adr = ARRAY_SIZE(rt713_0_single_adr),
515 .adr_d = rt713_0_single_adr,
516 },
517 {
518 .mask = BIT(1),
519 .num_adr = ARRAY_SIZE(rt1316_1_group2_adr),
520 .adr_d = rt1316_1_group2_adr,
521 },
522 {
523 .mask = BIT(2),
524 .num_adr = ARRAY_SIZE(rt1316_2_group2_adr),
525 .adr_d = rt1316_2_group2_adr,
526 },
527 {}
528};
529
530static const struct snd_soc_acpi_adr_device mx8363_2_adr[] = {
531 {
532 .adr = 0x000230019F836300ull,
533 .num_endpoints = 1,
534 .endpoints = &spk_l_endpoint,
535 .name_prefix = "Left"
536 },
537 {
538 .adr = 0x000231019F836300ull,
539 .num_endpoints = 1,
540 .endpoints = &spk_r_endpoint,
541 .name_prefix = "Right"
542 }
543};
544
545static const struct snd_soc_acpi_adr_device cs42l42_0_adr[] = {
546 {
547 .adr = 0x00001001FA424200ull,
548 .num_endpoints = 1,
549 .endpoints = &single_endpoint,
550 .name_prefix = "cs42l42"
551 }
552};
553
554static const struct snd_soc_acpi_link_adr cs42l42_link0_max98363_link2[] = {
555 /* Expected order: jack -> amp */
556 {
557 .mask = BIT(0),
558 .num_adr = ARRAY_SIZE(cs42l42_0_adr),
559 .adr_d = cs42l42_0_adr,
560 },
561 {
562 .mask = BIT(2),
563 .num_adr = ARRAY_SIZE(mx8363_2_adr),
564 .adr_d = mx8363_2_adr,
565 },
566 {}
567};
568
569static const struct snd_soc_acpi_link_adr mtl_cs42l43_cs35l56[] = {
570 {
571 .mask = BIT(0),
572 .num_adr = ARRAY_SIZE(cs42l43_0_adr),
573 .adr_d = cs42l43_0_adr,
574 },
575 {
576 .mask = BIT(1),
577 .num_adr = ARRAY_SIZE(cs35l56_1_adr),
578 .adr_d = cs35l56_1_adr,
579 },
580 {
581 .mask = BIT(2),
582 .num_adr = ARRAY_SIZE(cs35l56_2_adr),
583 .adr_d = cs35l56_2_adr,
584 },
585 {}
586};
587
588static const struct snd_soc_acpi_link_adr cs42l43_link0_cs35l56_link2_link3[] = {
589 /* Expected order: jack -> amp */
590 {
591 .mask = BIT(0),
592 .num_adr = ARRAY_SIZE(cs42l43_0_adr),
593 .adr_d = cs42l43_0_adr,
594 },
595 {
596 .mask = BIT(2),
597 .num_adr = ARRAY_SIZE(cs35l56_2_r_adr),
598 .adr_d = cs35l56_2_r_adr,
599 },
600 {
601 .mask = BIT(3),
602 .num_adr = ARRAY_SIZE(cs35l56_3_l_adr),
603 .adr_d = cs35l56_3_l_adr,
604 },
605 {}
606};
607
608/* this table is used when there is no I2S codec present */
609struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = {
610 /* mockup tests need to be first */
611 {
612 .link_mask = GENMASK(3, 0),
613 .links = sdw_mockup_headset_2amps_mic,
614 .drv_name = "sof_sdw",
615 .sof_tplg_filename = "sof-mtl-rt711-rt1308-rt715.tplg",
616 },
617 {
618 .link_mask = BIT(0) | BIT(1) | BIT(3),
619 .links = sdw_mockup_headset_1amp_mic,
620 .drv_name = "sof_sdw",
621 .sof_tplg_filename = "sof-mtl-rt711-rt1308-mono-rt715.tplg",
622 },
623 {
624 .link_mask = GENMASK(2, 0),
625 .links = sdw_mockup_mic_headset_1amp,
626 .drv_name = "sof_sdw",
627 .sof_tplg_filename = "sof-mtl-rt715-rt711-rt1308-mono.tplg",
628 },
629 {
630 .link_mask = GENMASK(3, 0),
631 .links = mtl_rt713_l0_rt1316_l12_rt1713_l3,
632 .drv_name = "sof_sdw",
633 .sof_tplg_filename = "sof-mtl-rt713-l0-rt1316-l12-rt1713-l3.tplg",
634 },
635 {
636 .link_mask = GENMASK(2, 0),
637 .links = mtl_rt713_l0_rt1316_l12,
638 .drv_name = "sof_sdw",
639 .sof_tplg_filename = "sof-mtl-rt713-l0-rt1316-l12.tplg",
640 },
641 {
642 .link_mask = BIT(3) | BIT(0),
643 .links = mtl_712_only,
644 .drv_name = "sof_sdw",
645 .sof_tplg_filename = "sof-mtl-rt712-l0-rt1712-l3.tplg",
646 },
647 {
648 .link_mask = GENMASK(2, 0),
649 .links = mtl_sdw_rt1318_l12_rt714_l0,
650 .drv_name = "sof_sdw",
651 .sof_tplg_filename = "sof-mtl-rt1318-l12-rt714-l0.tplg"
652 },
653 {
654 .link_mask = BIT(0) | BIT(2) | BIT(3),
655 .links = cs42l43_link0_cs35l56_link2_link3,
656 .drv_name = "sof_sdw",
657 .sof_tplg_filename = "sof-mtl-cs42l43-l0-cs35l56-l23.tplg",
658 },
659 {
660 .link_mask = GENMASK(2, 0),
661 .links = mtl_cs42l43_cs35l56,
662 .drv_name = "sof_sdw",
663 .sof_tplg_filename = "sof-mtl-cs42l43-l0-cs35l56-l12.tplg",
664 },
665 {
666 .link_mask = GENMASK(3, 0),
667 .links = mtl_3_in_1_sdca,
668 .drv_name = "sof_sdw",
669 .sof_tplg_filename = "sof-mtl-rt711-l0-rt1316-l23-rt714-l1.tplg",
670 },
671 {
672 .link_mask = BIT(0),
673 .links = mtl_rt722_only,
674 .drv_name = "sof_sdw",
675 .sof_tplg_filename = "sof-mtl-rt722-l0.tplg",
676 },
677 {
678 .link_mask = BIT(0),
679 .links = mtl_rvp,
680 .drv_name = "sof_sdw",
681 .sof_tplg_filename = "sof-mtl-rt711.tplg",
682 },
683 {
684 .link_mask = BIT(0) | BIT(2),
685 .links = rt5682_link2_max98373_link0,
686 .drv_name = "sof_sdw",
687 .sof_tplg_filename = "sof-mtl-sdw-rt5682-l2-max98373-l0.tplg",
688 },
689 {
690 .link_mask = BIT(0) | BIT(2),
691 .links = cs42l42_link0_max98363_link2,
692 .drv_name = "sof_sdw",
693 .sof_tplg_filename = "sof-mtl-sdw-cs42l42-l0-max98363-l2.tplg",
694 },
695 {},
696};
697EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_sdw_machines);
698

source code of linux/sound/soc/intel/common/soc-acpi-intel-mtl-match.c