1e149ca29SPierre-Louis Bossart // SPDX-License-Identifier: GPL-2.0-only
21f24d93cSPierre-Louis Bossart /*
31f24d93cSPierre-Louis Bossart  * soc-acpi-intel-cml-match.c - tables and support for CML ACPI enumeration.
41f24d93cSPierre-Louis Bossart  *
51f24d93cSPierre-Louis Bossart  * Copyright (c) 2019, Intel Corporation.
61f24d93cSPierre-Louis Bossart  *
71f24d93cSPierre-Louis Bossart  */
81f24d93cSPierre-Louis Bossart 
91f24d93cSPierre-Louis Bossart #include <sound/soc-acpi.h>
101f24d93cSPierre-Louis Bossart #include <sound/soc-acpi-intel-match.h>
111f24d93cSPierre-Louis Bossart 
124e64ba3fSAmery Song static struct snd_soc_acpi_codecs rt1011_spk_codecs = {
131f24d93cSPierre-Louis Bossart 	.num_codecs = 1,
144e64ba3fSAmery Song 	.codecs = {"10EC1011"}
151f24d93cSPierre-Louis Bossart };
161f24d93cSPierre-Louis Bossart 
174e64ba3fSAmery Song static struct snd_soc_acpi_codecs max98357a_spk_codecs = {
181f24d93cSPierre-Louis Bossart 	.num_codecs = 1,
191f24d93cSPierre-Louis Bossart 	.codecs = {"MX98357A"}
201f24d93cSPierre-Louis Bossart };
211f24d93cSPierre-Louis Bossart 
22e1435a1fSBrent Lu static struct snd_soc_acpi_codecs max98390_spk_codecs = {
23e1435a1fSBrent Lu 	.num_codecs = 1,
24e1435a1fSBrent Lu 	.codecs = {"MX98390"}
25e1435a1fSBrent Lu };
26e1435a1fSBrent Lu 
274e64ba3fSAmery Song /*
284e64ba3fSAmery Song  * The order of the three entries with .id = "10EC5682" matters
294e64ba3fSAmery Song  * here, because DSDT tables expose an ACPI HID for the MAX98357A
304e64ba3fSAmery Song  * speaker amplifier which is not populated on the board.
314e64ba3fSAmery Song  */
321f24d93cSPierre-Louis Bossart struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_machines[] = {
331f24d93cSPierre-Louis Bossart 	{
344e64ba3fSAmery Song 		.id = "10EC5682",
351f24d93cSPierre-Louis Bossart 		.drv_name = "cml_rt1011_rt5682",
364e64ba3fSAmery Song 		.machine_quirk = snd_soc_acpi_codec_list,
374e64ba3fSAmery Song 		.quirk_data = &rt1011_spk_codecs,
381f24d93cSPierre-Louis Bossart 		.sof_fw_filename = "sof-cml.ri",
391f24d93cSPierre-Louis Bossart 		.sof_tplg_filename = "sof-cml-rt1011-rt5682.tplg",
401f24d93cSPierre-Louis Bossart 	},
411f24d93cSPierre-Louis Bossart 	{
421f24d93cSPierre-Louis Bossart 		.id = "10EC5682",
431f24d93cSPierre-Louis Bossart 		.drv_name = "sof_rt5682",
444e64ba3fSAmery Song 		.machine_quirk = snd_soc_acpi_codec_list,
454e64ba3fSAmery Song 		.quirk_data = &max98357a_spk_codecs,
464e64ba3fSAmery Song 		.sof_fw_filename = "sof-cml.ri",
474e64ba3fSAmery Song 		.sof_tplg_filename = "sof-cml-rt5682-max98357a.tplg",
484e64ba3fSAmery Song 	},
494e64ba3fSAmery Song 	{
504e64ba3fSAmery Song 		.id = "10EC5682",
514e64ba3fSAmery Song 		.drv_name = "sof_rt5682",
521f24d93cSPierre-Louis Bossart 		.sof_fw_filename = "sof-cml.ri",
531f24d93cSPierre-Louis Bossart 		.sof_tplg_filename = "sof-cml-rt5682.tplg",
541f24d93cSPierre-Louis Bossart 	},
554e64ba3fSAmery Song 	{
564e64ba3fSAmery Song 		.id = "DLGS7219",
574e64ba3fSAmery Song 		.drv_name = "cml_da7219_max98357a",
584e64ba3fSAmery Song 		.machine_quirk = snd_soc_acpi_codec_list,
594e64ba3fSAmery Song 		.quirk_data = &max98357a_spk_codecs,
604e64ba3fSAmery Song 		.sof_fw_filename = "sof-cml.ri",
614e64ba3fSAmery Song 		.sof_tplg_filename = "sof-cml-da7219-max98357a.tplg",
624e64ba3fSAmery Song 	},
63e1435a1fSBrent Lu 	{
64e1435a1fSBrent Lu 		.id = "DLGS7219",
65e1435a1fSBrent Lu 		.drv_name = "cml_da7219_max98357a",
66e1435a1fSBrent Lu 		.machine_quirk = snd_soc_acpi_codec_list,
67e1435a1fSBrent Lu 		.quirk_data = &max98390_spk_codecs,
68e1435a1fSBrent Lu 		.sof_fw_filename = "sof-cml.ri",
69e1435a1fSBrent Lu 		.sof_tplg_filename = "sof-cml-da7219-max98357a.tplg",
70e1435a1fSBrent Lu 	},
711f24d93cSPierre-Louis Bossart 	{},
721f24d93cSPierre-Louis Bossart };
731f24d93cSPierre-Louis Bossart EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cml_machines);
741f24d93cSPierre-Louis Bossart 
75004bd416SPierre-Louis Bossart static const struct snd_soc_acpi_endpoint single_endpoint = {
76004bd416SPierre-Louis Bossart 	.num = 0,
77004bd416SPierre-Louis Bossart 	.aggregated = 0,
78004bd416SPierre-Louis Bossart 	.group_position = 0,
79004bd416SPierre-Louis Bossart 	.group_id = 0,
80db0b9efbSRander Wang };
81db0b9efbSRander Wang 
82004bd416SPierre-Louis Bossart static const struct snd_soc_acpi_endpoint spk_l_endpoint = {
83004bd416SPierre-Louis Bossart 	.num = 0,
84004bd416SPierre-Louis Bossart 	.aggregated = 1,
85004bd416SPierre-Louis Bossart 	.group_position = 0,
86004bd416SPierre-Louis Bossart 	.group_id = 1,
87db0b9efbSRander Wang };
88db0b9efbSRander Wang 
89004bd416SPierre-Louis Bossart static const struct snd_soc_acpi_endpoint spk_r_endpoint = {
90004bd416SPierre-Louis Bossart 	.num = 0,
91004bd416SPierre-Louis Bossart 	.aggregated = 1,
92004bd416SPierre-Louis Bossart 	.group_position = 1,
93004bd416SPierre-Louis Bossart 	.group_id = 1,
94db0b9efbSRander Wang };
95db0b9efbSRander Wang 
96ba762e67SRander Wang static const struct snd_soc_acpi_adr_device rt700_1_adr[] = {
97ba762e67SRander Wang 	{
98ba762e67SRander Wang 		.adr = 0x000110025D070000,
99ba762e67SRander Wang 		.num_endpoints = 1,
100ba762e67SRander Wang 		.endpoints = &single_endpoint,
101ba762e67SRander Wang 	}
102ba762e67SRander Wang };
103ba762e67SRander Wang 
104ba762e67SRander Wang static const struct snd_soc_acpi_link_adr cml_rvp[] = {
105ba762e67SRander Wang 	{
106ba762e67SRander Wang 		.mask = BIT(1),
107ba762e67SRander Wang 		.num_adr = ARRAY_SIZE(rt700_1_adr),
108ba762e67SRander Wang 		.adr_d = rt700_1_adr,
109ba762e67SRander Wang 	},
110ba762e67SRander Wang 	{}
111ba762e67SRander Wang };
112ba762e67SRander Wang 
113004bd416SPierre-Louis Bossart static const struct snd_soc_acpi_adr_device rt711_0_adr[] = {
114004bd416SPierre-Louis Bossart 	{
11569a785daSBard Liao 		.adr = 0x000020025D071100,
116004bd416SPierre-Louis Bossart 		.num_endpoints = 1,
117004bd416SPierre-Louis Bossart 		.endpoints = &single_endpoint,
118004bd416SPierre-Louis Bossart 	}
119004bd416SPierre-Louis Bossart };
120004bd416SPierre-Louis Bossart 
121004bd416SPierre-Louis Bossart static const struct snd_soc_acpi_adr_device rt1308_1_adr[] = {
122004bd416SPierre-Louis Bossart 	{
12369a785daSBard Liao 		.adr = 0x000120025D130800,
124004bd416SPierre-Louis Bossart 		.num_endpoints = 1,
125004bd416SPierre-Louis Bossart 		.endpoints = &single_endpoint,
126004bd416SPierre-Louis Bossart 	}
127004bd416SPierre-Louis Bossart };
128004bd416SPierre-Louis Bossart 
129004bd416SPierre-Louis Bossart static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = {
130004bd416SPierre-Louis Bossart 	{
13169a785daSBard Liao 		.adr = 0x000120025D130800,
132004bd416SPierre-Louis Bossart 		.num_endpoints = 1,
133004bd416SPierre-Louis Bossart 		.endpoints = &spk_l_endpoint,
134004bd416SPierre-Louis Bossart 	}
135004bd416SPierre-Louis Bossart };
136004bd416SPierre-Louis Bossart 
137004bd416SPierre-Louis Bossart static const struct snd_soc_acpi_adr_device rt1308_2_group1_adr[] = {
138004bd416SPierre-Louis Bossart 	{
13969a785daSBard Liao 		.adr = 0x000220025D130800,
140004bd416SPierre-Louis Bossart 		.num_endpoints = 1,
141004bd416SPierre-Louis Bossart 		.endpoints = &spk_r_endpoint,
142004bd416SPierre-Louis Bossart 	}
143004bd416SPierre-Louis Bossart };
144004bd416SPierre-Louis Bossart 
145004bd416SPierre-Louis Bossart static const struct snd_soc_acpi_adr_device rt715_3_adr[] = {
146004bd416SPierre-Louis Bossart 	{
14769a785daSBard Liao 		.adr = 0x000320025D071500,
148004bd416SPierre-Louis Bossart 		.num_endpoints = 1,
149004bd416SPierre-Louis Bossart 		.endpoints = &single_endpoint,
150004bd416SPierre-Louis Bossart 	}
151db0b9efbSRander Wang };
152db0b9efbSRander Wang 
153db0b9efbSRander Wang static const struct snd_soc_acpi_link_adr cml_3_in_1_default[] = {
154db0b9efbSRander Wang 	{
155db0b9efbSRander Wang 		.mask = BIT(0),
156db0b9efbSRander Wang 		.num_adr = ARRAY_SIZE(rt711_0_adr),
157004bd416SPierre-Louis Bossart 		.adr_d = rt711_0_adr,
158db0b9efbSRander Wang 	},
159db0b9efbSRander Wang 	{
160db0b9efbSRander Wang 		.mask = BIT(1),
161004bd416SPierre-Louis Bossart 		.num_adr = ARRAY_SIZE(rt1308_1_group1_adr),
162004bd416SPierre-Louis Bossart 		.adr_d = rt1308_1_group1_adr,
163db0b9efbSRander Wang 	},
164db0b9efbSRander Wang 	{
165db0b9efbSRander Wang 		.mask = BIT(2),
166004bd416SPierre-Louis Bossart 		.num_adr = ARRAY_SIZE(rt1308_2_group1_adr),
167004bd416SPierre-Louis Bossart 		.adr_d = rt1308_2_group1_adr,
168db0b9efbSRander Wang 	},
169db0b9efbSRander Wang 	{
170db0b9efbSRander Wang 		.mask = BIT(3),
171db0b9efbSRander Wang 		.num_adr = ARRAY_SIZE(rt715_3_adr),
172004bd416SPierre-Louis Bossart 		.adr_d = rt715_3_adr,
173db0b9efbSRander Wang 	},
174db0b9efbSRander Wang 	{}
175db0b9efbSRander Wang };
176db0b9efbSRander Wang 
177db0b9efbSRander Wang static const struct snd_soc_acpi_link_adr cml_3_in_1_mono_amp[] = {
178db0b9efbSRander Wang 	{
179db0b9efbSRander Wang 		.mask = BIT(0),
180db0b9efbSRander Wang 		.num_adr = ARRAY_SIZE(rt711_0_adr),
181004bd416SPierre-Louis Bossart 		.adr_d = rt711_0_adr,
182db0b9efbSRander Wang 	},
183db0b9efbSRander Wang 	{
184db0b9efbSRander Wang 		.mask = BIT(1),
185db0b9efbSRander Wang 		.num_adr = ARRAY_SIZE(rt1308_1_adr),
186004bd416SPierre-Louis Bossart 		.adr_d = rt1308_1_adr,
187db0b9efbSRander Wang 	},
188db0b9efbSRander Wang 	{
189db0b9efbSRander Wang 		.mask = BIT(3),
190db0b9efbSRander Wang 		.num_adr = ARRAY_SIZE(rt715_3_adr),
191004bd416SPierre-Louis Bossart 		.adr_d = rt715_3_adr,
192db0b9efbSRander Wang 	},
193db0b9efbSRander Wang 	{}
194db0b9efbSRander Wang };
195db0b9efbSRander Wang 
196db0b9efbSRander Wang struct snd_soc_acpi_mach snd_soc_acpi_intel_cml_sdw_machines[] = {
197db0b9efbSRander Wang 	{
198db0b9efbSRander Wang 		.link_mask = 0xF, /* 4 active links required */
199db0b9efbSRander Wang 		.links = cml_3_in_1_default,
200ba762e67SRander Wang 		.drv_name = "sof_sdw",
201db0b9efbSRander Wang 		.sof_fw_filename = "sof-cml.ri",
202db0b9efbSRander Wang 		.sof_tplg_filename = "sof-cml-rt711-rt1308-rt715.tplg",
203db0b9efbSRander Wang 	},
204db0b9efbSRander Wang 	{
205db0b9efbSRander Wang 		/*
206db0b9efbSRander Wang 		 * link_mask should be 0xB, but all links are enabled by BIOS.
207db0b9efbSRander Wang 		 * This entry will be selected if there is no rt1308 exposed
208db0b9efbSRander Wang 		 * on link2 since it will fail to match the above entry.
209db0b9efbSRander Wang 		 */
210db0b9efbSRander Wang 		.link_mask = 0xF,
211db0b9efbSRander Wang 		.links = cml_3_in_1_mono_amp,
212ba762e67SRander Wang 		.drv_name = "sof_sdw",
213db0b9efbSRander Wang 		.sof_fw_filename = "sof-cml.ri",
214db0b9efbSRander Wang 		.sof_tplg_filename = "sof-cml-rt711-rt1308-mono-rt715.tplg",
215db0b9efbSRander Wang 	},
216db0b9efbSRander Wang 	{
217db0b9efbSRander Wang 		.link_mask = 0x2, /* RT700 connected on Link1 */
218ba762e67SRander Wang 		.links = cml_rvp,
219ba762e67SRander Wang 		.drv_name = "sof_sdw",
220db0b9efbSRander Wang 		.sof_fw_filename = "sof-cml.ri",
221db0b9efbSRander Wang 		.sof_tplg_filename = "sof-cml-rt700.tplg",
222db0b9efbSRander Wang 	},
223db0b9efbSRander Wang 	{}
224db0b9efbSRander Wang };
225db0b9efbSRander Wang EXPORT_SYMBOL_GPL(snd_soc_acpi_intel_cml_sdw_machines);
226db0b9efbSRander Wang 
2271f24d93cSPierre-Louis Bossart MODULE_LICENSE("GPL v2");
2281f24d93cSPierre-Louis Bossart MODULE_DESCRIPTION("Intel Common ACPI Match module");
229