1f1bdd8d3SAjit Kumar Pandey // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) 2f1bdd8d3SAjit Kumar Pandey // 3f1bdd8d3SAjit Kumar Pandey // This file is provided under a dual BSD/GPLv2 license. When using or 4f1bdd8d3SAjit Kumar Pandey // redistributing this file, you may do so under either license. 5f1bdd8d3SAjit Kumar Pandey // 6f1bdd8d3SAjit Kumar Pandey // Copyright(c) 2021 Advanced Micro Devices, Inc. 7f1bdd8d3SAjit Kumar Pandey // 8f1bdd8d3SAjit Kumar Pandey // Authors: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com> 9f1bdd8d3SAjit Kumar Pandey // 10f1bdd8d3SAjit Kumar Pandey 11f1bdd8d3SAjit Kumar Pandey /* ACP machine configuration module */ 12f1bdd8d3SAjit Kumar Pandey 13f1bdd8d3SAjit Kumar Pandey #include <linux/acpi.h> 14f1bdd8d3SAjit Kumar Pandey #include <linux/bits.h> 15f1bdd8d3SAjit Kumar Pandey #include <linux/dmi.h> 16f1bdd8d3SAjit Kumar Pandey #include <linux/module.h> 17f1bdd8d3SAjit Kumar Pandey #include <linux/pci.h> 18f1bdd8d3SAjit Kumar Pandey 19f1bdd8d3SAjit Kumar Pandey #include "../sof/amd/acp.h" 20f1bdd8d3SAjit Kumar Pandey #include "mach-config.h" 21f1bdd8d3SAjit Kumar Pandey 22f1bdd8d3SAjit Kumar Pandey static int acp_quirk_data; 23f1bdd8d3SAjit Kumar Pandey 24f1bdd8d3SAjit Kumar Pandey static const struct config_entry config_table[] = { 25f1bdd8d3SAjit Kumar Pandey { 26f1bdd8d3SAjit Kumar Pandey .flags = FLAG_AMD_SOF, 27f1bdd8d3SAjit Kumar Pandey .device = ACP_PCI_DEV_ID, 28f1bdd8d3SAjit Kumar Pandey .dmi_table = (const struct dmi_system_id []) { 29f1bdd8d3SAjit Kumar Pandey { 30f1bdd8d3SAjit Kumar Pandey .matches = { 31f1bdd8d3SAjit Kumar Pandey DMI_MATCH(DMI_SYS_VENDOR, "AMD"), 32f1bdd8d3SAjit Kumar Pandey DMI_MATCH(DMI_PRODUCT_NAME, "Majolica-CZN"), 33f1bdd8d3SAjit Kumar Pandey }, 34f1bdd8d3SAjit Kumar Pandey }, 35f1bdd8d3SAjit Kumar Pandey {} 36f1bdd8d3SAjit Kumar Pandey }, 37f1bdd8d3SAjit Kumar Pandey }, 38f4872013SAjit Kumar Pandey { 39f4872013SAjit Kumar Pandey .flags = FLAG_AMD_SOF, 40f4872013SAjit Kumar Pandey .device = ACP_PCI_DEV_ID, 41f4872013SAjit Kumar Pandey .dmi_table = (const struct dmi_system_id []) { 42f4872013SAjit Kumar Pandey { 43f4872013SAjit Kumar Pandey .matches = { 44f4872013SAjit Kumar Pandey DMI_MATCH(DMI_SYS_VENDOR, "Google"), 45f4872013SAjit Kumar Pandey }, 46f4872013SAjit Kumar Pandey }, 47f4872013SAjit Kumar Pandey {} 48f4872013SAjit Kumar Pandey }, 49f4872013SAjit Kumar Pandey }, 50*197b1f7fSVenkata Prasad Potturu { 51*197b1f7fSVenkata Prasad Potturu .flags = FLAG_AMD_SOF, 52*197b1f7fSVenkata Prasad Potturu .device = ACP_PCI_DEV_ID, 53*197b1f7fSVenkata Prasad Potturu .dmi_table = (const struct dmi_system_id []) { 54*197b1f7fSVenkata Prasad Potturu { 55*197b1f7fSVenkata Prasad Potturu .matches = { 56*197b1f7fSVenkata Prasad Potturu DMI_MATCH(DMI_SYS_VENDOR, "Valve"), 57*197b1f7fSVenkata Prasad Potturu DMI_MATCH(DMI_PRODUCT_NAME, "Galileo"), 58*197b1f7fSVenkata Prasad Potturu DMI_MATCH(DMI_PRODUCT_FAMILY, "Sephiroth"), 59*197b1f7fSVenkata Prasad Potturu }, 60*197b1f7fSVenkata Prasad Potturu }, 61*197b1f7fSVenkata Prasad Potturu {} 62*197b1f7fSVenkata Prasad Potturu }, 63*197b1f7fSVenkata Prasad Potturu }, 64f1bdd8d3SAjit Kumar Pandey }; 65f1bdd8d3SAjit Kumar Pandey 66f1bdd8d3SAjit Kumar Pandey int snd_amd_acp_find_config(struct pci_dev *pci) 67f1bdd8d3SAjit Kumar Pandey { 68f1bdd8d3SAjit Kumar Pandey const struct config_entry *table = config_table; 69f1bdd8d3SAjit Kumar Pandey u16 device = pci->device; 70f1bdd8d3SAjit Kumar Pandey int i; 71f1bdd8d3SAjit Kumar Pandey 72f4872013SAjit Kumar Pandey /* Do not enable FLAGS on older platforms with Rev id zero */ 73f4872013SAjit Kumar Pandey if (!pci->revision) 74f4872013SAjit Kumar Pandey return 0; 75f4872013SAjit Kumar Pandey 76f1bdd8d3SAjit Kumar Pandey for (i = 0; i < ARRAY_SIZE(config_table); i++, table++) { 77f1bdd8d3SAjit Kumar Pandey if (table->device != device) 78f1bdd8d3SAjit Kumar Pandey continue; 79f1bdd8d3SAjit Kumar Pandey if (table->dmi_table && !dmi_check_system(table->dmi_table)) 80f1bdd8d3SAjit Kumar Pandey continue; 81f1bdd8d3SAjit Kumar Pandey acp_quirk_data = table->flags; 82f1bdd8d3SAjit Kumar Pandey return table->flags; 83f1bdd8d3SAjit Kumar Pandey } 84f1bdd8d3SAjit Kumar Pandey 85f1bdd8d3SAjit Kumar Pandey return 0; 86f1bdd8d3SAjit Kumar Pandey } 87f1bdd8d3SAjit Kumar Pandey EXPORT_SYMBOL(snd_amd_acp_find_config); 88f1bdd8d3SAjit Kumar Pandey 89f4872013SAjit Kumar Pandey static struct snd_soc_acpi_codecs amp_rt1019 = { 90f4872013SAjit Kumar Pandey .num_codecs = 1, 91f4872013SAjit Kumar Pandey .codecs = {"10EC1019"} 92f4872013SAjit Kumar Pandey }; 93f4872013SAjit Kumar Pandey 94f4872013SAjit Kumar Pandey static struct snd_soc_acpi_codecs amp_max = { 95f4872013SAjit Kumar Pandey .num_codecs = 1, 96f4872013SAjit Kumar Pandey .codecs = {"MX98360A"} 97f4872013SAjit Kumar Pandey }; 98f4872013SAjit Kumar Pandey 99ef51cddfSVenkata Prasad Potturu static struct snd_soc_acpi_codecs amp_max98388 = { 100ef51cddfSVenkata Prasad Potturu .num_codecs = 1, 101ef51cddfSVenkata Prasad Potturu .codecs = {"ADS8388"} 102ef51cddfSVenkata Prasad Potturu }; 103ef51cddfSVenkata Prasad Potturu 104f1bdd8d3SAjit Kumar Pandey struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = { 105f1bdd8d3SAjit Kumar Pandey { 106f4872013SAjit Kumar Pandey .id = "10EC5682", 107f4872013SAjit Kumar Pandey .drv_name = "rt5682-rt1019", 108f4872013SAjit Kumar Pandey .pdata = (void *)&acp_quirk_data, 109f4872013SAjit Kumar Pandey .machine_quirk = snd_soc_acpi_codec_list, 110f4872013SAjit Kumar Pandey .quirk_data = &_rt1019, 111f4872013SAjit Kumar Pandey .fw_filename = "sof-rn.ri", 1120082e329SAjit Kumar Pandey .sof_tplg_filename = "sof-rn-rt5682-rt1019.tplg", 113f4872013SAjit Kumar Pandey }, 114f4872013SAjit Kumar Pandey { 115f4872013SAjit Kumar Pandey .id = "10EC5682", 116f4872013SAjit Kumar Pandey .drv_name = "rt5682-max", 117f4872013SAjit Kumar Pandey .pdata = (void *)&acp_quirk_data, 118f4872013SAjit Kumar Pandey .machine_quirk = snd_soc_acpi_codec_list, 119f4872013SAjit Kumar Pandey .quirk_data = &_max, 120f4872013SAjit Kumar Pandey .fw_filename = "sof-rn.ri", 1210082e329SAjit Kumar Pandey .sof_tplg_filename = "sof-rn-rt5682-max98360.tplg", 122f4872013SAjit Kumar Pandey }, 123f4872013SAjit Kumar Pandey { 124f4872013SAjit Kumar Pandey .id = "RTL5682", 125f4872013SAjit Kumar Pandey .drv_name = "rt5682s-max", 126f4872013SAjit Kumar Pandey .pdata = (void *)&acp_quirk_data, 127f4872013SAjit Kumar Pandey .machine_quirk = snd_soc_acpi_codec_list, 128f4872013SAjit Kumar Pandey .quirk_data = &_max, 129f4872013SAjit Kumar Pandey .fw_filename = "sof-rn.ri", 1300082e329SAjit Kumar Pandey .sof_tplg_filename = "sof-rn-rt5682-max98360.tplg", 131f4872013SAjit Kumar Pandey }, 132f4872013SAjit Kumar Pandey { 133330dc183SV sujith kumar Reddy .id = "RTL5682", 134330dc183SV sujith kumar Reddy .drv_name = "rt5682s-rt1019", 135330dc183SV sujith kumar Reddy .pdata = (void *)&acp_quirk_data, 136330dc183SV sujith kumar Reddy .machine_quirk = snd_soc_acpi_codec_list, 137330dc183SV sujith kumar Reddy .quirk_data = &_rt1019, 138330dc183SV sujith kumar Reddy .fw_filename = "sof-rn.ri", 139330dc183SV sujith kumar Reddy .sof_tplg_filename = "sof-rn-rt5682-rt1019.tplg", 140330dc183SV sujith kumar Reddy }, 141330dc183SV sujith kumar Reddy { 142f1bdd8d3SAjit Kumar Pandey .id = "AMDI1019", 143f1bdd8d3SAjit Kumar Pandey .drv_name = "renoir-dsp", 144f1bdd8d3SAjit Kumar Pandey .pdata = (void *)&acp_quirk_data, 145f1bdd8d3SAjit Kumar Pandey .fw_filename = "sof-rn.ri", 146f1bdd8d3SAjit Kumar Pandey .sof_tplg_filename = "sof-acp.tplg", 147f1bdd8d3SAjit Kumar Pandey }, 148f1bdd8d3SAjit Kumar Pandey {}, 149f1bdd8d3SAjit Kumar Pandey }; 150f1bdd8d3SAjit Kumar Pandey EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines); 151f1bdd8d3SAjit Kumar Pandey 152ef51cddfSVenkata Prasad Potturu struct snd_soc_acpi_mach snd_soc_acpi_amd_vangogh_sof_machines[] = { 153ef51cddfSVenkata Prasad Potturu { 154ef51cddfSVenkata Prasad Potturu .id = "NVTN2020", 155ef51cddfSVenkata Prasad Potturu .drv_name = "nau8821-max", 156ef51cddfSVenkata Prasad Potturu .pdata = &acp_quirk_data, 157ef51cddfSVenkata Prasad Potturu .machine_quirk = snd_soc_acpi_codec_list, 158ef51cddfSVenkata Prasad Potturu .quirk_data = &_max98388, 159ef51cddfSVenkata Prasad Potturu .fw_filename = "sof-vangogh.ri", 160ef51cddfSVenkata Prasad Potturu .sof_tplg_filename = "sof-vangogh-nau8821-max.tplg", 161ef51cddfSVenkata Prasad Potturu }, 162ef51cddfSVenkata Prasad Potturu {}, 163ef51cddfSVenkata Prasad Potturu }; 164ef51cddfSVenkata Prasad Potturu EXPORT_SYMBOL(snd_soc_acpi_amd_vangogh_sof_machines); 165ef51cddfSVenkata Prasad Potturu 1660439eb4dSV sujith kumar Reddy struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[] = { 1670439eb4dSV sujith kumar Reddy { 1680439eb4dSV sujith kumar Reddy .id = "AMDI1019", 1690439eb4dSV sujith kumar Reddy .drv_name = "rmb-dsp", 1700439eb4dSV sujith kumar Reddy .pdata = &acp_quirk_data, 1710439eb4dSV sujith kumar Reddy .fw_filename = "sof-rmb.ri", 1720439eb4dSV sujith kumar Reddy .sof_tplg_filename = "sof-acp-rmb.tplg", 1730439eb4dSV sujith kumar Reddy }, 1740439eb4dSV sujith kumar Reddy { 1750439eb4dSV sujith kumar Reddy .id = "10508825", 1760439eb4dSV sujith kumar Reddy .drv_name = "nau8825-max", 1770439eb4dSV sujith kumar Reddy .pdata = &acp_quirk_data, 1780439eb4dSV sujith kumar Reddy .machine_quirk = snd_soc_acpi_codec_list, 1790439eb4dSV sujith kumar Reddy .quirk_data = &_max, 1800439eb4dSV sujith kumar Reddy .fw_filename = "sof-rmb.ri", 1810439eb4dSV sujith kumar Reddy .sof_tplg_filename = "sof-rmb-nau8825-max98360.tplg", 1820439eb4dSV sujith kumar Reddy }, 1834dc6737cSV sujith kumar Reddy { 1844dc6737cSV sujith kumar Reddy .id = "RTL5682", 1854dc6737cSV sujith kumar Reddy .drv_name = "rt5682s-hs-rt1019", 1864dc6737cSV sujith kumar Reddy .pdata = &acp_quirk_data, 1874dc6737cSV sujith kumar Reddy .machine_quirk = snd_soc_acpi_codec_list, 1884dc6737cSV sujith kumar Reddy .quirk_data = &_rt1019, 1894dc6737cSV sujith kumar Reddy .fw_filename = "sof-rmb.ri", 1904dc6737cSV sujith kumar Reddy .sof_tplg_filename = "sof-rmb-rt5682s-rt1019.tplg", 1914dc6737cSV sujith kumar Reddy }, 1920439eb4dSV sujith kumar Reddy {}, 1930439eb4dSV sujith kumar Reddy }; 1940439eb4dSV sujith kumar Reddy EXPORT_SYMBOL(snd_soc_acpi_amd_rmb_sof_machines); 1950439eb4dSV sujith kumar Reddy 196f1bdd8d3SAjit Kumar Pandey MODULE_LICENSE("Dual BSD/GPL"); 197