xref: /openbmc/linux/sound/soc/amd/acp-config.c (revision faf69551)
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 Advanced Micro Devices, Inc.
7 //
8 // Authors: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
9 //
10 
11 /* ACP machine configuration module */
12 
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>
18 
19 #include "../sof/amd/acp.h"
20 #include "mach-config.h"
21 
22 static int acp_quirk_data;
23 
24 static const struct config_entry config_table[] = {
25 	{
26 		.flags = FLAG_AMD_SOF,
27 		.device = ACP_PCI_DEV_ID,
28 		.dmi_table = (const struct dmi_system_id []) {
29 			{
30 				.matches = {
31 					DMI_MATCH(DMI_SYS_VENDOR, "AMD"),
32 					DMI_MATCH(DMI_PRODUCT_NAME, "Majolica-CZN"),
33 				},
34 			},
35 			{}
36 		},
37 	},
38 };
39 
40 int snd_amd_acp_find_config(struct pci_dev *pci)
41 {
42 	const struct config_entry *table = config_table;
43 	u16 device = pci->device;
44 	int i;
45 
46 	for (i = 0; i < ARRAY_SIZE(config_table); i++, table++) {
47 		if (table->device != device)
48 			continue;
49 		if (table->dmi_table && !dmi_check_system(table->dmi_table))
50 			continue;
51 		acp_quirk_data = table->flags;
52 		return table->flags;
53 	}
54 
55 	return 0;
56 }
57 EXPORT_SYMBOL(snd_amd_acp_find_config);
58 
59 struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = {
60 	{
61 		.id = "AMDI1019",
62 		.drv_name = "renoir-dsp",
63 		.pdata = (void *)&acp_quirk_data,
64 		.fw_filename = "sof-rn.ri",
65 		.sof_tplg_filename = "sof-acp.tplg",
66 	},
67 	{},
68 };
69 EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines);
70 
71 MODULE_LICENSE("Dual BSD/GPL");
72