Debian Codegraph @

sound/soc/intel/common/soc-acpi-intel-arl-match.c

raw
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * soc-apci-intel-arl-match.c - tables and support for ARL ACPI enumeration.
4 *
5 * Copyright (c) 2023 Intel Corporation.
6 */
7
8 #include <sound/soc-acpi.h>
9 #include <sound/soc-acpi-intel-match.h>
10 #include <sound/soc-acpi-intel-ssp-common.h>
11 #include "sof-function-topology-lib.h"
12
13 static const struct snd_soc_acpi_endpoint single_endpoint = {
14 .num = 0,
15 .aggregated = 0,
16 .group_position = 0,
17 .group_id = 0,
18 };
19
20 static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
21 .num = 0,
22 .aggregated = 1,
23 .group_position = 0,
24 .group_id = 1,
25 };
26
27 static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
28 .num = 0,
29 .aggregated = 1,
30 .group_position = 1,
31 .group_id = 1,
32 };
33
34 static const struct snd_soc_acpi_endpoint spk_2_endpoint = {
35 .num = 0,
36 .aggregated = 1,
37 .group_position = 2,
38 .group_id = 1,
39 };
40
41 static const struct snd_soc_acpi_endpoint spk_3_endpoint = {
42 .num = 0,
43 .aggregated = 1,
44 .group_position = 3,
45 .group_id = 1,
46 };
47
48 static const struct snd_soc_acpi_endpoint jack_amp_g1_dmic_endpoints[] = {
49 /* Jack Endpoint */
50 {
51 .num = 0,
52 .aggregated = 0,
53 .group_position = 0,
54 .group_id = 0,
55 },
56 /* Amp Endpoint, work as spk_l_endpoint */
57 {
58 .num = 1,
59 .aggregated = 1,
60 .group_position = 0,
61 .group_id = 1,
62 },
63 /* DMIC Endpoint */
64 {
65 .num = 2,
66 .aggregated = 0,
67 .group_position = 0,
68 .group_id = 0,
69 },
70 };
71
72 static const struct snd_soc_acpi_adr_device cs35l56_2_lr_adr[] = {
73 {
74 .adr = 0x00023001FA355601ull,
75 .num_endpoints = 1,
76 .endpoints = &spk_l_endpoint,
77 .name_prefix = "AMP1"
78 },
79 {
80 .adr = 0x00023101FA355601ull,
81 .num_endpoints = 1,
82 .endpoints = &spk_r_endpoint,
83 .name_prefix = "AMP2"
84 }
85 };
86
87 static const struct snd_soc_acpi_adr_device cs35l56_3_lr_adr[] = {
88 {
89 .adr = 0x00033001FA355601ull,
90 .num_endpoints = 1,
91 .endpoints = &spk_l_endpoint,
92 .name_prefix = "AMP1"
93 },
94 {
95 .adr = 0x00033401FA355601ull,
96 .num_endpoints = 1,
97 .endpoints = &spk_r_endpoint,
98 .name_prefix = "AMP2"
99 }
100 };
101
102 static const struct snd_soc_acpi_adr_device cs35l56_2_r_adr[] = {
103 {
104 .adr = 0x00023201FA355601ull,
105 .num_endpoints = 1,
106 .endpoints = &spk_r_endpoint,
107 .name_prefix = "AMP3"
108 },
109 {
110 .adr = 0x00023301FA355601ull,
111 .num_endpoints = 1,
112 .endpoints = &spk_3_endpoint,
113 .name_prefix = "AMP4"
114 }
115 };
116
117 static const struct snd_soc_acpi_adr_device cs35l56_3_l_adr[] = {
118 {
119 .adr = 0x00033001fa355601ull,
120 .num_endpoints = 1,
121 .endpoints = &spk_l_endpoint,
122 .name_prefix = "AMP1"
123 },
124 {
125 .adr = 0x00033101fa355601ull,
126 .num_endpoints = 1,
127 .endpoints = &spk_2_endpoint,
128 .name_prefix = "AMP2"
129 }
130 };
131
132 static const struct snd_soc_acpi_adr_device cs35l56_2_r1_adr[] = {
133 {
134 .adr = 0x00023101FA355601ull,
135 .num_endpoints = 1,
136 .endpoints = &spk_r_endpoint,
137 .name_prefix = "AMP2"
138 },
139 };
140
141 static const struct snd_soc_acpi_adr_device cs35l56_3_l3_adr[] = {
142 {
143 .adr = 0x00033301fa355601ull,
144 .num_endpoints = 1,
145 .endpoints = &spk_l_endpoint,
146 .name_prefix = "AMP1"
147 },
148 };
149
150 static const struct snd_soc_acpi_adr_device cs35l56_2_r3_adr[] = {
151 {
152 .adr = 0x00023301fa355601ull,
153 .num_endpoints = 1,
154 .endpoints = &spk_r_endpoint,
155 .name_prefix = "AMP2"
156 },
157 };
158
159 static const struct snd_soc_acpi_adr_device cs35l56_3_l1_adr[] = {
160 {
161 .adr = 0x00033101fa355601ull,
162 .num_endpoints = 1,
163 .endpoints = &spk_l_endpoint,
164 .name_prefix = "AMP1"
165 },
166 };
167
168 static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = {
169 { /* Jack Playback Endpoint */
170 .num = 0,
171 .aggregated = 0,
172 .group_position = 0,
173 .group_id = 0,
174 },
175 { /* DMIC Capture Endpoint */
176 .num = 1,
177 .aggregated = 0,
178 .group_position = 0,
179 .group_id = 0,
180 },
181 { /* Jack Capture Endpoint */
182 .num = 2,
183 .aggregated = 0,
184 .group_position = 0,
185 .group_id = 0,
186 },
187 { /* Speaker Playback Endpoint */
188 .num = 3,
189 .aggregated = 0,
190 .group_position = 0,
191 .group_id = 0,
192 },
193 };
194
195 static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = {
196 {
197 .adr = 0x00003001FA424301ull,
198 .num_endpoints = ARRAY_SIZE(cs42l43_endpoints),
199 .endpoints = cs42l43_endpoints,
200 .name_prefix = "cs42l43"
201 }
202 };
203
204 static const struct snd_soc_acpi_adr_device cs42l43_2_adr[] = {
205 {
206 .adr = 0x00023001FA424301ull,
207 .num_endpoints = ARRAY_SIZE(cs42l43_endpoints),
208 .endpoints = cs42l43_endpoints,
209 .name_prefix = "cs42l43"
210 }
211 };
212
213 static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
214 {
215 .adr = 0x000020025D071100ull,
216 .num_endpoints = 1,
217 .endpoints = &single_endpoint,
218 .name_prefix = "rt711"
219 }
220 };
221
222 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
223 {
224 .adr = 0x000030025D071101ull,
225 .num_endpoints = 1,
226 .endpoints = &single_endpoint,
227 .name_prefix = "rt711"
228 }
229 };
230
231 static const struct snd_soc_acpi_adr_device rt722_0_agg_adr[] = {
232 {
233 .adr = 0x000030025D072201ull,
234 .num_endpoints = ARRAY_SIZE(jack_amp_g1_dmic_endpoints),
235 .endpoints = jack_amp_g1_dmic_endpoints,
236 .name_prefix = "rt722"
237 }
238 };
239
240 static const struct snd_soc_acpi_adr_device rt1316_3_single_adr[] = {
241 {
242 .adr = 0x000330025D131601ull,
243 .num_endpoints = 1,
244 .endpoints = &single_endpoint,
245 .name_prefix = "rt1316-1"
246 }
247 };
248
249 static const struct snd_soc_acpi_adr_device rt1320_2_single_adr[] = {
250 {
251 .adr = 0x000230025D132001ull,
252 .num_endpoints = 1,
253 .endpoints = &single_endpoint,
254 .name_prefix = "rt1320-1"
255 }
256 };
257
258 static const struct snd_soc_acpi_link_adr arl_cs42l43_l0[] = {
259 {
260 .mask = BIT(0),
261 .num_adr = ARRAY_SIZE(cs42l43_0_adr),
262 .adr_d = cs42l43_0_adr,
263 },
264 {}
265 };
266
267 static const struct snd_soc_acpi_link_adr arl_cs42l43_l2[] = {
268 {
269 .mask = BIT(2),
270 .num_adr = ARRAY_SIZE(cs42l43_2_adr),
271 .adr_d = cs42l43_2_adr,
272 },
273 {}
274 };
275
276 static const struct snd_soc_acpi_link_adr arl_cs42l43_l2_cs35l56_l3[] = {
277 {
278 .mask = BIT(2),
279 .num_adr = ARRAY_SIZE(cs42l43_2_adr),
280 .adr_d = cs42l43_2_adr,
281 },
282 {
283 .mask = BIT(3),
284 .num_adr = ARRAY_SIZE(cs35l56_3_lr_adr),
285 .adr_d = cs35l56_3_lr_adr,
286 },
287 {}
288 };
289
290 static const struct snd_soc_acpi_link_adr arl_cs42l43_l0_cs35l56_l2[] = {
291 {
292 .mask = BIT(0),
293 .num_adr = ARRAY_SIZE(cs42l43_0_adr),
294 .adr_d = cs42l43_0_adr,
295 },
296 {
297 .mask = BIT(2),
298 .num_adr = ARRAY_SIZE(cs35l56_2_lr_adr),
299 .adr_d = cs35l56_2_lr_adr,
300 },
301 {}
302 };
303
304 static const struct snd_soc_acpi_link_adr arl_cs42l43_l0_cs35l56_l23[] = {
305 {
306 .mask = BIT(0),
307 .num_adr = ARRAY_SIZE(cs42l43_0_adr),
308 .adr_d = cs42l43_0_adr,
309 },
310 {
311 .mask = BIT(2),
312 .num_adr = ARRAY_SIZE(cs35l56_2_r_adr),
313 .adr_d = cs35l56_2_r_adr,
314 },
315 {
316 .mask = BIT(3),
317 .num_adr = ARRAY_SIZE(cs35l56_3_l_adr),
318 .adr_d = cs35l56_3_l_adr,
319 },
320 {}
321 };
322
323 static const struct snd_soc_acpi_link_adr arl_cs42l43_l0_cs35l56_2_l23[] = {
324 {
325 .mask = BIT(0),
326 .num_adr = ARRAY_SIZE(cs42l43_0_adr),
327 .adr_d = cs42l43_0_adr,
328 },
329 {
330 .mask = BIT(2),
331 .num_adr = ARRAY_SIZE(cs35l56_2_r1_adr),
332 .adr_d = cs35l56_2_r1_adr,
333 },
334 {
335 .mask = BIT(3),
336 .num_adr = ARRAY_SIZE(cs35l56_3_l3_adr),
337 .adr_d = cs35l56_3_l3_adr,
338 },
339 {}
340 };
341
342 static const struct snd_soc_acpi_link_adr arl_cs42l43_l0_cs35l56_3_l23[] = {
343 {
344 .mask = BIT(0),
345 .num_adr = ARRAY_SIZE(cs42l43_0_adr),
346 .adr_d = cs42l43_0_adr,
347 },
348 {
349 .mask = BIT(2),
350 .num_adr = ARRAY_SIZE(cs35l56_2_r3_adr),
351 .adr_d = cs35l56_2_r3_adr,
352 },
353 {
354 .mask = BIT(3),
355 .num_adr = ARRAY_SIZE(cs35l56_3_l1_adr),
356 .adr_d = cs35l56_3_l1_adr,
357 },
358 {}
359 };
360
361 static const struct snd_soc_acpi_link_adr arl_rvp[] = {
362 {
363 .mask = BIT(0),
364 .num_adr = ARRAY_SIZE(rt711_0_adr),
365 .adr_d = rt711_0_adr,
366 },
367 {}
368 };
369
370 static const struct snd_soc_acpi_link_adr arl_sdca_rvp[] = {
371 {
372 .mask = BIT(0),
373 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
374 .adr_d = rt711_sdca_0_adr,
375 },
376 {}
377 };
378
379 static const struct snd_soc_acpi_link_adr arl_rt711_l0_rt1316_l3[] = {
380 {
381 .mask = BIT(0),
382 .num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
383 .adr_d = rt711_sdca_0_adr,
384 },
385 {
386 .mask = BIT(3),
387 .num_adr = ARRAY_SIZE(rt1316_3_single_adr),
388 .adr_d = rt1316_3_single_adr,
389 },
390 {}
391 };
392
393 static const struct snd_soc_acpi_link_adr arl_rt722_l0_rt1320_l2[] = {
394 {
395 .mask = BIT(0),
396 .num_adr = ARRAY_SIZE(rt722_0_agg_adr),
397 .adr_d = rt722_0_agg_adr,
398 },
399 {
400 .mask = BIT(2),
401 .num_adr = ARRAY_SIZE(rt1320_2_single_adr),
402 .adr_d = rt1320_2_single_adr,
403 },
404 {}
405 };
406
407 static const struct snd_soc_acpi_codecs arl_essx_83x6 = {
408 .num_codecs = 3,
409 .codecs = { "ESSX8316", "ESSX8326", "ESSX8336"},
410 };
411
412 static const struct snd_soc_acpi_codecs arl_rt5682_hp = {
413 .num_codecs = 2,
414 .codecs = {RT5682_ACPI_HID, RT5682S_ACPI_HID},
415 };
416
417 static const struct snd_soc_acpi_codecs arl_lt6911_hdmi = {
418 .num_codecs = 1,
419 .codecs = {"INTC10B0"}
420 };
421
422 struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_machines[] = {
423 {
424 .comp_ids = &arl_essx_83x6,
425 .drv_name = "arl_es83x6_c1_h02",
426 .machine_quirk = snd_soc_acpi_codec_list,
427 .quirk_data = &arl_lt6911_hdmi,
428 .sof_tplg_filename = "sof-arl-es83x6-ssp1-hdmi-ssp02.tplg",
429 },
430 {
431 .comp_ids = &arl_essx_83x6,
432 .drv_name = "sof-essx8336",
433 .sof_tplg_filename = "sof-arl-es8336", /* the tplg suffix is added at run time */
434 .tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER |
435 SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
436 SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
437 },
438 {
439 .comp_ids = &arl_rt5682_hp,
440 .drv_name = "arl_rt5682_c1_h02",
441 .machine_quirk = snd_soc_acpi_codec_list,
442 .quirk_data = &arl_lt6911_hdmi,
443 .sof_tplg_filename = "sof-arl-rt5682-ssp1-hdmi-ssp02.tplg",
444 },
445 /* place amp-only boards in the end of table */
446 {
447 .id = "INTC10B0",
448 .drv_name = "arl_lt6911_hdmi_ssp",
449 .sof_tplg_filename = "sof-arl-hdmi-ssp02.tplg",
450 },
451 {},
452 };
453 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_arl_machines);
454
455 /* this table is used when there is no I2S codec present */
456 struct snd_soc_acpi_mach snd_soc_acpi_intel_arl_sdw_machines[] = {
457 {
458 .link_mask = BIT(0) | BIT(2) | BIT(3),
459 .links = arl_cs42l43_l0_cs35l56_l23,
460 .drv_name = "sof_sdw",
461 .sof_tplg_filename = "sof-arl-cs42l43-l0-cs35l56-l23.tplg",
462 .get_function_tplg_files = sof_sdw_get_tplg_files,
463 },
464 {
465 .link_mask = BIT(0) | BIT(2) | BIT(3),
466 .links = arl_cs42l43_l0_cs35l56_2_l23,
467 .drv_name = "sof_sdw",
468 .sof_tplg_filename = "sof-arl-cs42l43-l0-cs35l56-l23.tplg",
469 .get_function_tplg_files = sof_sdw_get_tplg_files,
470 },
471 {
472 .link_mask = BIT(0) | BIT(2) | BIT(3),
473 .links = arl_cs42l43_l0_cs35l56_3_l23,
474 .drv_name = "sof_sdw",
475 .sof_tplg_filename = "sof-arl-cs42l43-l0-cs35l56-l23.tplg",
476 .get_function_tplg_files = sof_sdw_get_tplg_files,
477 },
478 {
479 .link_mask = BIT(0) | BIT(2),
480 .links = arl_cs42l43_l0_cs35l56_l2,
481 .drv_name = "sof_sdw",
482 .sof_tplg_filename = "sof-arl-cs42l43-l0-cs35l56-l2.tplg",
483 .get_function_tplg_files = sof_sdw_get_tplg_files,
484 },
485 {
486 .link_mask = BIT(0),
487 .links = arl_cs42l43_l0,
488 .drv_name = "sof_sdw",
489 .sof_tplg_filename = "sof-arl-cs42l43-l0.tplg",
490 .get_function_tplg_files = sof_sdw_get_tplg_files,
491 },
492 {
493 .link_mask = BIT(2) | BIT(3),
494 .links = arl_cs42l43_l2_cs35l56_l3,
495 .drv_name = "sof_sdw",
496 .sof_tplg_filename = "sof-arl-cs42l43-l2-cs35l56-l3.tplg",
497 .get_function_tplg_files = sof_sdw_get_tplg_files,
498 },
499 {
500 .link_mask = BIT(2),
501 .links = arl_cs42l43_l2,
502 .drv_name = "sof_sdw",
503 .sof_tplg_filename = "sof-arl-cs42l43-l2.tplg",
504 .get_function_tplg_files = sof_sdw_get_tplg_files,
505 },
506 {
507 .link_mask = BIT(0) | BIT(3),
508 .links = arl_rt711_l0_rt1316_l3,
509 .drv_name = "sof_sdw",
510 .sof_tplg_filename = "sof-arl-rt711-l0-rt1316-l3.tplg",
511 },
512 {
513 .link_mask = 0x1, /* link0 required */
514 .links = arl_rvp,
515 .drv_name = "sof_sdw",
516 .sof_tplg_filename = "sof-arl-rt711.tplg",
517 },
518 {
519 .link_mask = 0x1, /* link0 required */
520 .links = arl_sdca_rvp,
521 .drv_name = "sof_sdw",
522 .sof_tplg_filename = "sof-arl-rt711-l0.tplg",
523 },
524 {
525 .link_mask = BIT(0) | BIT(2),
526 .links = arl_rt722_l0_rt1320_l2,
527 .drv_name = "sof_sdw",
528 .sof_tplg_filename = "sof-arl-rt722-l0_rt1320-l2.tplg",
529 .get_function_tplg_files = sof_sdw_get_tplg_files,
530 },
531 {},
532 };
533 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_arl_sdw_machines);