From: Mario Limonciello <superm1@kernel.org>
To: Yazen Ghannam <yazen.ghannam@amd.com>,
Borislav Petkov <bp@alien8.de>, Mark Brown <broonie@kernel.org>
Cc: "Mario Limonciello" <mario.limonciello@amd.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)),
"H . Peter Anvin" <hpa@zytor.com>,
"Liam Girdwood" <lgirdwood@gmail.com>,
"Jaroslav Kysela" <perex@perex.cz>,
"Takashi Iwai" <tiwai@suse.com>,
"Peter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
"Bard Liao" <yung-chuan.liao@linux.intel.com>,
"Ranjani Sridharan" <ranjani.sridharan@linux.intel.com>,
"Daniel Baluta" <daniel.baluta@nxp.com>,
"Kai Vehmanen" <kai.vehmanen@linux.intel.com>,
"Pierre-Louis Bossart" <pierre-louis.bossart@linux.dev>,
"Vijendar Mukunda" <Vijendar.Mukunda@amd.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"Jeff Johnson" <quic_jjohnson@quicinc.com>,
"Venkata Prasad Potturu" <venkataprasad.potturu@amd.com>,
"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
"Arnd Bergmann" <arnd@arndb.de>,
"Cristian Ciocaltea" <cristian.ciocaltea@collabora.com>,
"Krzysztof Kozlowski" <krzk@kernel.org>,
linux-kernel@vger.kernel.org (open list:AMD NODE DRIVER),
linux-sound@vger.kernel.org (open list:SOUND - SOC LAYER /
DYNAMIC AUDIO POWER MANAGEM...),
sound-open-firmware@alsa-project.org (moderated list:SOUND -
SOUND OPEN FIRMWARE (SOF) DRIVERS)
Subject: [PATCH 4/7] ASoC: amd: acp: acp63: Use AMD_NODE
Date: Mon, 17 Feb 2025 17:17:44 -0600 [thread overview]
Message-ID: <20250217231747.1656228-5-superm1@kernel.org> (raw)
In-Reply-To: <20250217231747.1656228-1-superm1@kernel.org>
From: Mario Limonciello <mario.limonciello@amd.com>
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>
---
sound/soc/amd/acp/Kconfig | 1 +
sound/soc/amd/acp/acp63.c | 63 +++++++++++++++++++++++------------
sound/soc/sof/amd/pci-acp63.c | 1 -
3 files changed, 42 insertions(+), 23 deletions(-)
diff --git a/sound/soc/amd/acp/Kconfig b/sound/soc/amd/acp/Kconfig
index a649f49864059..157c124570c88 100644
--- a/sound/soc/amd/acp/Kconfig
+++ b/sound/soc/amd/acp/Kconfig
@@ -69,6 +69,7 @@ config SND_AMD_ASOC_ACP63
tristate "AMD ACP ASOC ACP6.3 Support"
depends on X86 && PCI
depends on ACPI
+ depends on AMD_NODE
select SND_SOC_AMD_ACP_PCM
select SND_SOC_AMD_ACP_I2S
select SND_SOC_AMD_ACP_PDM
diff --git a/sound/soc/amd/acp/acp63.c b/sound/soc/amd/acp/acp63.c
index 81496e713440b..4187a8968de75 100644
--- a/sound/soc/amd/acp/acp63.c
+++ b/sound/soc/amd/acp/acp63.c
@@ -20,6 +20,9 @@
#include <linux/dma-mapping.h>
#include <linux/pm_runtime.h>
#include <linux/pci.h>
+
+#include <asm/amd_node.h>
+
#include "amd.h"
#include "acp-mach.h"
#include "../mach-config.h"
@@ -160,37 +163,53 @@ static struct snd_soc_dai_driver acp63_dai[] = {
static int acp63_i2s_master_clock_generate(struct acp_dev_data *adata)
{
+ int rc;
u32 data;
union clk_pll_req_no clk_pll;
- struct pci_dev *smn_dev;
-
- smn_dev = pci_get_device(PCI_VENDOR_ID_AMD, 0x14E8, NULL);
- if (!smn_dev)
- return -ENODEV;
/* Clk5 pll register values to get mclk as 196.6MHz*/
clk_pll.bits.fb_mult_int = 0x31;
clk_pll.bits.pll_spine_div = 0;
clk_pll.bits.gb_mult_frac = 0x26E9;
- data = smn_read(smn_dev, CLK_PLL_PWR_REQ_N0);
- smn_write(smn_dev, CLK_PLL_PWR_REQ_N0, data | PLL_AUTO_STOP_REQ);
-
- data = smn_read(smn_dev, CLK_SPLL_FIELD_2_N0);
- if (data & PLL_FRANCE_EN)
- smn_write(smn_dev, CLK_SPLL_FIELD_2_N0, data | PLL_FRANCE_EN);
-
- smn_write(smn_dev, CLK_PLL_REQ_N0, clk_pll.clk_pll_req_no_reg);
-
- data = smn_read(smn_dev, CLK_PLL_PWR_REQ_N0);
- smn_write(smn_dev, CLK_PLL_PWR_REQ_N0, data | PLL_AUTO_START_REQ);
-
- data = smn_read(smn_dev, CLK_DFSBYPASS_CONTR);
- smn_write(smn_dev, CLK_DFSBYPASS_CONTR, data | EXIT_DPF_BYPASS_0);
- smn_write(smn_dev, CLK_DFSBYPASS_CONTR, data | EXIT_DPF_BYPASS_1);
+ rc = amd_smn_read(0, CLK_PLL_PWR_REQ_N0, &data);
+ if (rc)
+ return rc;
+ rc = amd_smn_write(0, CLK_PLL_PWR_REQ_N0, data | PLL_AUTO_STOP_REQ);
+ if (rc)
+ return rc;
+
+ rc = amd_smn_read(0, CLK_SPLL_FIELD_2_N0, &data);
+ if (rc)
+ return rc;
+ if (data & PLL_FRANCE_EN) {
+ rc = amd_smn_write(0, CLK_SPLL_FIELD_2_N0, data | PLL_FRANCE_EN);
+ if (rc)
+ return rc;
+ }
- smn_write(smn_dev, CLK_DFS_CNTL_N0, CLK0_DIVIDER);
- return 0;
+ rc = amd_smn_write(0, CLK_PLL_REQ_N0, clk_pll.clk_pll_req_no_reg);
+ if (rc)
+ return rc;
+
+ rc = amd_smn_read(0, CLK_PLL_PWR_REQ_N0, &data);
+ if (rc)
+ return rc;
+ rc = amd_smn_write(0, CLK_PLL_PWR_REQ_N0, data | PLL_AUTO_START_REQ);
+ if (rc)
+ return rc;
+
+ rc = amd_smn_read(0, CLK_DFSBYPASS_CONTR, &data);
+ if (rc)
+ return rc;
+ rc = amd_smn_write(0, CLK_DFSBYPASS_CONTR, data | EXIT_DPF_BYPASS_0);
+ if (rc)
+ return rc;
+ rc = amd_smn_write(0, CLK_DFSBYPASS_CONTR, data | EXIT_DPF_BYPASS_1);
+ if (rc)
+ return rc;
+
+ return amd_smn_write(0, CLK_DFS_CNTL_N0, CLK0_DIVIDER);
}
static int acp63_audio_probe(struct platform_device *pdev)
diff --git a/sound/soc/sof/amd/pci-acp63.c b/sound/soc/sof/amd/pci-acp63.c
index ffe7c755d655e..13aa87cdeeac3 100644
--- a/sound/soc/sof/amd/pci-acp63.c
+++ b/sound/soc/sof/amd/pci-acp63.c
@@ -28,7 +28,6 @@
#define ACP6x_REG_END 0x125C000
static const struct sof_amd_acp_desc acp63_chip_info = {
- .host_bridge_id = HOST_BRIDGE_ACP63,
.pgfsm_base = ACP6X_PGFSM_BASE,
.ext_intr_enb = ACP6X_EXTERNAL_INTR_ENB,
.ext_intr_cntl = ACP6X_EXTERNAL_INTR_CNTL,
--
2.43.0
next prev parent reply other threads:[~2025-02-17 23:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 23:17 [PATCH 0/7] Adjust all AMD audio drivers to use AMD_NODE Mario Limonciello
2025-02-17 23:17 ` [PATCH 1/7] x86/amd_node: Add a helper for use with `read_poll_timeout` Mario Limonciello
2025-02-17 23:17 ` [PATCH 2/7] ASoC: amd: acp: rembrandt: Use AMD_NODE Mario Limonciello
2025-02-17 23:17 ` [PATCH 3/7] ASoC: amd: acp: acp70: " Mario Limonciello
2025-02-17 23:17 ` Mario Limonciello [this message]
2025-02-17 23:17 ` [PATCH 5/7] ASoC: SOF: amd: " Mario Limonciello
2025-02-17 23:17 ` [PATCH 6/7] ASoC: amd: acp: Drop local symbols for smn read/write Mario Limonciello
2025-02-17 23:17 ` [PATCH 7/7] ASoC: SOF: amd: Drop host bridge ID from struct Mario Limonciello
2025-02-18 15:11 ` [PATCH 0/7] Adjust all AMD audio drivers to use AMD_NODE Mark Brown
2025-02-18 15:16 ` Mario Limonciello
2025-02-18 15:26 ` Borislav Petkov
2025-02-18 15:33 ` Mario Limonciello
2025-02-18 17:26 ` Borislav Petkov
2025-02-18 17:29 ` Mario Limonciello
2025-02-19 23:08 ` (subset) " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250217231747.1656228-5-superm1@kernel.org \
--to=superm1@kernel.org \
--cc=Vijendar.Mukunda@amd.com \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=broonie@kernel.org \
--cc=cristian.ciocaltea@collabora.com \
--cc=daniel.baluta@nxp.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=krzk@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=peterz@infradead.org \
--cc=pierre-louis.bossart@linux.dev \
--cc=quic_jjohnson@quicinc.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sound-open-firmware@alsa-project.org \
--cc=tglx@linutronix.de \
--cc=tiwai@suse.com \
--cc=u.kleine-koenig@baylibre.com \
--cc=venkataprasad.potturu@amd.com \
--cc=x86@kernel.org \
--cc=yazen.ghannam@amd.com \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox