From: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
To: <broonie@kernel.org>
Cc: <alsa-devel@alsa-project.org>, <Basavaraj.Hiregoudar@amd.com>,
<Sunil-kumar.Dommati@amd.com>, <venkataprasad.potturu@amd.com>,
"Vijendar Mukunda" <Vijendar.Mukunda@amd.com>,
Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Peter Ujfalusi <peter.ujfalusi@linux.intel.com>,
Bard Liao <yung-chuan.liao@linux.intel.com>,
Daniel Baluta <daniel.baluta@nxp.com>,
"Kai Vehmanen" <kai.vehmanen@linux.intel.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Cristian Ciocaltea <cristian.ciocaltea@collabora.com>,
Emil Velikov <emil.velikov@collabora.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
"Ajit Kumar Pandey" <AjitKumar.Pandey@amd.com>,
"moderated list:SOUND - SOUND OPEN FIRMWARE (SOF) DRIVERS"
<sound-open-firmware@alsa-project.org>,
"open list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..."
<linux-sound@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: [PATCH 4/8] ASoC: SOF: amd: fix for acp init sequence
Date: Wed, 7 Aug 2024 10:43:16 +0530 [thread overview]
Message-ID: <20240807051341.1616925-4-Vijendar.Mukunda@amd.com> (raw)
In-Reply-To: <20240807051341.1616925-1-Vijendar.Mukunda@amd.com>
When ACP is not powered on by default, acp power on sequence explicitly
invoked by programming pgfsm control mask. Update ACP pgfsm control mask
and status mask based on ACP variant.
Fixes: 846aef1d7cc0 ("ASoC: SOF: amd: Add Renoir ACP HW support")
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
sound/soc/sof/amd/acp.c | 21 +++++++++++++++++++--
sound/soc/sof/amd/acp.h | 7 +++++--
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c
index d0ba641ba28c..a9f32983b3af 100644
--- a/sound/soc/sof/amd/acp.c
+++ b/sound/soc/sof/amd/acp.c
@@ -430,8 +430,10 @@ static irqreturn_t acp_irq_handler(int irq, void *dev_id)
static int acp_power_on(struct snd_sof_dev *sdev)
{
const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata);
+ struct acp_dev_data *adata = sdev->pdata->hw_pdata;
unsigned int base = desc->pgfsm_base;
unsigned int val;
+ unsigned int acp_pgfsm_status_mask, acp_pgfsm_cntl_mask;
int ret;
val = snd_sof_dsp_read(sdev, ACP_DSP_BAR, base + PGFSM_STATUS_OFFSET);
@@ -439,9 +441,24 @@ static int acp_power_on(struct snd_sof_dev *sdev)
if (val == ACP_POWERED_ON)
return 0;
- if (val & ACP_PGFSM_STATUS_MASK)
+ switch (adata->pci_rev) {
+ case ACP_RN_PCI_ID:
+ case ACP_VANGOGH_PCI_ID:
+ acp_pgfsm_status_mask = ACP3X_PGFSM_STATUS_MASK;
+ acp_pgfsm_cntl_mask = ACP3X_PGFSM_CNTL_POWER_ON_MASK;
+ break;
+ case ACP_RMB_PCI_ID:
+ case ACP63_PCI_ID:
+ acp_pgfsm_status_mask = ACP6X_PGFSM_STATUS_MASK;
+ acp_pgfsm_cntl_mask = ACP6X_PGFSM_CNTL_POWER_ON_MASK;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ if (val & acp_pgfsm_status_mask)
snd_sof_dsp_write(sdev, ACP_DSP_BAR, base + PGFSM_CONTROL_OFFSET,
- ACP_PGFSM_CNTL_POWER_ON_MASK);
+ acp_pgfsm_cntl_mask);
ret = snd_sof_dsp_read_poll_timeout(sdev, ACP_DSP_BAR, base + PGFSM_STATUS_OFFSET, val,
!val, ACP_REG_POLL_INTERVAL, ACP_REG_POLL_TIMEOUT_US);
diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h
index f6f0fcfeb691..321c40cc6d50 100644
--- a/sound/soc/sof/amd/acp.h
+++ b/sound/soc/sof/amd/acp.h
@@ -25,8 +25,11 @@
#define ACP_REG_POLL_TIMEOUT_US 2000
#define ACP_DMA_COMPLETE_TIMEOUT_US 5000
-#define ACP_PGFSM_CNTL_POWER_ON_MASK 0x01
-#define ACP_PGFSM_STATUS_MASK 0x03
+#define ACP3X_PGFSM_CNTL_POWER_ON_MASK 0x01
+#define ACP3X_PGFSM_STATUS_MASK 0x03
+#define ACP6X_PGFSM_CNTL_POWER_ON_MASK 0x07
+#define ACP6X_PGFSM_STATUS_MASK 0x0F
+
#define ACP_POWERED_ON 0x00
#define ACP_ASSERT_RESET 0x01
#define ACP_RELEASE_RESET 0x00
--
2.34.1
next prev parent reply other threads:[~2024-08-07 5:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 5:13 [PATCH 1/8] ASoC: SOF: amd: Fix for incorrect acp error satus register offset Vijendar Mukunda
2024-08-07 5:13 ` [PATCH 2/8] ASoC: SOF: amd: fix for acp error reason registers wrong offset Vijendar Mukunda
2024-08-08 19:32 ` Mark Brown
2024-08-09 2:00 ` Mukunda,Vijendar
2024-08-09 7:35 ` Mark Brown
2024-08-09 8:19 ` Mukunda,Vijendar
2024-08-09 23:26 ` Mark Brown
2024-08-12 4:34 ` Mukunda,Vijendar
2024-08-07 5:13 ` [PATCH 3/8] ASoC: SOF: amd: move iram-dram fence register programming sequence Vijendar Mukunda
2024-08-07 5:13 ` Vijendar Mukunda [this message]
2024-08-07 5:13 ` [PATCH 5/8] ASoC: SOF: amd: update conditional check for cache register update Vijendar Mukunda
2024-08-07 5:13 ` [PATCH 6/8] ASoC: SOF: amd: modify psp send command conditional checks Vijendar Mukunda
2024-08-07 5:13 ` [PATCH 7/8] ASoC: SOF: amd: remove unused variable from sof_amd_acp_desc structure Vijendar Mukunda
2024-08-07 5:13 ` [PATCH 8/8] ASoC: amd: acp: Convert comma to semicolon Vijendar Mukunda
2024-08-08 20:56 ` (subset) [PATCH 1/8] ASoC: SOF: amd: Fix for incorrect acp error satus register offset Mark Brown
2024-08-12 6:59 ` Mukunda,Vijendar
2024-08-13 7:33 ` Markus Elfring
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=20240807051341.1616925-4-Vijendar.Mukunda@amd.com \
--to=vijendar.mukunda@amd.com \
--cc=AjitKumar.Pandey@amd.com \
--cc=Basavaraj.Hiregoudar@amd.com \
--cc=Sunil-kumar.Dommati@amd.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=cristian.ciocaltea@collabora.com \
--cc=daniel.baluta@nxp.com \
--cc=emil.velikov@collabora.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=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sound-open-firmware@alsa-project.org \
--cc=tiwai@suse.com \
--cc=venkataprasad.potturu@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