xref: /linux/sound/soc/intel/common/soc-acpi-intel-lnl-match.c (revision 3fd6c59042dbba50391e30862beac979491145fe)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * soc-acpi-intel-lnl-match.c - tables and support for LNL ACPI enumeration.
4  *
5  * Copyright (c) 2023, Intel Corporation
6  *
7  */
8 
9 #include <sound/soc-acpi.h>
10 #include <sound/soc-acpi-intel-match.h>
11 #include "soc-acpi-intel-sdca-quirks.h"
12 #include "soc-acpi-intel-sdw-mockup-match.h"
13 
14 struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_machines[] = {
15 	{},
16 };
17 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_lnl_machines);
18 
19 static const struct snd_soc_acpi_endpoint single_endpoint = {
20 	.num = 0,
21 	.aggregated = 0,
22 	.group_position = 0,
23 	.group_id = 0,
24 };
25 
26 static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
27 	.num = 0,
28 	.aggregated = 1,
29 	.group_position = 0,
30 	.group_id = 1,
31 };
32 
33 static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
34 	.num = 0,
35 	.aggregated = 1,
36 	.group_position = 1,
37 	.group_id = 1,
38 };
39 
40 static const struct snd_soc_acpi_endpoint spk_2_endpoint = {
41 	.num = 0,
42 	.aggregated = 1,
43 	.group_position = 2,
44 	.group_id = 1,
45 };
46 
47 static const struct snd_soc_acpi_endpoint spk_3_endpoint = {
48 	.num = 0,
49 	.aggregated = 1,
50 	.group_position = 3,
51 	.group_id = 1,
52 };
53 
54 static const struct snd_soc_acpi_endpoint rt712_endpoints[] = {
55 	{
56 		.num = 0,
57 		.aggregated = 0,
58 		.group_position = 0,
59 		.group_id = 0,
60 	},
61 	{
62 		.num = 1,
63 		.aggregated = 0,
64 		.group_position = 0,
65 		.group_id = 0,
66 	},
67 };
68 
69 /*
70  * RT722 is a multi-function codec, three endpoints are created for
71  * its headset, amp and dmic functions.
72  */
73 static const struct snd_soc_acpi_endpoint rt722_endpoints[] = {
74 	{
75 		.num = 0,
76 		.aggregated = 0,
77 		.group_position = 0,
78 		.group_id = 0,
79 	},
80 	{
81 		.num = 1,
82 		.aggregated = 0,
83 		.group_position = 0,
84 		.group_id = 0,
85 	},
86 	{
87 		.num = 2,
88 		.aggregated = 0,
89 		.group_position = 0,
90 		.group_id = 0,
91 	},
92 };
93 
94 static const struct snd_soc_acpi_endpoint jack_amp_g1_dmic_endpoints_endpoints[] = {
95 	/* Jack Endpoint */
96 	{
97 		.num = 0,
98 		.aggregated = 0,
99 		.group_position = 0,
100 		.group_id = 0,
101 	},
102 	/* Amp Endpoint, work as spk_l_endpoint */
103 	{
104 		.num = 1,
105 		.aggregated = 1,
106 		.group_position = 0,
107 		.group_id = 1,
108 	},
109 	/* DMIC Endpoint */
110 	{
111 		.num = 2,
112 		.aggregated = 0,
113 		.group_position = 0,
114 		.group_id = 0,
115 	},
116 };
117 
118 static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = {
119 	{ /* Jack Playback Endpoint */
120 		.num = 0,
121 		.aggregated = 0,
122 		.group_position = 0,
123 		.group_id = 0,
124 	},
125 	{ /* DMIC Capture Endpoint */
126 		.num = 1,
127 		.aggregated = 0,
128 		.group_position = 0,
129 		.group_id = 0,
130 	},
131 	{ /* Jack Capture Endpoint */
132 		.num = 2,
133 		.aggregated = 0,
134 		.group_position = 0,
135 		.group_id = 0,
136 	},
137 	{ /* Speaker Playback Endpoint */
138 		.num = 3,
139 		.aggregated = 0,
140 		.group_position = 0,
141 		.group_id = 0,
142 	},
143 };
144 
145 static const struct snd_soc_acpi_adr_device cs35l56_2_l_adr[] = {
146 	{
147 		.adr = 0x00023001FA355601ull,
148 		.num_endpoints = 1,
149 		.endpoints = &spk_l_endpoint,
150 		.name_prefix = "AMP1"
151 	},
152 	{
153 		.adr = 0x00023101FA355601ull,
154 		.num_endpoints = 1,
155 		.endpoints = &spk_2_endpoint,
156 		.name_prefix = "AMP2"
157 	}
158 };
159 
160 static const struct snd_soc_acpi_adr_device cs35l56_3_r_adr[] = {
161 	{
162 		.adr = 0x00033201fa355601ull,
163 		.num_endpoints = 1,
164 		.endpoints = &spk_r_endpoint,
165 		.name_prefix = "AMP3"
166 	},
167 	{
168 		.adr = 0x00033301fa355601ull,
169 		.num_endpoints = 1,
170 		.endpoints = &spk_3_endpoint,
171 		.name_prefix = "AMP4"
172 	}
173 };
174 
175 static const struct snd_soc_acpi_adr_device cs35l56_3_lr_adr[] = {
176 	{
177 		.adr = 0x00033001fa355601ull,
178 		.num_endpoints = 1,
179 		.endpoints = &spk_l_endpoint,
180 		.name_prefix = "AMP1"
181 	},
182 	{
183 		.adr = 0x00033101fa355601ull,
184 		.num_endpoints = 1,
185 		.endpoints = &spk_r_endpoint,
186 		.name_prefix = "AMP2"
187 	}
188 };
189 
190 static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = {
191 	{
192 		.adr = 0x00003001FA424301ull,
193 		.num_endpoints = ARRAY_SIZE(cs42l43_endpoints),
194 		.endpoints = cs42l43_endpoints,
195 		.name_prefix = "cs42l43"
196 	}
197 };
198 
199 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
200 	{
201 		.adr = 0x000030025D071101ull,
202 		.num_endpoints = 1,
203 		.endpoints = &single_endpoint,
204 		.name_prefix = "rt711"
205 	}
206 };
207 
208 static const struct snd_soc_acpi_adr_device rt712_2_single_adr[] = {
209 	{
210 		.adr = 0x000230025D071201ull,
211 		.num_endpoints = ARRAY_SIZE(rt712_endpoints),
212 		.endpoints = rt712_endpoints,
213 		.name_prefix = "rt712"
214 	}
215 };
216 
217 static const struct snd_soc_acpi_adr_device rt1712_3_single_adr[] = {
218 	{
219 		.adr = 0x000330025D171201ull,
220 		.num_endpoints = 1,
221 		.endpoints = &single_endpoint,
222 		.name_prefix = "rt712-dmic"
223 	}
224 };
225 
226 static const struct snd_soc_acpi_adr_device rt712_vb_2_group1_adr[] = {
227 	{
228 		.adr = 0x000230025D071201ull,
229 		.num_endpoints = ARRAY_SIZE(jack_amp_g1_dmic_endpoints_endpoints),
230 		.endpoints = jack_amp_g1_dmic_endpoints_endpoints,
231 		.name_prefix = "rt712"
232 	}
233 };
234 
235 static const struct snd_soc_acpi_adr_device rt722_0_single_adr[] = {
236 	{
237 		.adr = 0x000030025d072201ull,
238 		.num_endpoints = ARRAY_SIZE(rt722_endpoints),
239 		.endpoints = rt722_endpoints,
240 		.name_prefix = "rt722"
241 	}
242 };
243 
244 static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = {
245 	{
246 		.adr = 0x000230025D131601ull,
247 		.num_endpoints = 1,
248 		.endpoints = &spk_l_endpoint,
249 		.name_prefix = "rt1316-1"
250 	}
251 };
252 
253 static const struct snd_soc_acpi_adr_device rt1316_3_group1_adr[] = {
254 	{
255 		.adr = 0x000331025D131601ull,
256 		.num_endpoints = 1,
257 		.endpoints = &spk_r_endpoint,
258 		.name_prefix = "rt1316-2"
259 	}
260 };
261 
262 static const struct snd_soc_acpi_adr_device rt1318_1_adr[] = {
263 	{
264 		.adr = 0x000133025D131801ull,
265 		.num_endpoints = 1,
266 		.endpoints = &single_endpoint,
267 		.name_prefix = "rt1318-1"
268 	}
269 };
270 
271 static const struct snd_soc_acpi_adr_device rt1318_1_group1_adr[] = {
272 	{
273 		.adr = 0x000130025D131801ull,
274 		.num_endpoints = 1,
275 		.endpoints = &spk_l_endpoint,
276 		.name_prefix = "rt1318-1"
277 	}
278 };
279 
280 static const struct snd_soc_acpi_adr_device rt1318_2_group1_adr[] = {
281 	{
282 		.adr = 0x000232025D131801ull,
283 		.num_endpoints = 1,
284 		.endpoints = &spk_r_endpoint,
285 		.name_prefix = "rt1318-2"
286 	}
287 };
288 
289 static const struct snd_soc_acpi_adr_device rt1320_1_group1_adr[] = {
290 	{
291 		.adr = 0x000130025D132001ull,
292 		.num_endpoints = 1,
293 		.endpoints = &spk_r_endpoint,
294 		.name_prefix = "rt1320-1"
295 	}
296 };
297 
298 static const struct snd_soc_acpi_adr_device rt713_0_adr[] = {
299 	{
300 		.adr = 0x000031025D071301ull,
301 		.num_endpoints = 1,
302 		.endpoints = &single_endpoint,
303 		.name_prefix = "rt713"
304 	}
305 };
306 
307 static const struct snd_soc_acpi_adr_device rt714_0_adr[] = {
308 	{
309 		.adr = 0x000030025D071401ull,
310 		.num_endpoints = 1,
311 		.endpoints = &single_endpoint,
312 		.name_prefix = "rt714"
313 	}
314 };
315 
316 static const struct snd_soc_acpi_adr_device rt714_1_adr[] = {
317 	{
318 		.adr = 0x000130025D071401ull,
319 		.num_endpoints = 1,
320 		.endpoints = &single_endpoint,
321 		.name_prefix = "rt714"
322 	}
323 };
324 
325 static const struct snd_soc_acpi_link_adr lnl_cs42l43_l0[] = {
326 	{
327 		.mask = BIT(0),
328 		.num_adr = ARRAY_SIZE(cs42l43_0_adr),
329 		.adr_d = cs42l43_0_adr,
330 	},
331 	{}
332 };
333 
334 static const struct snd_soc_acpi_link_adr lnl_cs42l43_l0_cs35l56_l3[] = {
335 	{
336 		.mask = BIT(0),
337 		.num_adr = ARRAY_SIZE(cs42l43_0_adr),
338 		.adr_d = cs42l43_0_adr,
339 	},
340 	{
341 		.mask = BIT(3),
342 		.num_adr = ARRAY_SIZE(cs35l56_3_lr_adr),
343 		.adr_d = cs35l56_3_lr_adr,
344 	},
345 	{}
346 };
347 
348 static const struct snd_soc_acpi_link_adr lnl_cs42l43_l0_cs35l56_l23[] = {
349 	{
350 		.mask = BIT(0),
351 		.num_adr = ARRAY_SIZE(cs42l43_0_adr),
352 		.adr_d = cs42l43_0_adr,
353 	},
354 	{
355 		.mask = BIT(2),
356 		.num_adr = ARRAY_SIZE(cs35l56_2_l_adr),
357 		.adr_d = cs35l56_2_l_adr,
358 	},
359 	{
360 		.mask = BIT(3),
361 		.num_adr = ARRAY_SIZE(cs35l56_3_r_adr),
362 		.adr_d = cs35l56_3_r_adr,
363 	},
364 	{}
365 };
366 
367 static const struct snd_soc_acpi_link_adr lnl_rvp[] = {
368 	{
369 		.mask = BIT(0),
370 		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
371 		.adr_d = rt711_sdca_0_adr,
372 	},
373 	{}
374 };
375 
376 static const struct snd_soc_acpi_link_adr lnl_712_only[] = {
377 	{
378 		.mask = BIT(2),
379 		.num_adr = ARRAY_SIZE(rt712_2_single_adr),
380 		.adr_d = rt712_2_single_adr,
381 	},
382 	{
383 		.mask = BIT(3),
384 		.num_adr = ARRAY_SIZE(rt1712_3_single_adr),
385 		.adr_d = rt1712_3_single_adr,
386 	},
387 	{}
388 };
389 
390 static const struct snd_soc_acpi_link_adr lnl_rt722_only[] = {
391 	{
392 		.mask = BIT(0),
393 		.num_adr = ARRAY_SIZE(rt722_0_single_adr),
394 		.adr_d = rt722_0_single_adr,
395 	},
396 	{}
397 };
398 
399 static const struct snd_soc_acpi_link_adr lnl_3_in_1_sdca[] = {
400 	{
401 		.mask = BIT(0),
402 		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
403 		.adr_d = rt711_sdca_0_adr,
404 	},
405 	{
406 		.mask = BIT(2),
407 		.num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
408 		.adr_d = rt1316_2_group1_adr,
409 	},
410 	{
411 		.mask = BIT(3),
412 		.num_adr = ARRAY_SIZE(rt1316_3_group1_adr),
413 		.adr_d = rt1316_3_group1_adr,
414 	},
415 	{
416 		.mask = BIT(1),
417 		.num_adr = ARRAY_SIZE(rt714_1_adr),
418 		.adr_d = rt714_1_adr,
419 	},
420 	{}
421 };
422 
423 static const struct snd_soc_acpi_link_adr lnl_sdw_rt1318_l12_rt714_l0[] = {
424 	{
425 		.mask = BIT(1),
426 		.num_adr = ARRAY_SIZE(rt1318_1_group1_adr),
427 		.adr_d = rt1318_1_group1_adr,
428 	},
429 	{
430 		.mask = BIT(2),
431 		.num_adr = ARRAY_SIZE(rt1318_2_group1_adr),
432 		.adr_d = rt1318_2_group1_adr,
433 	},
434 	{
435 		.mask = BIT(0),
436 		.num_adr = ARRAY_SIZE(rt714_0_adr),
437 		.adr_d = rt714_0_adr,
438 	},
439 	{}
440 };
441 
442 static const struct snd_soc_acpi_link_adr lnl_sdw_rt713_l0_rt1318_l1[] = {
443 	{
444 		.mask = BIT(0),
445 		.num_adr = ARRAY_SIZE(rt713_0_adr),
446 		.adr_d = rt713_0_adr,
447 	},
448 	{
449 		.mask = BIT(1),
450 		.num_adr = ARRAY_SIZE(rt1318_1_adr),
451 		.adr_d = rt1318_1_adr,
452 	},
453 	{}
454 };
455 
456 static const struct snd_soc_acpi_link_adr lnl_sdw_rt712_vb_l2_rt1320_l1[] = {
457 	{
458 		.mask = BIT(2),
459 		.num_adr = ARRAY_SIZE(rt712_vb_2_group1_adr),
460 		.adr_d = rt712_vb_2_group1_adr,
461 	},
462 	{
463 		.mask = BIT(1),
464 		.num_adr = ARRAY_SIZE(rt1320_1_group1_adr),
465 		.adr_d = rt1320_1_group1_adr,
466 	},
467 	{}
468 };
469 
470 /* this table is used when there is no I2S codec present */
471 /* this table is used when there is no I2S codec present */
472 struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[] = {
473 	/* mockup tests need to be first */
474 	{
475 		.link_mask = GENMASK(3, 0),
476 		.links = sdw_mockup_headset_2amps_mic,
477 		.drv_name = "sof_sdw",
478 		.sof_tplg_filename = "sof-lnl-rt711-rt1308-rt715.tplg",
479 	},
480 	{
481 		.link_mask = BIT(0) | BIT(1) | BIT(3),
482 		.links = sdw_mockup_headset_1amp_mic,
483 		.drv_name = "sof_sdw",
484 		.sof_tplg_filename = "sof-lnl-rt711-rt1308-mono-rt715.tplg",
485 	},
486 	{
487 		.link_mask = GENMASK(2, 0),
488 		.links = sdw_mockup_mic_headset_1amp,
489 		.drv_name = "sof_sdw",
490 		.sof_tplg_filename = "sof-lnl-rt715-rt711-rt1308-mono.tplg",
491 	},
492 	{
493 		.link_mask = GENMASK(3, 0),
494 		.links = lnl_3_in_1_sdca,
495 		.drv_name = "sof_sdw",
496 		.sof_tplg_filename = "sof-lnl-rt711-l0-rt1316-l23-rt714-l1.tplg",
497 	},
498 	{
499 		.link_mask = BIT(0) | BIT(2) | BIT(3),
500 		.links = lnl_cs42l43_l0_cs35l56_l23,
501 		.drv_name = "sof_sdw",
502 		.sof_tplg_filename = "sof-lnl-cs42l43-l0-cs35l56-l23.tplg",
503 	},
504 	{
505 		.link_mask = BIT(0) | BIT(3),
506 		.links = lnl_cs42l43_l0_cs35l56_l3,
507 		.drv_name = "sof_sdw",
508 		.sof_tplg_filename = "sof-lnl-cs42l43-l0-cs35l56-l3.tplg",
509 	},
510 	{
511 		.link_mask = BIT(0),
512 		.links = lnl_cs42l43_l0,
513 		.drv_name = "sof_sdw",
514 		.sof_tplg_filename = "sof-lnl-cs42l43-l0.tplg",
515 	},
516 	{
517 		.link_mask = BIT(0),
518 		.links = lnl_rvp,
519 		.drv_name = "sof_sdw",
520 		.sof_tplg_filename = "sof-lnl-rt711.tplg",
521 	},
522 	{
523 		.link_mask = BIT(2) | BIT(3),
524 		.links = lnl_712_only,
525 		.drv_name = "sof_sdw",
526 		.sof_tplg_filename = "sof-lnl-rt712-l2-rt1712-l3.tplg",
527 	},
528 	{
529 		.link_mask = BIT(0),
530 		.links = lnl_rt722_only,
531 		.drv_name = "sof_sdw",
532 		.sof_tplg_filename = "sof-lnl-rt722-l0.tplg",
533 	},
534 	{
535 		.link_mask = GENMASK(2, 0),
536 		.links = lnl_sdw_rt1318_l12_rt714_l0,
537 		.drv_name = "sof_sdw",
538 		.sof_tplg_filename = "sof-lnl-rt1318-l12-rt714-l0.tplg"
539 	},
540 	{
541 		.link_mask = BIT(0) | BIT(1),
542 		.links = lnl_sdw_rt713_l0_rt1318_l1,
543 		.drv_name = "sof_sdw",
544 		.sof_tplg_filename = "sof-lnl-rt713-l0-rt1318-l1.tplg"
545 	},
546 	{
547 		.link_mask = BIT(1) | BIT(2),
548 		.links = lnl_sdw_rt712_vb_l2_rt1320_l1,
549 		.drv_name = "sof_sdw",
550 		.machine_check = snd_soc_acpi_intel_sdca_is_device_rt712_vb,
551 		.sof_tplg_filename = "sof-lnl-rt712-l2-rt1320-l1.tplg"
552 	},
553 	{},
554 };
555 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_lnl_sdw_machines);
556