xref: /linux/sound/soc/intel/common/soc-acpi-intel-lnl-match.c (revision 566ab427f827b0256d3e8ce0235d088e6a9c28bd)
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_group1_adr[] = {
229 	{
230 		.adr = 0x000130025D131801ull,
231 		.num_endpoints = 1,
232 		.endpoints = &spk_l_endpoint,
233 		.name_prefix = "rt1318-1"
234 	}
235 };
236 
237 static const struct snd_soc_acpi_adr_device rt1318_2_group1_adr[] = {
238 	{
239 		.adr = 0x000232025D131801ull,
240 		.num_endpoints = 1,
241 		.endpoints = &spk_r_endpoint,
242 		.name_prefix = "rt1318-2"
243 	}
244 };
245 
246 static const struct snd_soc_acpi_adr_device rt714_0_adr[] = {
247 	{
248 		.adr = 0x000030025D071401ull,
249 		.num_endpoints = 1,
250 		.endpoints = &single_endpoint,
251 		.name_prefix = "rt714"
252 	}
253 };
254 
255 static const struct snd_soc_acpi_adr_device rt714_1_adr[] = {
256 	{
257 		.adr = 0x000130025D071401ull,
258 		.num_endpoints = 1,
259 		.endpoints = &single_endpoint,
260 		.name_prefix = "rt714"
261 	}
262 };
263 
264 static const struct snd_soc_acpi_link_adr lnl_cs42l43_l0[] = {
265 	{
266 		.mask = BIT(0),
267 		.num_adr = ARRAY_SIZE(cs42l43_0_adr),
268 		.adr_d = cs42l43_0_adr,
269 	},
270 	{}
271 };
272 
273 static const struct snd_soc_acpi_link_adr lnl_cs42l43_l0_cs35l56_l3[] = {
274 	{
275 		.mask = BIT(0),
276 		.num_adr = ARRAY_SIZE(cs42l43_0_adr),
277 		.adr_d = cs42l43_0_adr,
278 	},
279 	{
280 		.mask = BIT(3),
281 		.num_adr = ARRAY_SIZE(cs35l56_3_lr_adr),
282 		.adr_d = cs35l56_3_lr_adr,
283 	},
284 	{}
285 };
286 
287 static const struct snd_soc_acpi_link_adr lnl_cs42l43_l0_cs35l56_l23[] = {
288 	{
289 		.mask = BIT(0),
290 		.num_adr = ARRAY_SIZE(cs42l43_0_adr),
291 		.adr_d = cs42l43_0_adr,
292 	},
293 	{
294 		.mask = BIT(2),
295 		.num_adr = ARRAY_SIZE(cs35l56_2_l_adr),
296 		.adr_d = cs35l56_2_l_adr,
297 	},
298 	{
299 		.mask = BIT(3),
300 		.num_adr = ARRAY_SIZE(cs35l56_3_r_adr),
301 		.adr_d = cs35l56_3_r_adr,
302 	},
303 	{}
304 };
305 
306 static const struct snd_soc_acpi_link_adr lnl_rvp[] = {
307 	{
308 		.mask = BIT(0),
309 		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
310 		.adr_d = rt711_sdca_0_adr,
311 	},
312 	{}
313 };
314 
315 static const struct snd_soc_acpi_link_adr lnl_712_only[] = {
316 	{
317 		.mask = BIT(2),
318 		.num_adr = ARRAY_SIZE(rt712_2_single_adr),
319 		.adr_d = rt712_2_single_adr,
320 	},
321 	{
322 		.mask = BIT(3),
323 		.num_adr = ARRAY_SIZE(rt1712_3_single_adr),
324 		.adr_d = rt1712_3_single_adr,
325 	},
326 	{}
327 };
328 
329 static const struct snd_soc_acpi_link_adr lnl_rt722_only[] = {
330 	{
331 		.mask = BIT(0),
332 		.num_adr = ARRAY_SIZE(rt722_0_single_adr),
333 		.adr_d = rt722_0_single_adr,
334 	},
335 	{}
336 };
337 
338 static const struct snd_soc_acpi_link_adr lnl_3_in_1_sdca[] = {
339 	{
340 		.mask = BIT(0),
341 		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
342 		.adr_d = rt711_sdca_0_adr,
343 	},
344 	{
345 		.mask = BIT(2),
346 		.num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
347 		.adr_d = rt1316_2_group1_adr,
348 	},
349 	{
350 		.mask = BIT(3),
351 		.num_adr = ARRAY_SIZE(rt1316_3_group1_adr),
352 		.adr_d = rt1316_3_group1_adr,
353 	},
354 	{
355 		.mask = BIT(1),
356 		.num_adr = ARRAY_SIZE(rt714_1_adr),
357 		.adr_d = rt714_1_adr,
358 	},
359 	{}
360 };
361 
362 static const struct snd_soc_acpi_link_adr lnl_sdw_rt1318_l12_rt714_l0[] = {
363 	{
364 		.mask = BIT(1),
365 		.num_adr = ARRAY_SIZE(rt1318_1_group1_adr),
366 		.adr_d = rt1318_1_group1_adr,
367 	},
368 	{
369 		.mask = BIT(2),
370 		.num_adr = ARRAY_SIZE(rt1318_2_group1_adr),
371 		.adr_d = rt1318_2_group1_adr,
372 	},
373 	{
374 		.mask = BIT(0),
375 		.num_adr = ARRAY_SIZE(rt714_0_adr),
376 		.adr_d = rt714_0_adr,
377 	},
378 	{}
379 };
380 
381 /* this table is used when there is no I2S codec present */
382 struct snd_soc_acpi_mach snd_soc_acpi_intel_lnl_sdw_machines[] = {
383 	/* mockup tests need to be first */
384 	{
385 		.link_mask = GENMASK(3, 0),
386 		.links = sdw_mockup_headset_2amps_mic,
387 		.drv_name = "sof_sdw",
388 		.sof_tplg_filename = "sof-lnl-rt711-rt1308-rt715.tplg",
389 	},
390 	{
391 		.link_mask = BIT(0) | BIT(1) | BIT(3),
392 		.links = sdw_mockup_headset_1amp_mic,
393 		.drv_name = "sof_sdw",
394 		.sof_tplg_filename = "sof-lnl-rt711-rt1308-mono-rt715.tplg",
395 	},
396 	{
397 		.link_mask = GENMASK(2, 0),
398 		.links = sdw_mockup_mic_headset_1amp,
399 		.drv_name = "sof_sdw",
400 		.sof_tplg_filename = "sof-lnl-rt715-rt711-rt1308-mono.tplg",
401 	},
402 	{
403 		.link_mask = GENMASK(3, 0),
404 		.links = lnl_3_in_1_sdca,
405 		.drv_name = "sof_sdw",
406 		.sof_tplg_filename = "sof-lnl-rt711-l0-rt1316-l23-rt714-l1.tplg",
407 	},
408 	{
409 		.link_mask = BIT(0) | BIT(2) | BIT(3),
410 		.links = lnl_cs42l43_l0_cs35l56_l23,
411 		.drv_name = "sof_sdw",
412 		.sof_tplg_filename = "sof-lnl-cs42l43-l0-cs35l56-l23.tplg",
413 	},
414 	{
415 		.link_mask = BIT(0) | BIT(3),
416 		.links = lnl_cs42l43_l0_cs35l56_l3,
417 		.drv_name = "sof_sdw",
418 		.sof_tplg_filename = "sof-lnl-cs42l43-l0-cs35l56-l3.tplg",
419 	},
420 	{
421 		.link_mask = BIT(0),
422 		.links = lnl_cs42l43_l0,
423 		.drv_name = "sof_sdw",
424 		.sof_tplg_filename = "sof-lnl-cs42l43-l0.tplg",
425 	},
426 	{
427 		.link_mask = BIT(0),
428 		.links = lnl_rvp,
429 		.drv_name = "sof_sdw",
430 		.sof_tplg_filename = "sof-lnl-rt711.tplg",
431 	},
432 	{
433 		.link_mask = BIT(2) | BIT(3),
434 		.links = lnl_712_only,
435 		.drv_name = "sof_sdw",
436 		.sof_tplg_filename = "sof-lnl-rt712-l2-rt1712-l3.tplg",
437 	},
438 	{
439 		.link_mask = BIT(0),
440 		.links = lnl_rt722_only,
441 		.drv_name = "sof_sdw",
442 		.sof_tplg_filename = "sof-lnl-rt722-l0.tplg",
443 	},
444 	{
445 		.link_mask = GENMASK(2, 0),
446 		.links = lnl_sdw_rt1318_l12_rt714_l0,
447 		.drv_name = "sof_sdw",
448 		.sof_tplg_filename = "sof-lnl-rt1318-l12-rt714-l0.tplg"
449 	},
450 	{},
451 };
452 EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_lnl_sdw_machines);
453