1*f1bdd8d3SAjit Kumar Pandey // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) 2*f1bdd8d3SAjit Kumar Pandey // 3*f1bdd8d3SAjit Kumar Pandey // This file is provided under a dual BSD/GPLv2 license. When using or 4*f1bdd8d3SAjit Kumar Pandey // redistributing this file, you may do so under either license. 5*f1bdd8d3SAjit Kumar Pandey // 6*f1bdd8d3SAjit Kumar Pandey // Copyright(c) 2021 Advanced Micro Devices, Inc. 7*f1bdd8d3SAjit Kumar Pandey // 8*f1bdd8d3SAjit Kumar Pandey // Authors: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com> 9*f1bdd8d3SAjit Kumar Pandey // 10*f1bdd8d3SAjit Kumar Pandey 11*f1bdd8d3SAjit Kumar Pandey /* ACP machine configuration module */ 12*f1bdd8d3SAjit Kumar Pandey 13*f1bdd8d3SAjit Kumar Pandey #include <linux/acpi.h> 14*f1bdd8d3SAjit Kumar Pandey #include <linux/bits.h> 15*f1bdd8d3SAjit Kumar Pandey #include <linux/dmi.h> 16*f1bdd8d3SAjit Kumar Pandey #include <linux/module.h> 17*f1bdd8d3SAjit Kumar Pandey #include <linux/pci.h> 18*f1bdd8d3SAjit Kumar Pandey 19*f1bdd8d3SAjit Kumar Pandey #include "../sof/amd/acp.h" 20*f1bdd8d3SAjit Kumar Pandey #include "mach-config.h" 21*f1bdd8d3SAjit Kumar Pandey 22*f1bdd8d3SAjit Kumar Pandey static int acp_quirk_data; 23*f1bdd8d3SAjit Kumar Pandey 24*f1bdd8d3SAjit Kumar Pandey static const struct config_entry config_table[] = { 25*f1bdd8d3SAjit Kumar Pandey { 26*f1bdd8d3SAjit Kumar Pandey .flags = FLAG_AMD_SOF, 27*f1bdd8d3SAjit Kumar Pandey .device = ACP_PCI_DEV_ID, 28*f1bdd8d3SAjit Kumar Pandey .dmi_table = (const struct dmi_system_id []) { 29*f1bdd8d3SAjit Kumar Pandey { 30*f1bdd8d3SAjit Kumar Pandey .matches = { 31*f1bdd8d3SAjit Kumar Pandey DMI_MATCH(DMI_SYS_VENDOR, "AMD"), 32*f1bdd8d3SAjit Kumar Pandey DMI_MATCH(DMI_PRODUCT_NAME, "Majolica-CZN"), 33*f1bdd8d3SAjit Kumar Pandey }, 34*f1bdd8d3SAjit Kumar Pandey }, 35*f1bdd8d3SAjit Kumar Pandey {} 36*f1bdd8d3SAjit Kumar Pandey }, 37*f1bdd8d3SAjit Kumar Pandey }, 38*f1bdd8d3SAjit Kumar Pandey }; 39*f1bdd8d3SAjit Kumar Pandey 40*f1bdd8d3SAjit Kumar Pandey int snd_amd_acp_find_config(struct pci_dev *pci) 41*f1bdd8d3SAjit Kumar Pandey { 42*f1bdd8d3SAjit Kumar Pandey const struct config_entry *table = config_table; 43*f1bdd8d3SAjit Kumar Pandey u16 device = pci->device; 44*f1bdd8d3SAjit Kumar Pandey int i; 45*f1bdd8d3SAjit Kumar Pandey 46*f1bdd8d3SAjit Kumar Pandey for (i = 0; i < ARRAY_SIZE(config_table); i++, table++) { 47*f1bdd8d3SAjit Kumar Pandey if (table->device != device) 48*f1bdd8d3SAjit Kumar Pandey continue; 49*f1bdd8d3SAjit Kumar Pandey if (table->dmi_table && !dmi_check_system(table->dmi_table)) 50*f1bdd8d3SAjit Kumar Pandey continue; 51*f1bdd8d3SAjit Kumar Pandey acp_quirk_data = table->flags; 52*f1bdd8d3SAjit Kumar Pandey return table->flags; 53*f1bdd8d3SAjit Kumar Pandey } 54*f1bdd8d3SAjit Kumar Pandey 55*f1bdd8d3SAjit Kumar Pandey return 0; 56*f1bdd8d3SAjit Kumar Pandey } 57*f1bdd8d3SAjit Kumar Pandey EXPORT_SYMBOL(snd_amd_acp_find_config); 58*f1bdd8d3SAjit Kumar Pandey 59*f1bdd8d3SAjit Kumar Pandey struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = { 60*f1bdd8d3SAjit Kumar Pandey { 61*f1bdd8d3SAjit Kumar Pandey .id = "AMDI1019", 62*f1bdd8d3SAjit Kumar Pandey .drv_name = "renoir-dsp", 63*f1bdd8d3SAjit Kumar Pandey .pdata = (void *)&acp_quirk_data, 64*f1bdd8d3SAjit Kumar Pandey .fw_filename = "sof-rn.ri", 65*f1bdd8d3SAjit Kumar Pandey .sof_tplg_filename = "sof-acp.tplg", 66*f1bdd8d3SAjit Kumar Pandey }, 67*f1bdd8d3SAjit Kumar Pandey {}, 68*f1bdd8d3SAjit Kumar Pandey }; 69*f1bdd8d3SAjit Kumar Pandey EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines); 70*f1bdd8d3SAjit Kumar Pandey 71*f1bdd8d3SAjit Kumar Pandey struct snd_soc_acpi_mach snd_soc_acpi_amd_acp_machines[] = { 72*f1bdd8d3SAjit Kumar Pandey { 73*f1bdd8d3SAjit Kumar Pandey .id = "AMDI1019", 74*f1bdd8d3SAjit Kumar Pandey .drv_name = "renoir-acp", 75*f1bdd8d3SAjit Kumar Pandey .pdata = (void *)&acp_quirk_data, 76*f1bdd8d3SAjit Kumar Pandey }, 77*f1bdd8d3SAjit Kumar Pandey {}, 78*f1bdd8d3SAjit Kumar Pandey }; 79*f1bdd8d3SAjit Kumar Pandey EXPORT_SYMBOL(snd_soc_acpi_amd_acp_machines); 80*f1bdd8d3SAjit Kumar Pandey 81*f1bdd8d3SAjit Kumar Pandey MODULE_LICENSE("Dual BSD/GPL"); 82