Skip to content

Commit

Permalink
ASoC: amd: Add check for acp config flags
Browse files Browse the repository at this point in the history
[ Upstream commit bddcfb0 ]

We have SOF and generic ACP support enabled for Rembrandt and
pheonix 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: Syed Saba Kareem <Syed.SabaKareem@amd.com>
Reviewed-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20230412091638.1158901-1-Syed.SabaKareem@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Syed Saba Kareem authored and gregkh committed May 24, 2023
1 parent df3fdfd commit 5f6f1d3
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
2 changes: 2 additions & 0 deletions sound/soc/amd/Kconfig
Expand Up @@ -90,6 +90,7 @@ config SND_SOC_AMD_VANGOGH_MACH

config SND_SOC_AMD_ACP6x
tristate "AMD Audio Coprocessor-v6.x Yellow Carp support"
select SND_AMD_ACP_CONFIG
depends on X86 && PCI
help
This option enables Audio Coprocessor i.e ACP v6.x support on
Expand Down Expand Up @@ -130,6 +131,7 @@ config SND_SOC_AMD_RPL_ACP6x

config SND_SOC_AMD_PS
tristate "AMD Audio Coprocessor-v6.3 Pink Sardine support"
select SND_AMD_ACP_CONFIG
depends on X86 && PCI && ACPI
help
This option enables Audio Coprocessor i.e ACP v6.3 support on
Expand Down
2 changes: 2 additions & 0 deletions sound/soc/amd/ps/acp63.h
Expand Up @@ -111,3 +111,5 @@ struct acp63_dev_data {
u16 pdev_count;
u16 pdm_dev_index;
};

int snd_amd_acp_find_config(struct pci_dev *pci);
8 changes: 7 additions & 1 deletion sound/soc/amd/ps/pci-ps.c
Expand Up @@ -247,11 +247,17 @@ static int snd_acp63_probe(struct pci_dev *pci,
{
struct acp63_dev_data *adata;
u32 addr;
u32 irqflags;
u32 irqflags, flag;
int val;
int ret;

irqflags = IRQF_SHARED;

/* Return if acp config flag is defined */
flag = snd_amd_acp_find_config(pci);
if (flag)
return -ENODEV;

/* Pink Sardine device check */
switch (pci->revision) {
case 0x63:
Expand Down
3 changes: 3 additions & 0 deletions sound/soc/amd/yc/acp6x.h
Expand Up @@ -105,3 +105,6 @@ static inline void acp6x_writel(u32 val, void __iomem *base_addr)
{
writel(val, base_addr - ACP6x_PHY_BASE_ADDRESS);
}

int snd_amd_acp_find_config(struct pci_dev *pci);

8 changes: 7 additions & 1 deletion sound/soc/amd/yc/pci-acp6x.c
Expand Up @@ -149,10 +149,16 @@ static int snd_acp6x_probe(struct pci_dev *pci,
int index = 0;
int val = 0x00;
u32 addr;
unsigned int irqflags;
unsigned int irqflags, flag;
int ret;

irqflags = IRQF_SHARED;

/* Return if acp config flag is defined */
flag = snd_amd_acp_find_config(pci);
if (flag)
return -ENODEV;

/* Yellow Carp device check */
switch (pci->revision) {
case 0x60:
Expand Down

0 comments on commit 5f6f1d3

Please sign in to comment.