xref: /linux/sound/soc/intel/common/soc-acpi-intel-mtl-match.c (revision 3e0bc2855b573bcffa2a52955a878f537f5ac0cd)
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 
13 static const struct snd_soc_acpi_codecs mtl_max98357a_amp = {
14 	.num_codecs = 1,
15 	.codecs = {"MX98357A"}
16 };
17 
18 static const struct snd_soc_acpi_codecs mtl_max98360a_amp = {
19 	.num_codecs = 1,
20 	.codecs = {"MX98360A"}
21 };
22 
23 static const struct snd_soc_acpi_codecs mtl_rt1019p_amp = {
24 	.num_codecs = 1,
25 	.codecs = {"RTL1019"}
26 };
27 
28 static const struct snd_soc_acpi_codecs mtl_rt5682_rt5682s_hp = {
29 	.num_codecs = 2,
30 	.codecs = {"10EC5682", "RTL5682"},
31 };
32 
33 static const struct snd_soc_acpi_codecs mtl_essx_83x6 = {
34 	.num_codecs = 3,
35 	.codecs = { "ESSX8316", "ESSX8326", "ESSX8336"},
36 };
37 
38 static const struct snd_soc_acpi_codecs mtl_lt6911_hdmi = {
39 	.num_codecs = 1,
40 	.codecs = {"INTC10B0"}
41 };
42 
43 static const struct snd_soc_acpi_codecs mtl_rt5650_amp = {
44 	.num_codecs = 1,
45 	.codecs = {"10EC5650"}
46 };
47 
48 struct 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_rt1019_rt5682",
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_rt5650",
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 };
100 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_machines);
101 
102 static const struct snd_soc_acpi_endpoint single_endpoint = {
103 	.num = 0,
104 	.aggregated = 0,
105 	.group_position = 0,
106 	.group_id = 0,
107 };
108 
109 static 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 
116 static 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 
123 static 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  */
142 static 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 
163 static 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 
170 static 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 
177 static 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 
186 static 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 
195 static 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 
204 static 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 
213 static 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 
222 static 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 
231 static 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 
246 static 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 
255 static 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 
264 static 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 
273 static 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 
282 static 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 
291 static 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 
300 static 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 
309 static 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 
318 static 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 
327 static 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 
341 static 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 
350 static 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 
365 static 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 
380 static const struct snd_soc_acpi_link_adr rt5682_link2_max98373_link0[] = {
381 	/* Expected order: jack -> amp */
382 	{
383 		.mask = BIT(2),
384 		.num_adr = ARRAY_SIZE(rt5682_2_adr),
385 		.adr_d = rt5682_2_adr,
386 	},
387 	{
388 		.mask = BIT(0),
389 		.num_adr = ARRAY_SIZE(mx8373_0_adr),
390 		.adr_d = mx8373_0_adr,
391 	},
392 	{}
393 };
394 
395 static const struct snd_soc_acpi_link_adr mtl_rvp[] = {
396 	{
397 		.mask = BIT(0),
398 		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
399 		.adr_d = rt711_sdca_0_adr,
400 	},
401 	{}
402 };
403 
404 static const struct snd_soc_acpi_link_adr mtl_rt722_only[] = {
405 	{
406 		.mask = BIT(0),
407 		.num_adr = ARRAY_SIZE(rt722_0_single_adr),
408 		.adr_d = rt722_0_single_adr,
409 	},
410 	{}
411 };
412 
413 static const struct snd_soc_acpi_link_adr mtl_3_in_1_sdca[] = {
414 	{
415 		.mask = BIT(0),
416 		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
417 		.adr_d = rt711_sdca_0_adr,
418 	},
419 	{
420 		.mask = BIT(2),
421 		.num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
422 		.adr_d = rt1316_2_group1_adr,
423 	},
424 	{
425 		.mask = BIT(3),
426 		.num_adr = ARRAY_SIZE(rt1316_3_group1_adr),
427 		.adr_d = rt1316_3_group1_adr,
428 	},
429 	{
430 		.mask = BIT(1),
431 		.num_adr = ARRAY_SIZE(rt714_1_adr),
432 		.adr_d = rt714_1_adr,
433 	},
434 	{}
435 };
436 
437 static const struct snd_soc_acpi_link_adr mtl_sdw_rt1318_l12_rt714_l0[] = {
438 	{
439 		.mask = BIT(1),
440 		.num_adr = ARRAY_SIZE(rt1318_1_group1_adr),
441 		.adr_d = rt1318_1_group1_adr,
442 	},
443 	{
444 		.mask = BIT(2),
445 		.num_adr = ARRAY_SIZE(rt1318_2_group1_adr),
446 		.adr_d = rt1318_2_group1_adr,
447 	},
448 	{
449 		.mask = BIT(0),
450 		.num_adr = ARRAY_SIZE(rt714_0_adr),
451 		.adr_d = rt714_0_adr,
452 	},
453 	{}
454 };
455 
456 static const struct snd_soc_acpi_link_adr mtl_rt713_l0_rt1316_l12_rt1713_l3[] = {
457 	{
458 		.mask = BIT(0),
459 		.num_adr = ARRAY_SIZE(rt713_0_single_adr),
460 		.adr_d = rt713_0_single_adr,
461 	},
462 	{
463 		.mask = BIT(1),
464 		.num_adr = ARRAY_SIZE(rt1316_1_group2_adr),
465 		.adr_d = rt1316_1_group2_adr,
466 	},
467 	{
468 		.mask = BIT(2),
469 		.num_adr = ARRAY_SIZE(rt1316_2_group2_adr),
470 		.adr_d = rt1316_2_group2_adr,
471 	},
472 	{
473 		.mask = BIT(3),
474 		.num_adr = ARRAY_SIZE(rt1713_3_single_adr),
475 		.adr_d = rt1713_3_single_adr,
476 	},
477 	{}
478 };
479 
480 static const struct snd_soc_acpi_link_adr mtl_rt713_l0_rt1316_l12[] = {
481 	{
482 		.mask = BIT(0),
483 		.num_adr = ARRAY_SIZE(rt713_0_single_adr),
484 		.adr_d = rt713_0_single_adr,
485 	},
486 	{
487 		.mask = BIT(1),
488 		.num_adr = ARRAY_SIZE(rt1316_1_group2_adr),
489 		.adr_d = rt1316_1_group2_adr,
490 	},
491 	{
492 		.mask = BIT(2),
493 		.num_adr = ARRAY_SIZE(rt1316_2_group2_adr),
494 		.adr_d = rt1316_2_group2_adr,
495 	},
496 	{}
497 };
498 
499 static const struct snd_soc_acpi_adr_device mx8363_2_adr[] = {
500 	{
501 		.adr = 0x000230019F836300ull,
502 		.num_endpoints = 1,
503 		.endpoints = &spk_l_endpoint,
504 		.name_prefix = "Left"
505 	},
506 	{
507 		.adr = 0x000231019F836300ull,
508 		.num_endpoints = 1,
509 		.endpoints = &spk_r_endpoint,
510 		.name_prefix = "Right"
511 	}
512 };
513 
514 static const struct snd_soc_acpi_adr_device cs42l42_0_adr[] = {
515 	{
516 		.adr = 0x00001001FA424200ull,
517 		.num_endpoints = 1,
518 		.endpoints = &single_endpoint,
519 		.name_prefix = "cs42l42"
520 	}
521 };
522 
523 static const struct snd_soc_acpi_link_adr cs42l42_link0_max98363_link2[] = {
524 	/* Expected order: jack -> amp */
525 	{
526 		.mask = BIT(0),
527 		.num_adr = ARRAY_SIZE(cs42l42_0_adr),
528 		.adr_d = cs42l42_0_adr,
529 	},
530 	{
531 		.mask = BIT(2),
532 		.num_adr = ARRAY_SIZE(mx8363_2_adr),
533 		.adr_d = mx8363_2_adr,
534 	},
535 	{}
536 };
537 
538 static const struct snd_soc_acpi_link_adr mtl_cs42l43_cs35l56[] = {
539 	{
540 		.mask = BIT(0),
541 		.num_adr = ARRAY_SIZE(cs42l43_0_adr),
542 		.adr_d = cs42l43_0_adr,
543 	},
544 	{
545 		.mask = BIT(1),
546 		.num_adr = ARRAY_SIZE(cs35l56_1_adr),
547 		.adr_d = cs35l56_1_adr,
548 	},
549 	{
550 		.mask = BIT(2),
551 		.num_adr = ARRAY_SIZE(cs35l56_2_adr),
552 		.adr_d = cs35l56_2_adr,
553 	},
554 	{}
555 };
556 
557 /* this table is used when there is no I2S codec present */
558 struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = {
559 	/* mockup tests need to be first */
560 	{
561 		.link_mask = GENMASK(3, 0),
562 		.links = sdw_mockup_headset_2amps_mic,
563 		.drv_name = "sof_sdw",
564 		.sof_tplg_filename = "sof-mtl-rt711-rt1308-rt715.tplg",
565 	},
566 	{
567 		.link_mask = BIT(0) | BIT(1) | BIT(3),
568 		.links = sdw_mockup_headset_1amp_mic,
569 		.drv_name = "sof_sdw",
570 		.sof_tplg_filename = "sof-mtl-rt711-rt1308-mono-rt715.tplg",
571 	},
572 	{
573 		.link_mask = GENMASK(2, 0),
574 		.links = sdw_mockup_mic_headset_1amp,
575 		.drv_name = "sof_sdw",
576 		.sof_tplg_filename = "sof-mtl-rt715-rt711-rt1308-mono.tplg",
577 	},
578 	{
579 		.link_mask = GENMASK(3, 0),
580 		.links = mtl_rt713_l0_rt1316_l12_rt1713_l3,
581 		.drv_name = "sof_sdw",
582 		.sof_tplg_filename = "sof-mtl-rt713-l0-rt1316-l12-rt1713-l3.tplg",
583 	},
584 	{
585 		.link_mask = GENMASK(2, 0),
586 		.links = mtl_rt713_l0_rt1316_l12,
587 		.drv_name = "sof_sdw",
588 		.sof_tplg_filename = "sof-mtl-rt713-l0-rt1316-l12.tplg",
589 	},
590 	{
591 		.link_mask = BIT(3) | BIT(0),
592 		.links = mtl_712_only,
593 		.drv_name = "sof_sdw",
594 		.sof_tplg_filename = "sof-mtl-rt712-l0-rt1712-l3.tplg",
595 	},
596 	{
597 		.link_mask = GENMASK(2, 0),
598 		.links = mtl_sdw_rt1318_l12_rt714_l0,
599 		.drv_name = "sof_sdw",
600 		.sof_tplg_filename = "sof-mtl-rt1318-l12-rt714-l0.tplg"
601 	},
602 	{
603 		.link_mask = GENMASK(2, 0),
604 		.links = mtl_cs42l43_cs35l56,
605 		.drv_name = "sof_sdw",
606 		.sof_tplg_filename = "sof-mtl-cs42l43-l0-cs35l56-l12.tplg",
607 	},
608 	{
609 		.link_mask = GENMASK(3, 0),
610 		.links = mtl_3_in_1_sdca,
611 		.drv_name = "sof_sdw",
612 		.sof_tplg_filename = "sof-mtl-rt711-l0-rt1316-l23-rt714-l1.tplg",
613 	},
614 	{
615 		.link_mask = BIT(0),
616 		.links = mtl_rt722_only,
617 		.drv_name = "sof_sdw",
618 		.sof_tplg_filename = "sof-mtl-rt722-l0.tplg",
619 	},
620 	{
621 		.link_mask = BIT(0),
622 		.links = mtl_rvp,
623 		.drv_name = "sof_sdw",
624 		.sof_tplg_filename = "sof-mtl-rt711.tplg",
625 	},
626 	{
627 		.link_mask = BIT(0) | BIT(2),
628 		.links = rt5682_link2_max98373_link0,
629 		.drv_name = "sof_sdw",
630 		.sof_tplg_filename = "sof-mtl-sdw-rt5682-l2-max98373-l0.tplg",
631 	},
632 	{
633 		.link_mask = BIT(0) | BIT(2),
634 		.links = cs42l42_link0_max98363_link2,
635 		.drv_name = "sof_sdw",
636 		.sof_tplg_filename = "sof-mtl-sdw-cs42l42-l0-max98363-l2.tplg",
637 	},
638 	{},
639 };
640 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_sdw_machines);
641