File Index
Files and directories
Sign in
FILE

soc-acpi-intel-rpl-match.c

File preview with syntax highlighting.

linux-6.19.14/sound/soc/intel/common/soc-acpi-intel-rpl-match.c C
  1// SPDX-License-Identifier: GPL-2.0-only
  2/*
  3 * soc-apci-intel-rpl-match.c - tables and support for RPL ACPI enumeration.
  4 *
  5 * Copyright (c) 2022 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
 12static const struct snd_soc_acpi_endpoint single_endpoint = {
 13	.num = 0,
 14	.aggregated = 0,
 15	.group_position = 0,
 16	.group_id = 0,
 17};
 18
 19static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
 20	.num = 0,
 21	.aggregated = 1,
 22	.group_position = 0,
 23	.group_id = 1,
 24};
 25
 26static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
 27	.num = 0,
 28	.aggregated = 1,
 29	.group_position = 1,
 30	.group_id = 1,
 31};
 32
 33static const struct snd_soc_acpi_endpoint cs42l43_endpoints[] = {
 34	{ /* Jack Playback Endpoint */
 35		.num = 0,
 36		.aggregated = 0,
 37		.group_position = 0,
 38		.group_id = 0,
 39	},
 40	{ /* DMIC Capture Endpoint */
 41		.num = 1,
 42		.aggregated = 0,
 43		.group_position = 0,
 44		.group_id = 0,
 45	},
 46	{ /* Jack Capture Endpoint */
 47		.num = 2,
 48		.aggregated = 0,
 49		.group_position = 0,
 50		.group_id = 0,
 51	},
 52	{ /* Speaker Playback Endpoint */
 53		.num = 3,
 54		.aggregated = 0,
 55		.group_position = 0,
 56		.group_id = 0,
 57	},
 58};
 59
 60static const struct snd_soc_acpi_adr_device cs42l43_0_adr[] = {
 61	{
 62		.adr = 0x00003001FA424301ull,
 63		.num_endpoints = ARRAY_SIZE(cs42l43_endpoints),
 64		.endpoints = cs42l43_endpoints,
 65		.name_prefix = "cs42l43"
 66	}
 67};
 68
 69static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
 70	{
 71		.adr = 0x000020025D071100ull,
 72		.num_endpoints = 1,
 73		.endpoints = &single_endpoint,
 74		.name_prefix = "rt711"
 75	}
 76};
 77
 78static const struct snd_soc_acpi_link_adr rpl_rvp[] = {
 79	{
 80		.mask = BIT(0),
 81		.num_adr = ARRAY_SIZE(rt711_0_adr),
 82		.adr_d = rt711_0_adr,
 83	},
 84	{}
 85};
 86
 87static const struct snd_soc_acpi_adr_device rt711_sdca_0_adr[] = {
 88	{
 89		.adr = 0x000030025D071101ull,
 90		.num_endpoints = 1,
 91		.endpoints = &single_endpoint,
 92		.name_prefix = "rt711"
 93	}
 94};
 95
 96static const struct snd_soc_acpi_adr_device rt711_sdca_2_adr[] = {
 97	{
 98		.adr = 0x000230025D071101ull,
 99		.num_endpoints = 1,
100		.endpoints = &single_endpoint,
101		.name_prefix = "rt711"
102	}
103};
104
105static const struct snd_soc_acpi_adr_device rt1316_1_group1_adr[] = {
106	{
107		.adr = 0x000131025D131601ull, /* unique ID is set for some reason */
108		.num_endpoints = 1,
109		.endpoints = &spk_l_endpoint,
110		.name_prefix = "rt1316-1"
111	}
112};
113
114static const struct snd_soc_acpi_adr_device rt1316_2_group1_adr[] = {
115	{
116		.adr = 0x000230025D131601ull,
117		.num_endpoints = 1,
118		.endpoints = &spk_r_endpoint,
119		.name_prefix = "rt1316-2"
120	}
121};
122
123static const struct snd_soc_acpi_adr_device rt1316_3_group1_adr[] = {
124	{
125		.adr = 0x000330025D131601ull,
126		.num_endpoints = 1,
127		.endpoints = &spk_r_endpoint,
128		.name_prefix = "rt1316-2"
129	}
130};
131
132static const struct snd_soc_acpi_adr_device rt1316_0_group2_adr[] = {
133	{
134		.adr = 0x000030025D131601ull,
135		.num_endpoints = 1,
136		.endpoints = &spk_l_endpoint,
137		.name_prefix = "rt1316-1"
138	}
139};
140
141static const struct snd_soc_acpi_adr_device rt1316_1_group2_adr[] = {
142	{
143		.adr = 0x000131025D131601ull,
144		.num_endpoints = 1,
145		.endpoints = &spk_r_endpoint,
146		.name_prefix = "rt1316-2"
147	}
148};
149
150static const struct snd_soc_acpi_adr_device rt1318_1_group1_adr[] = {
151	{
152		.adr = 0x000132025D131801ull,
153		.num_endpoints = 1,
154		.endpoints = &spk_l_endpoint,
155		.name_prefix = "rt1318-1"
156	}
157};
158
159static const struct snd_soc_acpi_adr_device rt1318_2_group1_adr[] = {
160	{
161		.adr = 0x000230025D131801ull,
162		.num_endpoints = 1,
163		.endpoints = &spk_r_endpoint,
164		.name_prefix = "rt1318-2"
165	}
166};
167
168static const struct snd_soc_acpi_adr_device rt714_0_adr[] = {
169	{
170		.adr = 0x000030025D071401ull,
171		.num_endpoints = 1,
172		.endpoints = &single_endpoint,
173		.name_prefix = "rt714"
174	}
175};
176
177static const struct snd_soc_acpi_adr_device rt714_2_adr[] = {
178	{
179		.adr = 0x000230025D071401ull,
180		.num_endpoints = 1,
181		.endpoints = &single_endpoint,
182		.name_prefix = "rt714"
183	}
184};
185
186static const struct snd_soc_acpi_adr_device rt714_3_adr[] = {
187	{
188		.adr = 0x000330025D071401ull,
189		.num_endpoints = 1,
190		.endpoints = &single_endpoint,
191		.name_prefix = "rt714"
192	}
193};
194
195static const struct snd_soc_acpi_link_adr rpl_cs42l43_l0[] = {
196	{
197		.mask = BIT(0),
198		.num_adr = ARRAY_SIZE(cs42l43_0_adr),
199		.adr_d = cs42l43_0_adr,
200	},
201	{}
202};
203
204static const struct snd_soc_acpi_link_adr rpl_sdca_3_in_1[] = {
205	{
206		.mask = BIT(0),
207		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
208		.adr_d = rt711_sdca_0_adr,
209	},
210	{
211		.mask = BIT(1),
212		.num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
213		.adr_d = rt1316_1_group1_adr,
214	},
215	{
216		.mask = BIT(2),
217		.num_adr = ARRAY_SIZE(rt714_2_adr),
218		.adr_d = rt714_2_adr,
219	},
220	{
221		.mask = BIT(3),
222		.num_adr = ARRAY_SIZE(rt1316_3_group1_adr),
223		.adr_d = rt1316_3_group1_adr,
224	},
225	{}
226};
227
228static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1316_link12_rt714_link3[] = {
229	{
230		.mask = BIT(0),
231		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
232		.adr_d = rt711_sdca_0_adr,
233	},
234	{
235		.mask = BIT(1),
236		.num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
237		.adr_d = rt1316_1_group1_adr,
238	},
239	{
240		.mask = BIT(2),
241		.num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
242		.adr_d = rt1316_2_group1_adr,
243	},
244	{
245		.mask = BIT(3),
246		.num_adr = ARRAY_SIZE(rt714_3_adr),
247		.adr_d = rt714_3_adr,
248	},
249	{}
250};
251
252static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link2_rt1316_link01_rt714_link3[] = {
253	{
254		.mask = BIT(2),
255		.num_adr = ARRAY_SIZE(rt711_sdca_2_adr),
256		.adr_d = rt711_sdca_2_adr,
257	},
258	{
259		.mask = BIT(0),
260		.num_adr = ARRAY_SIZE(rt1316_0_group2_adr),
261		.adr_d = rt1316_0_group2_adr,
262	},
263	{
264		.mask = BIT(1),
265		.num_adr = ARRAY_SIZE(rt1316_1_group2_adr),
266		.adr_d = rt1316_1_group2_adr,
267	},
268	{
269		.mask = BIT(3),
270		.num_adr = ARRAY_SIZE(rt714_3_adr),
271		.adr_d = rt714_3_adr,
272	},
273	{}
274};
275
276static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link2_rt1316_link01[] = {
277	{
278		.mask = BIT(2),
279		.num_adr = ARRAY_SIZE(rt711_sdca_2_adr),
280		.adr_d = rt711_sdca_2_adr,
281	},
282	{
283		.mask = BIT(0),
284		.num_adr = ARRAY_SIZE(rt1316_0_group2_adr),
285		.adr_d = rt1316_0_group2_adr,
286	},
287	{
288		.mask = BIT(1),
289		.num_adr = ARRAY_SIZE(rt1316_1_group2_adr),
290		.adr_d = rt1316_1_group2_adr,
291	},
292	{}
293};
294
295static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1316_link12[] = {
296	{
297		.mask = BIT(0),
298		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
299		.adr_d = rt711_sdca_0_adr,
300	},
301	{
302		.mask = BIT(1),
303		.num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
304		.adr_d = rt1316_1_group1_adr,
305	},
306	{
307		.mask = BIT(2),
308		.num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
309		.adr_d = rt1316_2_group1_adr,
310	},
311	{}
312};
313
314static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1318_link12_rt714_link3[] = {
315	{
316		.mask = BIT(0),
317		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
318		.adr_d = rt711_sdca_0_adr,
319	},
320	{
321		.mask = BIT(1),
322		.num_adr = ARRAY_SIZE(rt1318_1_group1_adr),
323		.adr_d = rt1318_1_group1_adr,
324	},
325	{
326		.mask = BIT(2),
327		.num_adr = ARRAY_SIZE(rt1318_2_group1_adr),
328		.adr_d = rt1318_2_group1_adr,
329	},
330	{
331		.mask = BIT(3),
332		.num_adr = ARRAY_SIZE(rt714_3_adr),
333		.adr_d = rt714_3_adr,
334	},
335	{}
336};
337
338static const struct snd_soc_acpi_link_adr rpl_sdw_rt711_link0_rt1318_link12[] = {
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(1),
346		.num_adr = ARRAY_SIZE(rt1318_1_group1_adr),
347		.adr_d = rt1318_1_group1_adr,
348	},
349	{
350		.mask = BIT(2),
351		.num_adr = ARRAY_SIZE(rt1318_2_group1_adr),
352		.adr_d = rt1318_2_group1_adr,
353	},
354	{}
355};
356
357static const struct snd_soc_acpi_link_adr rpl_sdw_rt1316_link12_rt714_link0[] = {
358	{
359		.mask = BIT(1),
360		.num_adr = ARRAY_SIZE(rt1316_1_group1_adr),
361		.adr_d = rt1316_1_group1_adr,
362	},
363	{
364		.mask = BIT(2),
365		.num_adr = ARRAY_SIZE(rt1316_2_group1_adr),
366		.adr_d = rt1316_2_group1_adr,
367	},
368	{
369		.mask = BIT(0),
370		.num_adr = ARRAY_SIZE(rt714_0_adr),
371		.adr_d = rt714_0_adr,
372	},
373	{}
374};
375
376static const struct snd_soc_acpi_link_adr rpl_sdca_rvp[] = {
377	{
378		.mask = BIT(0),
379		.num_adr = ARRAY_SIZE(rt711_sdca_0_adr),
380		.adr_d = rt711_sdca_0_adr,
381	},
382	{}
383};
384
385static const struct snd_soc_acpi_link_adr rplp_crb[] = {
386	{
387		.mask = BIT(2),
388		.num_adr = ARRAY_SIZE(rt711_sdca_2_adr),
389		.adr_d = rt711_sdca_2_adr,
390	},
391	{}
392};
393
394static const struct snd_soc_acpi_codecs rpl_rt5682_hp = {
395	.num_codecs = 2,
396	.codecs = {RT5682_ACPI_HID, RT5682S_ACPI_HID},
397};
398
399static const struct snd_soc_acpi_codecs rpl_essx_83x6 = {
400	.num_codecs = 3,
401	.codecs = { "ESSX8316", "ESSX8326", "ESSX8336"},
402};
403
404static const struct snd_soc_acpi_codecs rpl_max98357a_amp = {
405	.num_codecs = 1,
406	.codecs = {"MX98357A"}
407};
408
409static const struct snd_soc_acpi_codecs rpl_lt6911_hdmi = {
410	.num_codecs = 1,
411	.codecs = {"INTC10B0"}
412};
413
414struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_machines[] = {
415	{
416		.comp_ids = &rpl_rt5682_hp,
417		.drv_name = "rpl_mx98357_rt5682",
418		.machine_quirk = snd_soc_acpi_codec_list,
419		.quirk_data = &rpl_max98357a_amp,
420		.sof_tplg_filename = "sof-rpl-max98357a-rt5682.tplg",
421	},
422	{
423		.comp_ids = &rpl_rt5682_hp,
424		.drv_name = "rpl_rt5682_c1_h02",
425		.machine_quirk = snd_soc_acpi_codec_list,
426		.quirk_data = &rpl_lt6911_hdmi,
427		.sof_tplg_filename = "sof-rpl-rt5682-ssp1-hdmi-ssp02.tplg",
428	},
429	{
430		.comp_ids = &rpl_essx_83x6,
431		.drv_name = "rpl_es83x6_c1_h02",
432		.machine_quirk = snd_soc_acpi_codec_list,
433		.quirk_data = &rpl_lt6911_hdmi,
434		.sof_tplg_filename = "sof-rpl-es83x6-ssp1-hdmi-ssp02.tplg",
435	},
436	{
437		.comp_ids = &rpl_essx_83x6,
438		.drv_name = "sof-essx8336",
439		.sof_tplg_filename = "sof-rpl-es83x6", /* the tplg suffix is added at run time */
440		.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_SSP_NUMBER |
441					SND_SOC_ACPI_TPLG_INTEL_SSP_MSB |
442					SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER,
443	},
444	/* place boards for each headphone codec: sof driver will complete the
445	 * tplg name and machine driver will detect the amp type
446	 */
447	{
448		.id = CS42L42_ACPI_HID,
449		.drv_name = "rpl_cs42l42_def",
450		.sof_tplg_filename = "sof-rpl", /* the tplg suffix is added at run time */
451		.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
452					SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
453	},
454	{
455		.id = DA7219_ACPI_HID,
456		.drv_name = "rpl_da7219_def",
457		.sof_tplg_filename = "sof-rpl", /* the tplg suffix is added at run time */
458		.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
459					SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
460	},
461	{
462		.id = NAU8825_ACPI_HID,
463		.drv_name = "rpl_nau8825_def",
464		.sof_tplg_filename = "sof-rpl", /* the tplg suffix is added at run time */
465		.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
466					SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
467	},
468	{
469		.id = RT5650_ACPI_HID,
470		.drv_name = "rpl_rt5682_def",
471		.sof_tplg_filename = "sof-rpl", /* the tplg suffix is added at run time */
472		.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
473					SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
474	},
475	{
476		.comp_ids = &rpl_rt5682_hp,
477		.drv_name = "rpl_rt5682_def",
478		.sof_tplg_filename = "sof-rpl", /* the tplg suffix is added at run time */
479		.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_AMP_NAME |
480					SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME,
481	},
482	/* place amp-only boards in the end of table */
483	{
484		.id = "INTC10B0",
485		.drv_name = "rpl_lt6911_hdmi_ssp",
486		.sof_tplg_filename = "sof-rpl-nocodec-hdmi-ssp02.tplg"
487	},
488	{},
489};
490EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_rpl_machines);
491
492/* this table is used when there is no I2S codec present */
493struct snd_soc_acpi_mach snd_soc_acpi_intel_rpl_sdw_machines[] = {
494	{
495		.link_mask = BIT(0),
496		.links = rpl_cs42l43_l0,
497		.drv_name = "sof_sdw",
498		.sof_tplg_filename = "sof-rpl-cs42l43-l0.tplg",
499	},
500	{
501		.link_mask = 0xF, /* 4 active links required */
502		.links = rpl_sdca_3_in_1,
503		.drv_name = "sof_sdw",
504		.sof_tplg_filename = "sof-rpl-rt711-l0-rt1316-l13-rt714-l2.tplg",
505	},
506	{
507		.link_mask = 0xF, /* 4 active links required */
508		.links = rpl_sdw_rt711_link2_rt1316_link01_rt714_link3,
509		.drv_name = "sof_sdw",
510		.sof_tplg_filename = "sof-rpl-rt711-l2-rt1316-l01-rt714-l3.tplg",
511	},
512	{
513		.link_mask = 0xF, /* 4 active links required */
514		.links = rpl_sdw_rt711_link0_rt1316_link12_rt714_link3,
515		.drv_name = "sof_sdw",
516		.sof_tplg_filename = "sof-rpl-rt711-l0-rt1316-l12-rt714-l3.tplg",
517	},
518	{
519		.link_mask = 0xF, /* 4 active links required */
520		.links = rpl_sdw_rt711_link0_rt1318_link12_rt714_link3,
521		.drv_name = "sof_sdw",
522		.sof_tplg_filename = "sof-rpl-rt711-l0-rt1318-l12-rt714-l3.tplg",
523	},
524	{
525		.link_mask = 0x7, /* rt711 on link0 & two rt1316s on link1 and link2 */
526		.links = rpl_sdw_rt711_link0_rt1316_link12,
527		.drv_name = "sof_sdw",
528		.sof_tplg_filename = "sof-rpl-rt711-l0-rt1316-l12.tplg",
529	},
530	{
531		.link_mask = 0x7, /* rt711 on link0 & two rt1318s on link1 and link2 */
532		.links = rpl_sdw_rt711_link0_rt1318_link12,
533		.drv_name = "sof_sdw",
534		.sof_tplg_filename = "sof-rpl-rt711-l0-rt1318-l12.tplg",
535	},
536	{
537		.link_mask = 0x7, /* rt714 on link0 & two rt1316s on link1 and link2 */
538		.links = rpl_sdw_rt1316_link12_rt714_link0,
539		.drv_name = "sof_sdw",
540		.sof_tplg_filename = "sof-rpl-rt1316-l12-rt714-l0.tplg",
541	},
542	{
543		.link_mask = 0x7, /* rt711 on link2 & two rt1316s on link0 and link1 */
544		.links = rpl_sdw_rt711_link2_rt1316_link01,
545		.drv_name = "sof_sdw",
546		.sof_tplg_filename = "sof-rpl-rt711-l2-rt1316-l01.tplg",
547	},
548	{
549		.link_mask = 0x1, /* link0 required */
550		.links = rpl_rvp,
551		.drv_name = "sof_sdw",
552		.sof_tplg_filename = "sof-rpl-rt711-l0.tplg",
553	},
554	{
555		.link_mask = 0x1, /* link0 required */
556		.links = rpl_sdca_rvp,
557		.drv_name = "sof_sdw",
558		.sof_tplg_filename = "sof-rpl-rt711-l0.tplg",
559	},
560	{
561		.link_mask = 0x4, /* link2 required */
562		.links = rplp_crb,
563		.drv_name = "sof_sdw",
564		.sof_tplg_filename = "sof-rpl-rt711-l2.tplg",
565	},
566	{},
567};
568EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_rpl_sdw_machines);
~/ Read-only file preview.