Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
0002 //
0003 // This file is provided under a dual BSD/GPLv2 license. When using or
0004 // redistributing this file, you may do so under either license.
0005 //
0006 // Copyright(c) 2021 Advanced Micro Devices, Inc.
0007 //
0008 // Authors: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
0009 //
0010 
0011 /* ACP machine configuration module */
0012 
0013 #include <linux/acpi.h>
0014 #include <linux/bits.h>
0015 #include <linux/dmi.h>
0016 #include <linux/module.h>
0017 #include <linux/pci.h>
0018 
0019 #include "../sof/amd/acp.h"
0020 #include "mach-config.h"
0021 
0022 static int acp_quirk_data;
0023 
0024 static const struct config_entry config_table[] = {
0025     {
0026         .flags = FLAG_AMD_SOF,
0027         .device = ACP_PCI_DEV_ID,
0028         .dmi_table = (const struct dmi_system_id []) {
0029             {
0030                 .matches = {
0031                     DMI_MATCH(DMI_SYS_VENDOR, "AMD"),
0032                     DMI_MATCH(DMI_PRODUCT_NAME, "Majolica-CZN"),
0033                 },
0034             },
0035             {}
0036         },
0037     },
0038     {
0039         .flags = FLAG_AMD_SOF,
0040         .device = ACP_PCI_DEV_ID,
0041         .dmi_table = (const struct dmi_system_id []) {
0042             {
0043                 .matches = {
0044                     DMI_MATCH(DMI_SYS_VENDOR, "Google"),
0045                 },
0046             },
0047             {}
0048         },
0049     },
0050 };
0051 
0052 int snd_amd_acp_find_config(struct pci_dev *pci)
0053 {
0054     const struct config_entry *table = config_table;
0055     u16 device = pci->device;
0056     int i;
0057 
0058     /* Do not enable FLAGS on older platforms with Rev id zero */
0059     if (!pci->revision)
0060         return 0;
0061 
0062     for (i = 0; i < ARRAY_SIZE(config_table); i++, table++) {
0063         if (table->device != device)
0064             continue;
0065         if (table->dmi_table && !dmi_check_system(table->dmi_table))
0066             continue;
0067         acp_quirk_data = table->flags;
0068         return table->flags;
0069     }
0070 
0071     return 0;
0072 }
0073 EXPORT_SYMBOL(snd_amd_acp_find_config);
0074 
0075 static struct snd_soc_acpi_codecs amp_rt1019 = {
0076     .num_codecs = 1,
0077     .codecs = {"10EC1019"}
0078 };
0079 
0080 static struct snd_soc_acpi_codecs amp_max = {
0081     .num_codecs = 1,
0082     .codecs = {"MX98360A"}
0083 };
0084 
0085 struct snd_soc_acpi_mach snd_soc_acpi_amd_sof_machines[] = {
0086     {
0087         .id = "10EC5682",
0088         .drv_name = "rt5682-rt1019",
0089         .pdata = (void *)&acp_quirk_data,
0090         .machine_quirk = snd_soc_acpi_codec_list,
0091         .quirk_data = &amp_rt1019,
0092         .fw_filename = "sof-rn.ri",
0093         .sof_tplg_filename = "sof-rn-rt5682-rt1019.tplg",
0094     },
0095     {
0096         .id = "10EC5682",
0097         .drv_name = "rt5682-max",
0098         .pdata = (void *)&acp_quirk_data,
0099         .machine_quirk = snd_soc_acpi_codec_list,
0100         .quirk_data = &amp_max,
0101         .fw_filename = "sof-rn.ri",
0102         .sof_tplg_filename = "sof-rn-rt5682-max98360.tplg",
0103     },
0104     {
0105         .id = "RTL5682",
0106         .drv_name = "rt5682s-max",
0107         .pdata = (void *)&acp_quirk_data,
0108         .machine_quirk = snd_soc_acpi_codec_list,
0109         .quirk_data = &amp_max,
0110         .fw_filename = "sof-rn.ri",
0111         .sof_tplg_filename = "sof-rn-rt5682-max98360.tplg",
0112     },
0113     {
0114         .id = "RTL5682",
0115         .drv_name = "rt5682s-rt1019",
0116         .pdata = (void *)&acp_quirk_data,
0117         .machine_quirk = snd_soc_acpi_codec_list,
0118         .quirk_data = &amp_rt1019,
0119         .fw_filename = "sof-rn.ri",
0120         .sof_tplg_filename = "sof-rn-rt5682-rt1019.tplg",
0121     },
0122     {
0123         .id = "AMDI1019",
0124         .drv_name = "renoir-dsp",
0125         .pdata = (void *)&acp_quirk_data,
0126         .fw_filename = "sof-rn.ri",
0127         .sof_tplg_filename = "sof-acp.tplg",
0128     },
0129     {},
0130 };
0131 EXPORT_SYMBOL(snd_soc_acpi_amd_sof_machines);
0132 
0133 struct snd_soc_acpi_mach snd_soc_acpi_amd_rmb_sof_machines[] = {
0134     {
0135         .id = "AMDI1019",
0136         .drv_name = "rmb-dsp",
0137         .pdata = &acp_quirk_data,
0138         .fw_filename = "sof-rmb.ri",
0139         .sof_tplg_filename = "sof-acp-rmb.tplg",
0140     },
0141     {
0142         .id = "10508825",
0143         .drv_name = "nau8825-max",
0144         .pdata = &acp_quirk_data,
0145         .machine_quirk = snd_soc_acpi_codec_list,
0146         .quirk_data = &amp_max,
0147         .fw_filename = "sof-rmb.ri",
0148         .sof_tplg_filename = "sof-rmb-nau8825-max98360.tplg",
0149     },
0150     {
0151         .id = "RTL5682",
0152         .drv_name = "rt5682s-hs-rt1019",
0153         .pdata = &acp_quirk_data,
0154         .machine_quirk = snd_soc_acpi_codec_list,
0155         .quirk_data = &amp_rt1019,
0156         .fw_filename = "sof-rmb.ri",
0157         .sof_tplg_filename = "sof-rmb-rt5682s-rt1019.tplg",
0158     },
0159     {},
0160 };
0161 EXPORT_SYMBOL(snd_soc_acpi_amd_rmb_sof_machines);
0162 
0163 MODULE_LICENSE("Dual BSD/GPL");