drm/panel-edp: Add STA 116QHD024002
[drm/drm-misc.git] / sound / soc / amd / acp-config.c
blob365209ea53f36598d4c9b9c1041b818952c6666e
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
2 //
3 // This file is provided under a dual BSD/GPLv2 license. When using or
4 // redistributing this file, you may do so under either license.
5 //
6 // Copyright(c) 2021, 2023 Advanced Micro Devices, Inc.
7 //
8 // Authors: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
9 //
11 /* ACP machine configuration module */
13 #include <linux/acpi.h>
14 #include <linux/bits.h>
15 #include <linux/dmi.h>
16 #include <linux/module.h>
17 #include <linux/pci.h>
19 #include "../sof/amd/acp.h"
20 #include "mach-config.h"
22 #define ACP_7_0_REV 0x70
24 static int acp_quirk_data;
26 static const struct config_entry config_table[] = {
28 .flags = FLAG_AMD_SOF,
29 .device = ACP_PCI_DEV_ID,
30 .dmi_table = (const struct dmi_system_id []) {
32 .matches = {
33 DMI_MATCH(DMI_SYS_VENDOR, "AMD"),
34 DMI_MATCH(DMI_PRODUCT_NAME, "Majolica-CZN"),
41 .flags = FLAG_AMD_SOF,
42 .device = ACP_PCI_DEV_ID,
43 .dmi_table = (const struct dmi_system_id []) {
45 .matches = {
46 DMI_MATCH(DMI_SYS_VENDOR, "Google"),
53 .flags = FLAG_AMD_LEGACY,
54 .device = ACP_PCI_DEV_ID,
55 .dmi_table = (const struct dmi_system_id []) {
57 .matches = {
58 DMI_MATCH(DMI_SYS_VENDOR, "Valve"),
59 DMI_MATCH(DMI_PRODUCT_NAME, "Jupiter"),
66 .flags = FLAG_AMD_SOF,
67 .device = ACP_PCI_DEV_ID,
68 .dmi_table = (const struct dmi_system_id []) {
70 .matches = {
71 DMI_MATCH(DMI_SYS_VENDOR, "Valve"),
72 DMI_MATCH(DMI_PRODUCT_NAME, "Galileo"),
79 .flags = FLAG_AMD_LEGACY,
80 .device = ACP_PCI_DEV_ID,
81 .dmi_table = (const struct dmi_system_id []) {
83 .matches = {
84 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "HUAWEI"),
85 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "KLVL-WXXW"),
86 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "M1010"),
93 .flags = FLAG_AMD_LEGACY,
94 .device = ACP_PCI_DEV_ID,
95 .dmi_table = (const struct dmi_system_id []) {
97 .matches = {
98 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "HUAWEI"),
99 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "KLVL-WXX9"),
100 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "M1010"),
107 .flags = FLAG_AMD_LEGACY,
108 .device = ACP_PCI_DEV_ID,
109 .dmi_table = (const struct dmi_system_id []) {
111 .matches = {
112 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "HUAWEI"),
113 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "BOM-WXX9"),
114 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "M1010"),
121 .flags = FLAG_AMD_LEGACY,
122 .device = ACP_PCI_DEV_ID,
123 .dmi_table = (const struct dmi_system_id []) {
125 .matches = {
126 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "HUAWEI"),
127 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "HVY-WXX9"),
128 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "M1010"),
135 .flags = FLAG_AMD_LEGACY,
136 .device = ACP_PCI_DEV_ID,
137 .dmi_table = (const struct dmi_system_id []) {
139 .matches = {
140 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "HUAWEI"),
141 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "HVY-WXX9"),
142 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "M1020"),
149 .flags = FLAG_AMD_LEGACY,
150 .device = ACP_PCI_DEV_ID,
151 .dmi_table = (const struct dmi_system_id []) {
153 .matches = {
154 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "HUAWEI"),
155 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "HVY-WXX9"),
156 DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "M1040"),
164 static int snd_amd_acp_acpi_find_config(struct pci_dev *pci)
166 const union acpi_object *obj;
167 int acp_flag = FLAG_AMD_LEGACY_ONLY_DMIC;
169 if (!acpi_dev_get_property(ACPI_COMPANION(&pci->dev), "acp-audio-config-flag",
170 ACPI_TYPE_INTEGER, &obj))
171 acp_flag = obj->integer.value;
173 return acp_flag;
176 int snd_amd_acp_find_config(struct pci_dev *pci)
178 const struct config_entry *table = config_table;
179 u16 device = pci->device;
180 int i;
182 /* Do not enable FLAGS on older platforms with Rev Id zero
183 * For platforms which has ACP 7.0 or higher, read the acp
184 * config flag from BIOS ACPI table and for older platforms
185 * read it from DMI tables.
187 if (!pci->revision)
188 return 0;
189 else if (pci->revision >= ACP_7_0_REV)
190 return snd_amd_acp_acpi_find_config(pci);
192 for (i = 0; i < ARRAY_SIZE(config_table); i++, table++) {
193 if (table->device != device)
194 continue;
195 if (table->dmi_table && !dmi_check_system(table->dmi_table))
196 continue;
197 acp_quirk_data = table->flags;
198 return table->flags;
201 return 0;
203 EXPORT_SYMBOL(snd_amd_acp_find_config);
205 static struct snd_soc_acpi_codecs amp_rt1019 = {
206 .num_codecs = 1,
207 .codecs = {"10EC1019"}
210 static struct snd_soc_acpi_codecs amp_max = {
211 .num_codecs = 1,
212 .codecs = {"MX98360A"}
215 static struct snd_soc_acpi_codecs amp_max98388 = {
216 .num_codecs = 1,
217 .codecs = {"ADS8388"}
220 struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = {
222 .id = "10EC5682",
223 .drv_name = "rt5682-rt1019",
224 .pdata = (void *)&acp_quirk_data,
225 .machine_quirk = snd_soc_acpi_codec_list,
226 .quirk_data = &amp_rt1019,
227 .fw_filename = "sof-rn.ri",
228 .sof_tplg_filename = "sof-rn-rt5682-rt1019.tplg",
231 .id = "10EC5682",
232 .drv_name = "rt5682-max",
233 .pdata = (void *)&acp_quirk_data,
234 .machine_quirk = snd_soc_acpi_codec_list,
235 .quirk_data = &amp_max,
236 .fw_filename = "sof-rn.ri",
237 .sof_tplg_filename = "sof-rn-rt5682-max98360.tplg",
240 .id = "RTL5682",
241 .drv_name = "rt5682s-max",
242 .pdata = (void *)&acp_quirk_data,
243 .machine_quirk = snd_soc_acpi_codec_list,
244 .quirk_data = &amp_max,
245 .fw_filename = "sof-rn.ri",
246 .sof_tplg_filename = "sof-rn-rt5682-max98360.tplg",
249 .id = "RTL5682",
250 .drv_name = "rt5682s-rt1019",
251 .pdata = (void *)&acp_quirk_data,
252 .machine_quirk = snd_soc_acpi_codec_list,
253 .quirk_data = &amp_rt1019,
254 .fw_filename = "sof-rn.ri",
255 .sof_tplg_filename = "sof-rn-rt5682-rt1019.tplg",
258 .id = "AMDI1019",
259 .drv_name = "renoir-dsp",
260 .pdata = (void *)&acp_quirk_data,
261 .fw_filename = "sof-rn.ri",
262 .sof_tplg_filename = "sof-acp.tplg",
266 EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines);
268 struct snd_soc_acpi_mach snd_soc_acpi_amd_vangogh_sof_machines[] = {
270 .id = "NVTN2020",
271 .drv_name = "nau8821-max",
272 .pdata = &acp_quirk_data,
273 .machine_quirk = snd_soc_acpi_codec_list,
274 .quirk_data = &amp_max98388,
275 .fw_filename = "sof-vangogh.ri",
276 .sof_tplg_filename = "sof-vangogh-nau8821-max.tplg",
280 EXPORT_SYMBOL(snd_soc_acpi_amd_vangogh_sof_machines);
282 struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[] = {
284 .id = "AMDI1019",
285 .drv_name = "rmb-dsp",
286 .pdata = &acp_quirk_data,
287 .fw_filename = "sof-rmb.ri",
288 .sof_tplg_filename = "sof-acp-rmb.tplg",
291 .id = "10508825",
292 .drv_name = "nau8825-max",
293 .pdata = &acp_quirk_data,
294 .machine_quirk = snd_soc_acpi_codec_list,
295 .quirk_data = &amp_max,
296 .fw_filename = "sof-rmb.ri",
297 .sof_tplg_filename = "sof-rmb-nau8825-max98360.tplg",
300 .id = "RTL5682",
301 .drv_name = "rt5682s-hs-rt1019",
302 .pdata = &acp_quirk_data,
303 .machine_quirk = snd_soc_acpi_codec_list,
304 .quirk_data = &amp_rt1019,
305 .fw_filename = "sof-rmb.ri",
306 .sof_tplg_filename = "sof-rmb-rt5682s-rt1019.tplg",
310 EXPORT_SYMBOL(snd_soc_acpi_amd_rmb_sof_machines);
312 struct snd_soc_acpi_mach snd_soc_acpi_amd_acp63_sof_machines[] = {
314 .id = "AMDI1019",
315 .drv_name = "acp63-dsp",
316 .pdata = &acp_quirk_data,
317 .fw_filename = "sof-acp_6_3.ri",
318 .sof_tplg_filename = "sof-acp_6_3.tplg",
322 EXPORT_SYMBOL(snd_soc_acpi_amd_acp63_sof_machines);
324 struct snd_soc_acpi_mach snd_soc_acpi_amd_acp70_sof_machines[] = {
326 .id = "AMDI1010",
327 .drv_name = "acp70-dsp",
328 .pdata = &acp_quirk_data,
329 .fw_filename = "sof-acp_7_0.ri",
330 .sof_tplg_filename = "sof-acp_7_0.tplg",
334 EXPORT_SYMBOL(snd_soc_acpi_amd_acp70_sof_machines);
336 MODULE_DESCRIPTION("AMD ACP Machine Configuration Module");
337 MODULE_LICENSE("Dual BSD/GPL");