ASoC: amd: renoir: Add check for acp configuration flags
authorAjit Kumar Pandey <AjitKumar.Pandey@amd.com>
Mon, 17 Jan 2022 11:58:54 +0000 (17:28 +0530)
committerMark Brown <broonie@kernel.org>
Fri, 28 Jan 2022 15:59:35 +0000 (15:59 +0000)
We have SOF and generic ACP support enabled for Renoir platforms
on some machines. Since we have same PCI id used for probing, add
check for machine configuration flag to avoid conflict with newer
pci drivers. Such machine flag has been initialized via dmi match
on few Chrome machines. If no flag is specified probe and register
older platform device.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Link: https://lore.kernel.org/r/20220117115854.455995-7-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/amd/Kconfig
sound/soc/amd/renoir/rn-pci-acp3x.c
sound/soc/amd/renoir/rn_acp3x.h

index 7a9e45094f37e7b4c7591ab4ff6ab6bd4010dc42..1381aec230481f58af3cac2c63d0f3b412b5cfd8 100644 (file)
@@ -44,6 +44,7 @@ config SND_SOC_AMD_RV_RT5682_MACH
 
 config SND_SOC_AMD_RENOIR
        tristate "AMD Audio Coprocessor - Renoir support"
+       select SND_AMD_ACP_CONFIG
        depends on X86 && PCI
        help
         This option enables ACP support for Renoir platform
index 7b8040e812a188c7b37c3b21bccdc12e00832f4b..b3812b70f5f98472f606f800318b9c769ad1e0b4 100644 (file)
@@ -212,10 +212,15 @@ static int snd_rn_acp_probe(struct pci_dev *pci,
        acpi_integer dmic_status;
 #endif
        const struct dmi_system_id *dmi_id;
-       unsigned int irqflags;
+       unsigned int irqflags, flag;
        int ret, index;
        u32 addr;
 
+       /* Return if acp config flag is defined */
+       flag = snd_amd_acp_find_config(pci);
+       if (flag)
+               return -ENODEV;
+
        /* Renoir device check */
        if (pci->revision != 0x01)
                return -ENODEV;
index 14620399d766c43f4a5c3d54dfe2e45abbf67653..ca586603d720346ae931113b78b3afee1eaf6146 100644 (file)
@@ -88,3 +88,6 @@ static inline void rn_writel(u32 val, void __iomem *base_addr)
 {
        writel(val, base_addr - ACP_PHY_BASE_ADDRESS);
 }
+
+/* Machine configuration */
+int snd_amd_acp_find_config(struct pci_dev *pci);