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