From: Jaroslav Kysela <pe...@perex.cz>

commit 55d8e6a85bce21f748c42eedea63681219f70523 upstream.

The Raven and Renoir ACP can be distinguished by the PCI revision.
Let's do the check very early, otherwise the wrong probe code
can be run.

Link: 
https://lore.kernel.org/alsa-devel/2e4587f8-f602-cf23-4845-fd27a32b1...@amd.com/
Cc: <sta...@kernel.org>
Cc: Vijendar Mukunda <vijendar.muku...@amd.com>
Cc: Mark Brown <broo...@kernel.org>
Signed-off-by: Jaroslav Kysela <pe...@perex.cz>
Link: https://lore.kernel.org/r/20201208181233.2745726-1-pe...@perex.cz
Signed-off-by: Mark Brown <broo...@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>

---
 sound/soc/amd/raven/pci-acp3x.c     |    4 ++++
 sound/soc/amd/renoir/rn-pci-acp3x.c |    4 ++++
 2 files changed, 8 insertions(+)

--- a/sound/soc/amd/raven/pci-acp3x.c
+++ b/sound/soc/amd/raven/pci-acp3x.c
@@ -118,6 +118,10 @@ static int snd_acp3x_probe(struct pci_de
        int ret, i;
        u32 addr, val;
 
+       /* Raven device detection */
+       if (pci->revision != 0x00)
+               return -ENODEV;
+
        if (pci_enable_device(pci)) {
                dev_err(&pci->dev, "pci_enable_device failed\n");
                return -ENODEV;
--- a/sound/soc/amd/renoir/rn-pci-acp3x.c
+++ b/sound/soc/amd/renoir/rn-pci-acp3x.c
@@ -188,6 +188,10 @@ static int snd_rn_acp_probe(struct pci_d
        int ret, index;
        u32 addr;
 
+       /* Renoir device check */
+       if (pci->revision != 0x01)
+               return -ENODEV;
+
        if (pci_enable_device(pci)) {
                dev_err(&pci->dev, "pci_enable_device failed\n");
                return -ENODEV;


Reply via email to