Commit fc11d326 authored by Syed Saba Kareem's avatar Syed Saba Kareem Committed by Mark Brown

ASoC: amd: acp: remove the redundant acp enable/disable interrupts functions

Instead of having individual acp enable/disable interrupts functions for
each platform, implement common place holder to handle the same for all
AMD platforms.
Signed-off-by: default avatarSyed Saba Kareem <Syed.SabaKareem@amd.com>
Link: https://lore.kernel.org/r/20230626135515.1252063-4-Syed.SabaKareem@amd.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7ad6fb9d
......@@ -31,7 +31,6 @@ config SND_SOC_AMD_ACP_PCM
config SND_SOC_AMD_ACP_PCI
tristate "AMD ACP PCI Driver Support"
depends on X86 && PCI
select SND_SOC_AMD_ACP_LEGACY_COMMON
help
This options enables generic PCI driver for ACP device.
......@@ -40,6 +39,7 @@ config SND_AMD_ASOC_RENOIR
select SND_SOC_AMD_ACP_PCM
select SND_SOC_AMD_ACP_I2S
select SND_SOC_AMD_ACP_PDM
select SND_SOC_AMD_ACP_LEGACY_COMMON
depends on X86 && PCI
help
This option enables Renoir I2S support on AMD platform.
......@@ -49,6 +49,7 @@ config SND_AMD_ASOC_REMBRANDT
select SND_SOC_AMD_ACP_PCM
select SND_SOC_AMD_ACP_I2S
select SND_SOC_AMD_ACP_PDM
select SND_SOC_AMD_ACP_LEGACY_COMMON
depends on X86 && PCI
help
This option enables Rembrandt I2S support on AMD platform.
......
......@@ -16,6 +16,27 @@
#include <linux/pci.h>
#include <linux/export.h>
void acp_enable_interrupts(struct acp_dev_data *adata)
{
struct acp_resource *rsrc = adata->rsrc;
u32 ext_intr_ctrl;
writel(0x01, ACP_EXTERNAL_INTR_ENB(adata));
ext_intr_ctrl = readl(ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used));
ext_intr_ctrl |= ACP_ERROR_MASK;
writel(ext_intr_ctrl, ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used));
}
EXPORT_SYMBOL_NS_GPL(acp_enable_interrupts, SND_SOC_ACP_COMMON);
void acp_disable_interrupts(struct acp_dev_data *adata)
{
struct acp_resource *rsrc = adata->rsrc;
writel(ACP_EXT_INTR_STAT_CLEAR_MASK, ACP_EXTERNAL_INTR_STAT(adata, rsrc->irqp_used));
writel(0x00, ACP_EXTERNAL_INTR_ENB(adata));
}
EXPORT_SYMBOL_NS_GPL(acp_disable_interrupts, SND_SOC_ACP_COMMON);
static int acp_power_on(struct acp_chip_info *chip)
{
u32 val, acp_pgfsm_stat_reg, acp_pgfsm_ctrl_reg;
......
......@@ -185,26 +185,6 @@ static int acp6x_master_clock_generate(struct device *dev)
return 0;
}
static void acp6x_enable_interrupts(struct acp_dev_data *adata)
{
struct acp_resource *rsrc = adata->rsrc;
u32 ext_intr_ctrl;
writel(0x01, ACP_EXTERNAL_INTR_ENB(adata));
ext_intr_ctrl = readl(ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used));
ext_intr_ctrl |= ACP_ERROR_MASK;
writel(ext_intr_ctrl, ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used));
}
static void acp6x_disable_interrupts(struct acp_dev_data *adata)
{
struct acp_resource *rsrc = adata->rsrc;
writel(ACP_EXT_INTR_STAT_CLEAR_MASK,
ACP_EXTERNAL_INTR_STAT(adata, rsrc->irqp_used));
writel(0x00, ACP_EXTERNAL_INTR_ENB(adata));
}
static int rembrandt_audio_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
......@@ -254,7 +234,7 @@ static int rembrandt_audio_probe(struct platform_device *pdev)
dev_set_drvdata(dev, adata);
acp6x_master_clock_generate(dev);
acp6x_enable_interrupts(adata);
acp_enable_interrupts(adata);
acp_platform_register(dev);
return 0;
......@@ -265,7 +245,7 @@ static void rembrandt_audio_remove(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct acp_dev_data *adata = dev_get_drvdata(dev);
acp6x_disable_interrupts(adata);
acp_disable_interrupts(adata);
acp_platform_unregister(dev);
}
......
......@@ -140,25 +140,6 @@ static struct snd_soc_dai_driver acp_renoir_dai[] = {
},
};
static void acp3x_enable_interrupts(struct acp_dev_data *adata)
{
struct acp_resource *rsrc = adata->rsrc;
u32 ext_intr_ctrl;
writel(0x01, ACP_EXTERNAL_INTR_ENB(adata));
ext_intr_ctrl = readl(ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used));
ext_intr_ctrl |= ACP_ERROR_MASK;
writel(ext_intr_ctrl, ACP_EXTERNAL_INTR_CNTL(adata, rsrc->irqp_used));
}
static void acp3x_disable_interrupts(struct acp_dev_data *adata)
{
struct acp_resource *rsrc = adata->rsrc;
writel(ACP_EXT_INTR_STAT_CLEAR_MASK,
ACP_EXTERNAL_INTR_STAT(adata, rsrc->irqp_used));
writel(0x00, ACP_EXTERNAL_INTR_ENB(adata));
}
static int renoir_audio_probe(struct platform_device *pdev)
{
......@@ -207,7 +188,7 @@ static int renoir_audio_probe(struct platform_device *pdev)
acp_machine_select(adata);
dev_set_drvdata(dev, adata);
acp3x_enable_interrupts(adata);
acp_enable_interrupts(adata);
acp_platform_register(dev);
return 0;
......@@ -218,7 +199,7 @@ static void renoir_audio_remove(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct acp_dev_data *adata = dev_get_drvdata(dev);
acp3x_disable_interrupts(adata);
acp_disable_interrupts(adata);
acp_platform_unregister(dev);
}
......
......@@ -192,6 +192,8 @@ int smn_write(struct pci_dev *dev, u32 smn_addr, u32 data);
int acp_init(struct acp_chip_info *chip);
int acp_deinit(void __iomem *base);
void acp_enable_interrupts(struct acp_dev_data *adata);
void acp_disable_interrupts(struct acp_dev_data *adata);
/* Machine configuration */
int snd_amd_acp_find_config(struct pci_dev *pci);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment