xref: /linux/sound/soc/intel/common/soc-acpi-intel-mtl-match.c (revision 52fee5c9158000db607d734383fd862969782de5)
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 struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_machines[] = {
44 	{
45 		.comp_ids = &mtl_rt5682_rt5682s_hp,
46 		.drv_name = "mtl_mx98357_rt5682",
47 		.machine_quirk = snd_soc_acpi_codec_list,
48 		.quirk_data = &mtl_max98357a_amp,
49 		.sof_tplg_filename = "sof-mtl-max98357a-rt5682.tplg",
50 	},
51 	{
52 		.comp_ids = &mtl_rt5682_rt5682s_hp,
53 		.drv_name = "mtl_mx98360_rt5682",
54 		.machine_quirk = snd_soc_acpi_codec_list,
55 		.quirk_data = &mtl_max98360a_amp,
56 		.sof_tplg_filename = "sof-mtl-max98360a-rt5682.tplg",
57 	},
58 	{
59 		.comp_ids = &mtl_rt5682_rt5682s_hp,
60 		.drv_name = "mtl_rt1019_rt5682",
61 		.machine_quirk = snd_soc_acpi_codec_list,
62 		.quirk_data = &mtl_rt1019p_amp,
63 		.sof_tplg_filename = "sof-mtl-rt1019-rt5682.tplg",
64 	},
65 	{
66 		.comp_ids = &mtl_essx_83x6,
67 		.drv_name = "mtl_es83x6_c1_h02",
68 		.machine_quirk = snd_soc_acpi_codec_list,
69 		.quirk_data = &mtl_lt6911_hdmi,
70 		.sof_tplg_filename = "sof-mtl-es83x6-ssp1-hdmi-ssp02.tplg",
71 	},
72 	{
73 		.comp_ids = &mtl_essx_83x6,
74 		.drv_name = "sof-essx8336",
75 		.sof_tplg_filename = "sof-mtl-es8336", /* the tplg suffix is added at run time */
76 		.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER |
77 					SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
78 					SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
79 	},
80 	{},
81 };
82 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_machines);
83 
84 static const struct snd_soc_acpi_endpoint single_endpoint = {
85 	.num = 0,
86 	.aggregated = 0,
87 	.group_position = 0,
88 	.group_id = 0,
89 };
90 
91 static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
92 	.num = 0,
93 	.aggregated = 1,
94 	.group_position = 0,
95 	.group_id = 1,
96 };
97 
98 static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
99 	.num = 0,
100 	.aggregated = 1,
101 	.group_position = 1,
102 	.group_id = 1,
103 };
104 
105 static const struct snd_soc_acpi_endpoint rt712_endpoints[] = {
106 	{
107 		.num = 0,
108 		.aggregated = 0,
109 		.group_position = 0,
110 		.group_id = 0,
111 	},
112 	{
113 		.num = 1,
114 		.aggregated = 0,
115 		.group_position = 0,
116 		.group_id = 0,
117 	},
118 };
119 
120 static const struct snd_soc_acpi_endpoint spk_2_endpoint = {
121 	.num = 0,
122 	.aggregated = 1,
123 	.group_position = 2,
124 	.group_id = 1,
125 };
126 
127 static const struct snd_soc_acpi_endpoint spk_3_endpoint = {
128 	.num = 0,
129 	.aggregated = 1,
130 	.group_position = 3,
131 	.group_id = 1,
132 };
133 
134 static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
135 	{
136 		.adr = 0x000030025D071101ull,
137 		.num_endpoints = 1,
138 		.endpoints = &single_endpoint,
139 		.name_prefix = "rt711"
140 	}
141 };
142 
143 static const struct snd_soc_acpi_adr_device rt712_0_single_adr[] = {
144 	{
145 		.adr = 0x000030025D071201ull,
146 		.num_endpoints = ARRAY_SIZE(rt712_endpoints),
147 		.endpoints = rt712_endpoints,
148 		.name_prefix = "rt712"
149 	}
150 };
151 
152 static const struct snd_soc_acpi_adr_device rt1712_3_single_adr[] = {
153 	{
154 		.adr = 0x000330025D171201ull,
155 		.num_endpoints = 1,
156 		.endpoints = &single_endpoint,
157 		.name_prefix = "rt712-dmic"
158 	}
159 };
160 
161 static const struct snd_soc_acpi_adr_device mx8373_0_adr[] = {
162 	{
163 		.adr = 0x000023019F837300ull,
164 		.num_endpoints = 1,
165 		.endpoints = &spk_l_endpoint,
166 		.name_prefix = "Left"
167 	},
168 	{
169 		.adr = 0x000027019F837300ull,
170 		.num_endpoints = 1,
171 		.endpoints = &spk_r_endpoint,
172 		.name_prefix = "Right"
173 	}
174 };
175 
176 static const struct snd_soc_acpi_adr_device rt5682_2_adr[] = {
177 	{
178 		.adr = 0x000221025D568200ull,
179 		.num_endpoints = 1,
180 		.endpoints = &single_endpoint,
181 		.name_prefix = "rt5682"
182 	}
183 };
184 
185 static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = {
186 	{
187 		.adr = 0x000230025D131601ull,
188 		.num_endpoints = 1,
189 		.endpoints = &spk_l_endpoint,
190 		.name_prefix = "rt1316-1"
191 	}
192 };
193 
194 static const struct snd_soc_acpi_adr_device rt1316_3_group1_adr[] = {
195 	{
196 		.adr = 0x000331025D131601ull,
197 		.num_endpoints = 1,
198 		.endpoints = &spk_r_endpoint,
199 		.name_prefix = "rt1316-2"
200 	}
201 };
202 
203 static const struct snd_soc_acpi_adr_device rt1318_1_group1_adr[] = {
204 	{
205 		.adr = 0x000130025D131801ull,
206 		.num_endpoints = 1,
207 		.endpoints = &spk_l_endpoint,
208 		.name_prefix = "rt1318-1"
209 	}
210 };
211 
212 static const struct snd_soc_acpi_adr_device rt1318_2_group1_adr[] = {
213 	{
214 		.adr = 0x000232025D131801ull,
215 		.num_endpoints = 1,
216 		.endpoints = &spk_r_endpoint,
217 		.name_prefix = "rt1318-2"
218 	}
219 };
220 
221 static const struct snd_soc_acpi_adr_device rt714_0_adr[] = {
222 	{
223 		.adr = 0x000030025D071401ull,
224 		.num_endpoints = 1,
225 		.endpoints = &single_endpoint,
226 		.name_prefix = "rt714"
227 	}
228 };
229 
230 static const struct snd_soc_acpi_adr_device rt714_1_adr[] = {
231 	{
232 		.adr = 0x000130025D071401ull,
233 		.num_endpoints = 1,
234 		.endpoints = &single_endpoint,
235 		.name_prefix = "rt714"
236 	}
237 };
238 
239 static const struct snd_soc_acpi_link_adr mtl_712_only[] = {
240 	{
241 		.mask = BIT(0),
242 		.num_adr = ARRAY_SIZE(rt712_0_single_adr),
243 		.adr_d = rt712_0_single_adr,
244 	},
245 	{
246 		.mask = BIT(3),
247 		.num_adr = ARRAY_SIZE(rt1712_3_single_adr),
248 		.adr_d = rt1712_3_single_adr,
249 	},
250 	{}
251 };
252 
253 static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = {
254 	{
255 		.adr = 0x00003001FA424301ull,
256 		.num_endpoints = 1,
257 		.endpoints = &single_endpoint,
258 		.name_prefix = "cs42l43"
259 	}
260 };
261 
262 static const struct snd_soc_acpi_adr_device cs35l56_1_adr[] = {
263 	{
264 		.adr = 0x00013701FA355601ull,
265 		.num_endpoints = 1,
266 		.endpoints = &spk_r_endpoint,
267 		.name_prefix = "cs35l56-8"
268 	},
269 	{
270 		.adr = 0x00013601FA355601ull,
271 		.num_endpoints = 1,
272 		.endpoints = &spk_3_endpoint,
273 		.name_prefix = "cs35l56-7"
274 	}
275 };
276 
277 static const struct snd_soc_acpi_adr_device cs35l56_2_adr[] = {
278 	{
279 		.adr = 0x00023301FA355601ull,
280 		.num_endpoints = 1,
281 		.endpoints = &spk_l_endpoint,
282 		.name_prefix = "cs35l56-1"
283 	},
284 	{
285 		.adr = 0x00023201FA355601ull,
286 		.num_endpoints = 1,
287 		.endpoints = &spk_2_endpoint,
288 		.name_prefix = "cs35l56-2"
289 	}
290 };
291 
292 static const struct snd_soc_acpi_link_adr rt5682_link2_max98373_link0[] = {
293 	/* Expected order: jack -> amp */
294 	{
295 		.mask = BIT(2),
296 		.num_adr = ARRAY_SIZE(rt5682_2_adr),
297 		.adr_d = rt5682_2_adr,
298 	},
299 	{
300 		.mask = BIT(0),
301 		.num_adr = ARRAY_SIZE(mx8373_0_adr),
302 		.adr_d = mx8373_0_adr,
303 	},
304 	{}
305 };
306 
307 static const struct snd_soc_acpi_link_adr mtl_rvp[] = {
308 	{
309 		.mask = BIT(0),
310 		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
311 		.adr_d = rt711_sdca_0_adr,
312 	},
313 	{}
314 };
315 
316 static const struct snd_soc_acpi_link_adr mtl_3_in_1_sdca[] = {
317 	{
318 		.mask = BIT(0),
319 		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
320 		.adr_d = rt711_sdca_0_adr,
321 	},
322 	{
323 		.mask = BIT(2),
324 		.num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
325 		.adr_d = rt1316_2_group1_adr,
326 	},
327 	{
328 		.mask = BIT(3),
329 		.num_adr = ARRAY_SIZE(rt1316_3_group1_adr),
330 		.adr_d = rt1316_3_group1_adr,
331 	},
332 	{
333 		.mask = BIT(1),
334 		.num_adr = ARRAY_SIZE(rt714_1_adr),
335 		.adr_d = rt714_1_adr,
336 	},
337 	{}
338 };
339 
340 static const struct snd_soc_acpi_link_adr mtl_sdw_rt1318_l12_rt714_l0[] = {
341 	{
342 		.mask = BIT(1),
343 		.num_adr = ARRAY_SIZE(rt1318_1_group1_adr),
344 		.adr_d = rt1318_1_group1_adr,
345 	},
346 	{
347 		.mask = BIT(2),
348 		.num_adr = ARRAY_SIZE(rt1318_2_group1_adr),
349 		.adr_d = rt1318_2_group1_adr,
350 	},
351 	{
352 		.mask = BIT(0),
353 		.num_adr = ARRAY_SIZE(rt714_0_adr),
354 		.adr_d = rt714_0_adr,
355 	},
356 	{}
357 };
358 
359 static const struct snd_soc_acpi_adr_device mx8363_2_adr[] = {
360 	{
361 		.adr = 0x000230019F836300ull,
362 		.num_endpoints = 1,
363 		.endpoints = &spk_l_endpoint,
364 		.name_prefix = "Left"
365 	},
366 	{
367 		.adr = 0x000231019F836300ull,
368 		.num_endpoints = 1,
369 		.endpoints = &spk_r_endpoint,
370 		.name_prefix = "Right"
371 	}
372 };
373 
374 static const struct snd_soc_acpi_adr_device cs42l42_0_adr[] = {
375 	{
376 		.adr = 0x00001001FA424200ull,
377 		.num_endpoints = 1,
378 		.endpoints = &single_endpoint,
379 		.name_prefix = "cs42l42"
380 	}
381 };
382 
383 static const struct snd_soc_acpi_link_adr cs42l42_link0_max98363_link2[] = {
384 	/* Expected order: jack -> amp */
385 	{
386 		.mask = BIT(0),
387 		.num_adr = ARRAY_SIZE(cs42l42_0_adr),
388 		.adr_d = cs42l42_0_adr,
389 	},
390 	{
391 		.mask = BIT(2),
392 		.num_adr = ARRAY_SIZE(mx8363_2_adr),
393 		.adr_d = mx8363_2_adr,
394 	},
395 	{}
396 };
397 
398 static const struct snd_soc_acpi_link_adr mtl_cs42l43_cs35l56[] = {
399 	{
400 		.mask = BIT(0),
401 		.num_adr = ARRAY_SIZE(cs42l43_0_adr),
402 		.adr_d = cs42l43_0_adr,
403 	},
404 	{
405 		.mask = BIT(1),
406 		.num_adr = ARRAY_SIZE(cs35l56_1_adr),
407 		.adr_d = cs35l56_1_adr,
408 	},
409 	{
410 		.mask = BIT(2),
411 		.num_adr = ARRAY_SIZE(cs35l56_2_adr),
412 		.adr_d = cs35l56_2_adr,
413 	},
414 	{}
415 };
416 
417 /* this table is used when there is no I2S codec present */
418 struct snd_soc_acpi_mach snd_soc_acpi_intel_mtl_sdw_machines[] = {
419 	/* mockup tests need to be first */
420 	{
421 		.link_mask = GENMASK(3, 0),
422 		.links = sdw_mockup_headset_2amps_mic,
423 		.drv_name = "sof_sdw",
424 		.sof_tplg_filename = "sof-mtl-rt711-rt1308-rt715.tplg",
425 	},
426 	{
427 		.link_mask = BIT(0) | BIT(1) | BIT(3),
428 		.links = sdw_mockup_headset_1amp_mic,
429 		.drv_name = "sof_sdw",
430 		.sof_tplg_filename = "sof-mtl-rt711-rt1308-mono-rt715.tplg",
431 	},
432 	{
433 		.link_mask = GENMASK(2, 0),
434 		.links = sdw_mockup_mic_headset_1amp,
435 		.drv_name = "sof_sdw",
436 		.sof_tplg_filename = "sof-mtl-rt715-rt711-rt1308-mono.tplg",
437 	},
438 	{
439 		.link_mask = BIT(3) | BIT(0),
440 		.links = mtl_712_only,
441 		.drv_name = "sof_sdw",
442 		.sof_tplg_filename = "sof-mtl-rt712-l0-rt1712-l3.tplg",
443 	},
444 	{
445 		.link_mask = GENMASK(2, 0),
446 		.links = mtl_sdw_rt1318_l12_rt714_l0,
447 		.drv_name = "sof_sdw",
448 		.sof_tplg_filename = "sof-mtl-rt1318-l12-rt714-l0.tplg"
449 	},
450 	{
451 		.link_mask = GENMASK(2, 0),
452 		.links = mtl_cs42l43_cs35l56,
453 		.drv_name = "sof_sdw",
454 		.sof_tplg_filename = "sof-mtl-cs42l43-l0-cs35l56-l12.tplg",
455 	},
456 	{
457 		.link_mask = GENMASK(3, 0),
458 		.links = mtl_3_in_1_sdca,
459 		.drv_name = "sof_sdw",
460 		.sof_tplg_filename = "sof-mtl-rt711-l0-rt1316-l23-rt714-l1.tplg",
461 	},
462 	{
463 		.link_mask = BIT(0),
464 		.links = mtl_rvp,
465 		.drv_name = "sof_sdw",
466 		.sof_tplg_filename = "sof-mtl-rt711.tplg",
467 	},
468 	{
469 		.link_mask = BIT(0) | BIT(2),
470 		.links = rt5682_link2_max98373_link0,
471 		.drv_name = "sof_sdw",
472 		.sof_tplg_filename = "sof-mtl-sdw-rt5682-l2-max98373-l0.tplg",
473 	},
474 	{
475 		.link_mask = BIT(0) | BIT(2),
476 		.links = cs42l42_link0_max98363_link2,
477 		.drv_name = "sof_sdw",
478 		.sof_tplg_filename = "sof-mtl-sdw-cs42l42-l0-max98363-l2.tplg",
479 	},
480 	{},
481 };
482 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_mtl_sdw_machines);
483