mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-09-06 13:09:58 +00:00
ASoC: SOF: amd: Use AMD_NODE
All consumers of SMN in the kernel should be doing it through the functions provided by AMD_NODE. Stop using the local SMN read/write symbols and switch to the AMD_NODE provided ones. Tested by: Venkata Prasad Potturu <venkataprasad.potturu@amd.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://patch.msgid.link/20250217231747.1656228-6-superm1@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
8f96953714
commit
f120cf33d2
@ -25,6 +25,7 @@ config SND_SOC_SOF_AMD_COMMON
|
|||||||
select SND_SOC_SOF_ACP_PROBES
|
select SND_SOC_SOF_ACP_PROBES
|
||||||
select SND_SOC_ACPI_AMD_MATCH
|
select SND_SOC_ACPI_AMD_MATCH
|
||||||
select SND_SOC_ACPI if ACPI
|
select SND_SOC_ACPI if ACPI
|
||||||
|
depends on AMD_NODE
|
||||||
help
|
help
|
||||||
This option is not user-selectable but automatically handled by
|
This option is not user-selectable but automatically handled by
|
||||||
'select' statements at a higher level
|
'select' statements at a higher level
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
|
|
||||||
|
#include <asm/amd_node.h>
|
||||||
|
|
||||||
#include "../ops.h"
|
#include "../ops.h"
|
||||||
#include "acp.h"
|
#include "acp.h"
|
||||||
#include "acp-dsp-offset.h"
|
#include "acp-dsp-offset.h"
|
||||||
@ -42,24 +44,6 @@ const struct dmi_system_id acp_sof_quirk_table[] = {
|
|||||||
};
|
};
|
||||||
EXPORT_SYMBOL_GPL(acp_sof_quirk_table);
|
EXPORT_SYMBOL_GPL(acp_sof_quirk_table);
|
||||||
|
|
||||||
static int smn_write(struct pci_dev *dev, u32 smn_addr, u32 data)
|
|
||||||
{
|
|
||||||
pci_write_config_dword(dev, 0x60, smn_addr);
|
|
||||||
pci_write_config_dword(dev, 0x64, data);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int smn_read(struct pci_dev *dev, u32 smn_addr)
|
|
||||||
{
|
|
||||||
u32 data = 0;
|
|
||||||
|
|
||||||
pci_write_config_dword(dev, 0x60, smn_addr);
|
|
||||||
pci_read_config_dword(dev, 0x64, &data);
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void init_dma_descriptor(struct acp_dev_data *adata)
|
static void init_dma_descriptor(struct acp_dev_data *adata)
|
||||||
{
|
{
|
||||||
struct snd_sof_dev *sdev = adata->dev;
|
struct snd_sof_dev *sdev = adata->dev;
|
||||||
@ -208,11 +192,11 @@ int configure_and_run_dma(struct acp_dev_data *adata, unsigned int src_addr,
|
|||||||
static int psp_mbox_ready(struct acp_dev_data *adata, bool ack)
|
static int psp_mbox_ready(struct acp_dev_data *adata, bool ack)
|
||||||
{
|
{
|
||||||
struct snd_sof_dev *sdev = adata->dev;
|
struct snd_sof_dev *sdev = adata->dev;
|
||||||
int ret;
|
int ret, data;
|
||||||
u32 data;
|
|
||||||
|
ret = read_poll_timeout(smn_read_register, data, data > 0 && data & MBOX_READY_MASK,
|
||||||
|
MBOX_DELAY_US, ACP_PSP_TIMEOUT_US, false, MP0_C2PMSG_114_REG);
|
||||||
|
|
||||||
ret = read_poll_timeout(smn_read, data, data & MBOX_READY_MASK, MBOX_DELAY_US,
|
|
||||||
ACP_PSP_TIMEOUT_US, false, adata->smn_dev, MP0_C2PMSG_114_REG);
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -240,8 +224,8 @@ static int psp_send_cmd(struct acp_dev_data *adata, int cmd)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
/* Get a non-zero Doorbell value from PSP */
|
/* Get a non-zero Doorbell value from PSP */
|
||||||
ret = read_poll_timeout(smn_read, data, data, MBOX_DELAY_US, ACP_PSP_TIMEOUT_US, false,
|
ret = read_poll_timeout(smn_read_register, data, data > 0, MBOX_DELAY_US,
|
||||||
adata->smn_dev, MP0_C2PMSG_73_REG);
|
ACP_PSP_TIMEOUT_US, false, MP0_C2PMSG_73_REG);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(sdev->dev, "Failed to get Doorbell from MBOX %x\n", MP0_C2PMSG_73_REG);
|
dev_err(sdev->dev, "Failed to get Doorbell from MBOX %x\n", MP0_C2PMSG_73_REG);
|
||||||
@ -253,10 +237,14 @@ static int psp_send_cmd(struct acp_dev_data *adata, int cmd)
|
|||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
smn_write(adata->smn_dev, MP0_C2PMSG_114_REG, cmd);
|
ret = amd_smn_write(0, MP0_C2PMSG_114_REG, cmd);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
/* Ring the Doorbell for PSP */
|
/* Ring the Doorbell for PSP */
|
||||||
smn_write(adata->smn_dev, MP0_C2PMSG_73_REG, data);
|
ret = amd_smn_write(0, MP0_C2PMSG_73_REG, data);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
/* Check MBOX ready as PSP ack */
|
/* Check MBOX ready as PSP ack */
|
||||||
ret = psp_mbox_ready(adata, 1);
|
ret = psp_mbox_ready(adata, 1);
|
||||||
@ -770,16 +758,10 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)
|
|||||||
adata->pci_rev = pci->revision;
|
adata->pci_rev = pci->revision;
|
||||||
mutex_init(&adata->acp_lock);
|
mutex_init(&adata->acp_lock);
|
||||||
sdev->pdata->hw_pdata = adata;
|
sdev->pdata->hw_pdata = adata;
|
||||||
adata->smn_dev = pci_get_device(PCI_VENDOR_ID_AMD, chip->host_bridge_id, NULL);
|
|
||||||
if (!adata->smn_dev) {
|
|
||||||
dev_err(sdev->dev, "Failed to get host bridge device\n");
|
|
||||||
ret = -ENODEV;
|
|
||||||
goto unregister_dev;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = acp_init(sdev);
|
ret = acp_init(sdev);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto free_smn_dev;
|
goto unregister_dev;
|
||||||
|
|
||||||
sdev->ipc_irq = pci->irq;
|
sdev->ipc_irq = pci->irq;
|
||||||
ret = request_threaded_irq(sdev->ipc_irq, acp_irq_handler, acp_irq_thread,
|
ret = request_threaded_irq(sdev->ipc_irq, acp_irq_handler, acp_irq_thread,
|
||||||
@ -787,7 +769,7 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(sdev->dev, "failed to register IRQ %d\n",
|
dev_err(sdev->dev, "failed to register IRQ %d\n",
|
||||||
sdev->ipc_irq);
|
sdev->ipc_irq);
|
||||||
goto free_smn_dev;
|
goto unregister_dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* scan SoundWire capabilities exposed by DSDT */
|
/* scan SoundWire capabilities exposed by DSDT */
|
||||||
@ -800,7 +782,6 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)
|
|||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(sdev->dev, "error: SoundWire probe error\n");
|
dev_err(sdev->dev, "error: SoundWire probe error\n");
|
||||||
free_irq(sdev->ipc_irq, sdev);
|
free_irq(sdev->ipc_irq, sdev);
|
||||||
pci_dev_put(adata->smn_dev);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -846,8 +827,6 @@ int amd_sof_acp_probe(struct snd_sof_dev *sdev)
|
|||||||
|
|
||||||
free_ipc_irq:
|
free_ipc_irq:
|
||||||
free_irq(sdev->ipc_irq, sdev);
|
free_irq(sdev->ipc_irq, sdev);
|
||||||
free_smn_dev:
|
|
||||||
pci_dev_put(adata->smn_dev);
|
|
||||||
unregister_dev:
|
unregister_dev:
|
||||||
platform_device_unregister(adata->dmic_dev);
|
platform_device_unregister(adata->dmic_dev);
|
||||||
return ret;
|
return ret;
|
||||||
@ -858,9 +837,6 @@ void amd_sof_acp_remove(struct snd_sof_dev *sdev)
|
|||||||
{
|
{
|
||||||
struct acp_dev_data *adata = sdev->pdata->hw_pdata;
|
struct acp_dev_data *adata = sdev->pdata->hw_pdata;
|
||||||
|
|
||||||
if (adata->smn_dev)
|
|
||||||
pci_dev_put(adata->smn_dev);
|
|
||||||
|
|
||||||
if (adata->sdw)
|
if (adata->sdw)
|
||||||
amd_sof_sdw_exit(sdev);
|
amd_sof_sdw_exit(sdev);
|
||||||
|
|
||||||
|
@ -255,7 +255,6 @@ struct acp_dev_data {
|
|||||||
struct dma_descriptor dscr_info[ACP_MAX_DESC];
|
struct dma_descriptor dscr_info[ACP_MAX_DESC];
|
||||||
struct acp_dsp_stream stream_buf[ACP_MAX_STREAM];
|
struct acp_dsp_stream stream_buf[ACP_MAX_STREAM];
|
||||||
struct acp_dsp_stream *dtrace_stream;
|
struct acp_dsp_stream *dtrace_stream;
|
||||||
struct pci_dev *smn_dev;
|
|
||||||
struct acp_dsp_stream *probe_stream;
|
struct acp_dsp_stream *probe_stream;
|
||||||
bool enable_fw_debug;
|
bool enable_fw_debug;
|
||||||
bool is_dram_in_use;
|
bool is_dram_in_use;
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#define ACP6X_FUTURE_REG_ACLK_0 0x1854
|
#define ACP6X_FUTURE_REG_ACLK_0 0x1854
|
||||||
|
|
||||||
static const struct sof_amd_acp_desc rembrandt_chip_info = {
|
static const struct sof_amd_acp_desc rembrandt_chip_info = {
|
||||||
.host_bridge_id = HOST_BRIDGE_RMB,
|
|
||||||
.pgfsm_base = ACP6X_PGFSM_BASE,
|
.pgfsm_base = ACP6X_PGFSM_BASE,
|
||||||
.ext_intr_stat = ACP6X_EXT_INTR_STAT,
|
.ext_intr_stat = ACP6X_EXT_INTR_STAT,
|
||||||
.dsp_intr_base = ACP6X_DSP_SW_INTR_BASE,
|
.dsp_intr_base = ACP6X_DSP_SW_INTR_BASE,
|
||||||
|
@ -28,7 +28,6 @@
|
|||||||
#define ACP3X_FUTURE_REG_ACLK_0 0x1860
|
#define ACP3X_FUTURE_REG_ACLK_0 0x1860
|
||||||
|
|
||||||
static const struct sof_amd_acp_desc renoir_chip_info = {
|
static const struct sof_amd_acp_desc renoir_chip_info = {
|
||||||
.host_bridge_id = HOST_BRIDGE_CZN,
|
|
||||||
.pgfsm_base = ACP3X_PGFSM_BASE,
|
.pgfsm_base = ACP3X_PGFSM_BASE,
|
||||||
.ext_intr_stat = ACP3X_EXT_INTR_STAT,
|
.ext_intr_stat = ACP3X_EXT_INTR_STAT,
|
||||||
.dsp_intr_base = ACP3X_DSP_SW_INTR_BASE,
|
.dsp_intr_base = ACP3X_DSP_SW_INTR_BASE,
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
static const struct sof_amd_acp_desc vangogh_chip_info = {
|
static const struct sof_amd_acp_desc vangogh_chip_info = {
|
||||||
.name = "vangogh",
|
.name = "vangogh",
|
||||||
.host_bridge_id = HOST_BRIDGE_VGH,
|
|
||||||
.pgfsm_base = ACP5X_PGFSM_BASE,
|
.pgfsm_base = ACP5X_PGFSM_BASE,
|
||||||
.ext_intr_stat = ACP5X_EXT_INTR_STAT,
|
.ext_intr_stat = ACP5X_EXT_INTR_STAT,
|
||||||
.dsp_intr_base = ACP5X_DSP_SW_INTR_BASE,
|
.dsp_intr_base = ACP5X_DSP_SW_INTR_BASE,
|
||||||
|
Loading…
Reference in New Issue
Block a user