* [PATCH 0/4] ASoC: SOF: AMD/Mediatek updates
@ 2022-04-06 19:40 Pierre-Louis Bossart
2022-04-06 19:40 ` [PATCH 1/4] ASoC: SOF: OF: Add shutdown callback for SOF OF device Pierre-Louis Bossart
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Pierre-Louis Bossart @ 2022-04-06 19:40 UTC (permalink / raw)
To: alsa-devel; +Cc: tiwai, broonie, Pierre-Louis Bossart
Hardware/IPC updates for AMD and shutdown support for Mediatek.
Ajit Kumar Pandey (2):
ASoC: SOF: amd: Add psp_mbox_ready() and psp_send_cmd() callback
ASoC: SOF: amd: Use dedicated MBOX for ACP and PSP communication
YC Hung (2):
ASoC: SOF: OF: Add shutdown callback for SOF OF device
ASoC: SOF: mediatek: mt8195 add shutdown callback
sound/soc/sof/amd/acp.c | 66 +++++++++++++++++++++++---
sound/soc/sof/amd/acp.h | 6 ++-
sound/soc/sof/mediatek/mt8195/mt8195.c | 7 +++
sound/soc/sof/sof-of-dev.c | 6 +++
sound/soc/sof/sof-of-dev.h | 1 +
5 files changed, 77 insertions(+), 9 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] ASoC: SOF: OF: Add shutdown callback for SOF OF device
2022-04-06 19:40 [PATCH 0/4] ASoC: SOF: AMD/Mediatek updates Pierre-Louis Bossart
@ 2022-04-06 19:40 ` Pierre-Louis Bossart
2022-04-06 19:40 ` [PATCH 2/4] ASoC: SOF: mediatek: mt8195 add shutdown callback Pierre-Louis Bossart
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Pierre-Louis Bossart @ 2022-04-06 19:40 UTC (permalink / raw)
To: alsa-devel
Cc: tiwai, Ranjani Sridharan, Pierre-Louis Bossart, broonie, YC Hung,
Péter Ujfalusi
From: YC Hung <yc.hung@mediatek.com>
Add shutdown callback function for SOF OF device and call
snd_sof_device_shutdown in sof_of_shutdown callback for DSP
shutdown sequence.
Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
sound/soc/sof/sof-of-dev.c | 6 ++++++
sound/soc/sof/sof-of-dev.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/sound/soc/sof/sof-of-dev.c b/sound/soc/sof/sof-of-dev.c
index e3718638f9ce..18c0f3cd0993 100644
--- a/sound/soc/sof/sof-of-dev.c
+++ b/sound/soc/sof/sof-of-dev.c
@@ -95,4 +95,10 @@ int sof_of_remove(struct platform_device *pdev)
}
EXPORT_SYMBOL(sof_of_remove);
+void sof_of_shutdown(struct platform_device *pdev)
+{
+ snd_sof_device_shutdown(&pdev->dev);
+}
+EXPORT_SYMBOL(sof_of_shutdown);
+
MODULE_LICENSE("Dual BSD/GPL");
diff --git a/sound/soc/sof/sof-of-dev.h b/sound/soc/sof/sof-of-dev.h
index 4e0f6588dad9..fd950a222ba4 100644
--- a/sound/soc/sof/sof-of-dev.h
+++ b/sound/soc/sof/sof-of-dev.h
@@ -13,5 +13,6 @@ extern const struct dev_pm_ops sof_of_pm;
int sof_of_probe(struct platform_device *pdev);
int sof_of_remove(struct platform_device *pdev);
+void sof_of_shutdown(struct platform_device *pdev);
#endif
--
2.30.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] ASoC: SOF: mediatek: mt8195 add shutdown callback
2022-04-06 19:40 [PATCH 0/4] ASoC: SOF: AMD/Mediatek updates Pierre-Louis Bossart
2022-04-06 19:40 ` [PATCH 1/4] ASoC: SOF: OF: Add shutdown callback for SOF OF device Pierre-Louis Bossart
@ 2022-04-06 19:40 ` Pierre-Louis Bossart
2022-04-06 19:40 ` [PATCH 3/4] ASoC: SOF: amd: Add psp_mbox_ready() and psp_send_cmd() callback Pierre-Louis Bossart
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Pierre-Louis Bossart @ 2022-04-06 19:40 UTC (permalink / raw)
To: alsa-devel
Cc: tiwai, Ranjani Sridharan, Pierre-Louis Bossart, broonie, YC Hung,
Péter Ujfalusi
From: YC Hung <yc.hung@mediatek.com>
Add mt8195 shutdown callback function implementation to ensure that
shutdown flow is called to shutdown dsp core, disable adsp clock, and
power off dsp sram correctly during reboot flow.
Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
sound/soc/sof/mediatek/mt8195/mt8195.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/sound/soc/sof/mediatek/mt8195/mt8195.c b/sound/soc/sof/mediatek/mt8195/mt8195.c
index 3ab12f352935..b5e2fd72acfb 100644
--- a/sound/soc/sof/mediatek/mt8195/mt8195.c
+++ b/sound/soc/sof/mediatek/mt8195/mt8195.c
@@ -302,6 +302,11 @@ static int mt8195_dsp_probe(struct snd_sof_dev *sdev)
return ret;
}
+static int mt8195_dsp_shutdown(struct snd_sof_dev *sdev)
+{
+ return snd_sof_suspend(sdev->dev);
+}
+
static int mt8195_dsp_remove(struct snd_sof_dev *sdev)
{
struct platform_device *pdev = container_of(sdev->dev, struct platform_device, dev);
@@ -392,6 +397,7 @@ static const struct snd_sof_dsp_ops sof_mt8195_ops = {
/* probe and remove */
.probe = mt8195_dsp_probe,
.remove = mt8195_dsp_remove,
+ .shutdown = mt8195_dsp_shutdown,
/* DSP core boot */
.run = mt8195_run,
@@ -451,6 +457,7 @@ MODULE_DEVICE_TABLE(of, sof_of_mt8195_ids);
static struct platform_driver snd_sof_of_mt8195_driver = {
.probe = sof_of_probe,
.remove = sof_of_remove,
+ .shutdown = sof_of_shutdown,
.driver = {
.name = "sof-audio-of-mt8195",
.pm = &sof_of_pm,
--
2.30.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] ASoC: SOF: amd: Add psp_mbox_ready() and psp_send_cmd() callback
2022-04-06 19:40 [PATCH 0/4] ASoC: SOF: AMD/Mediatek updates Pierre-Louis Bossart
2022-04-06 19:40 ` [PATCH 1/4] ASoC: SOF: OF: Add shutdown callback for SOF OF device Pierre-Louis Bossart
2022-04-06 19:40 ` [PATCH 2/4] ASoC: SOF: mediatek: mt8195 add shutdown callback Pierre-Louis Bossart
@ 2022-04-06 19:40 ` Pierre-Louis Bossart
2022-04-08 8:37 ` Mark Brown
2022-04-06 19:40 ` [PATCH 4/4] ASoC: SOF: amd: Use dedicated MBOX for ACP and PSP communication Pierre-Louis Bossart
2022-04-08 11:24 ` [PATCH 0/4] ASoC: SOF: AMD/Mediatek updates Mark Brown
4 siblings, 1 reply; 7+ messages in thread
From: Pierre-Louis Bossart @ 2022-04-06 19:40 UTC (permalink / raw)
To: alsa-devel
Cc: tiwai, broonie, Pierre-Louis Bossart, Ajit Kumar Pandey,
Ranjani Sridharan
From: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
We need to ensure if PSP is mbox ready before and after sending cmd
to PSP over SMN interface. Add method to check MBOX_READY bit of PSP
with some delay over ACP_PSP_TIMEOUT_COUNTER. Replace psp_fw_validate
with new method psp_send_cmd() to send command via psp mailbox.
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
---
sound/soc/sof/amd/acp.c | 47 +++++++++++++++++++++++++++++++++++------
1 file changed, 41 insertions(+), 6 deletions(-)
diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c
index 71d71c152342..461f9b0ce49e 100644
--- a/sound/soc/sof/amd/acp.c
+++ b/sound/soc/sof/amd/acp.c
@@ -138,14 +138,18 @@ int configure_and_run_dma(struct acp_dev_data *adata, unsigned int src_addr,
return ret;
}
-static int psp_fw_validate(struct acp_dev_data *adata)
+/*
+ * psp_mbox_ready- function to poll ready bit of psp mbox
+ * @adata: acp device data
+ * @ack: bool variable to check ready bit status or psp ack
+ */
+
+static int psp_mbox_ready(struct acp_dev_data *adata, bool ack)
{
struct snd_sof_dev *sdev = adata->dev;
int timeout;
u32 data;
- smn_write(adata->smn_dev, MP0_C2PMSG_26_REG, MBOX_ACP_SHA_DMA_COMMAND);
-
for (timeout = ACP_PSP_TIMEOUT_COUNTER; timeout > 0; timeout--) {
msleep(20);
smn_read(adata->smn_dev, MP0_C2PMSG_26_REG, &data);
@@ -153,8 +157,39 @@ static int psp_fw_validate(struct acp_dev_data *adata)
return 0;
}
- dev_err(sdev->dev, "FW validation timedout: status %x\n", data & MBOX_STATUS_MASK);
- return -ETIMEDOUT;
+ dev_err(sdev->dev, "PSP error status %x\n", data & MBOX_STATUS_MASK);
+
+ if (ack)
+ return -ETIMEDOUT;
+
+ return -EBUSY;
+}
+
+/*
+ * psp_send_cmd - function to send psp command over mbox
+ * @adata: acp device data
+ * @cmd: non zero integer value for command type
+ */
+
+static int psp_send_cmd(struct acp_dev_data *adata, int cmd)
+{
+ struct snd_sof_dev *sdev = adata->dev;
+ int ret;
+
+ if (!cmd)
+ return -EINVAL;
+
+ /* Check if PSP is ready for new command */
+ ret = psp_mbox_ready(adata, 0);
+ if (ret)
+ return ret;
+
+ smn_write(adata->smn_dev, MP0_C2PMSG_26_REG, cmd);
+
+ /* Check MBOX ready as PSP ack */
+ ret = psp_mbox_ready(adata, 1);
+
+ return ret;
}
int configure_and_run_sha_dma(struct acp_dev_data *adata, void *image_addr,
@@ -196,7 +231,7 @@ int configure_and_run_sha_dma(struct acp_dev_data *adata, void *image_addr,
return ret;
}
- ret = psp_fw_validate(adata);
+ ret = psp_send_cmd(adata, MBOX_ACP_SHA_DMA_COMMAND);
if (ret)
return ret;
--
2.30.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] ASoC: SOF: amd: Use dedicated MBOX for ACP and PSP communication
2022-04-06 19:40 [PATCH 0/4] ASoC: SOF: AMD/Mediatek updates Pierre-Louis Bossart
` (2 preceding siblings ...)
2022-04-06 19:40 ` [PATCH 3/4] ASoC: SOF: amd: Add psp_mbox_ready() and psp_send_cmd() callback Pierre-Louis Bossart
@ 2022-04-06 19:40 ` Pierre-Louis Bossart
2022-04-08 11:24 ` [PATCH 0/4] ASoC: SOF: AMD/Mediatek updates Mark Brown
4 siblings, 0 replies; 7+ messages in thread
From: Pierre-Louis Bossart @ 2022-04-06 19:40 UTC (permalink / raw)
To: alsa-devel
Cc: Ajit Kumar Pandey, tiwai, Pierre-Louis Bossart,
Ranjani Sridharan, broonie, Bard Liao
From: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
We are currently using generic PSP Mailbox register for sending SHA
complete command to PSP but observe random arbitration issue during
PSP validation as MP0_C2PMSG_26_REG used by other kernel modules.
Use separate mailbox registers and doorbell mechanism to send SHA_DMA
complete command to PSP. This fixes such validation issues and added
flexibility for sending more ACP commands to PSP in future as new mbox
registers i.e MP0_C2PMSG_114_REG and MP0_C2PMSG_73_REG are dedicated
by PSP for ACP communications.
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
sound/soc/sof/amd/acp.c | 23 ++++++++++++++++++++---
sound/soc/sof/amd/acp.h | 6 ++++--
2 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/sound/soc/sof/amd/acp.c b/sound/soc/sof/amd/acp.c
index 461f9b0ce49e..0c272573df97 100644
--- a/sound/soc/sof/amd/acp.c
+++ b/sound/soc/sof/amd/acp.c
@@ -152,7 +152,7 @@ static int psp_mbox_ready(struct acp_dev_data *adata, bool ack)
for (timeout = ACP_PSP_TIMEOUT_COUNTER; timeout > 0; timeout--) {
msleep(20);
- smn_read(adata->smn_dev, MP0_C2PMSG_26_REG, &data);
+ smn_read(adata->smn_dev, MP0_C2PMSG_114_REG, &data);
if (data & MBOX_READY_MASK)
return 0;
}
@@ -174,17 +174,34 @@ static int psp_mbox_ready(struct acp_dev_data *adata, bool ack)
static int psp_send_cmd(struct acp_dev_data *adata, int cmd)
{
struct snd_sof_dev *sdev = adata->dev;
- int ret;
+ int ret, timeout;
+ u32 data;
if (!cmd)
return -EINVAL;
+ /* Get a non-zero Doorbell value from PSP */
+ for (timeout = ACP_PSP_TIMEOUT_COUNTER; timeout > 0; timeout--) {
+ msleep(MBOX_DELAY);
+ smn_read(adata->smn_dev, MP0_C2PMSG_73_REG, &data);
+ if (data)
+ break;
+ }
+
+ if (!timeout) {
+ dev_err(sdev->dev, "Failed to get Doorbell from MBOX %x\n", MP0_C2PMSG_73_REG);
+ return -EINVAL;
+ }
+
/* Check if PSP is ready for new command */
ret = psp_mbox_ready(adata, 0);
if (ret)
return ret;
- smn_write(adata->smn_dev, MP0_C2PMSG_26_REG, cmd);
+ smn_write(adata->smn_dev, MP0_C2PMSG_114_REG, cmd);
+
+ /* Ring the Doorbell for PSP */
+ smn_write(adata->smn_dev, MP0_C2PMSG_73_REG, data);
/* Check MBOX ready as PSP ack */
ret = psp_mbox_ready(adata, 1);
diff --git a/sound/soc/sof/amd/acp.h b/sound/soc/sof/amd/acp.h
index 35e46fe6676a..eb4e2a9a9c25 100644
--- a/sound/soc/sof/amd/acp.h
+++ b/sound/soc/sof/amd/acp.h
@@ -57,8 +57,10 @@
#define ACP_SHA_STAT 0x8000
#define ACP_PSP_TIMEOUT_COUNTER 5
#define ACP_EXT_INTR_ERROR_STAT 0x20000000
-#define MP0_C2PMSG_26_REG 0x03810570
-#define MBOX_ACP_SHA_DMA_COMMAND 0x330000
+#define MP0_C2PMSG_114_REG 0x3810AC8
+#define MP0_C2PMSG_73_REG 0x3810A24
+#define MBOX_ACP_SHA_DMA_COMMAND 0x70000
+#define MBOX_DELAY 1000
#define MBOX_READY_MASK 0x80000000
#define MBOX_STATUS_MASK 0xFFFF
--
2.30.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4] ASoC: SOF: amd: Add psp_mbox_ready() and psp_send_cmd() callback
2022-04-06 19:40 ` [PATCH 3/4] ASoC: SOF: amd: Add psp_mbox_ready() and psp_send_cmd() callback Pierre-Louis Bossart
@ 2022-04-08 8:37 ` Mark Brown
0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2022-04-08 8:37 UTC (permalink / raw)
To: Pierre-Louis Bossart
Cc: tiwai, alsa-devel, Ranjani Sridharan, Ajit Kumar Pandey
[-- Attachment #1: Type: text/plain, Size: 1321 bytes --]
On Wed, Apr 06, 2022 at 02:40:47PM -0500, Pierre-Louis Bossart wrote:
> From: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
>
> We need to ensure if PSP is mbox ready before and after sending cmd
> to PSP over SMN interface. Add method to check MBOX_READY bit of PSP
> with some delay over ACP_PSP_TIMEOUT_COUNTER. Replace psp_fw_validate
> with new method psp_send_cmd() to send command via psp mailbox.
This breaks an x86 allmodconfig build with GCC 11:
/build/stage/linux/sound/soc/sof/amd/acp.c: In function ‘psp_send_cmd’:
/build/stage/linux/sound/soc/sof/amd/acp.c:176:29: error: unused variable ‘sdev’ [-Werror=unused-variable]
176 | struct snd_sof_dev *sdev = adata->dev;
| ^~~~
cc1: all warnings being treated as errors
make[5]: *** [/build/stage/linux/scripts/Makefile.build:288: sound/soc/sof/amd/acp.o] Error 1
make[5]: Target '__build' not remade because of errors.
make[4]: *** [/build/stage/linux/scripts/Makefile.build:550: sound/soc/sof/amd] Error 2
make[4]: Target '__build' not remade because of errors.
make[3]: *** [/build/stage/linux/scripts/Makefile.build:550: sound/soc/sof] Error 2
make[3]: Target '__build' not remade because of errors.
make[2]: *** [/build/stage/linux/scripts/Makefile.build:550: sound/soc] Error 2
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/4] ASoC: SOF: AMD/Mediatek updates
2022-04-06 19:40 [PATCH 0/4] ASoC: SOF: AMD/Mediatek updates Pierre-Louis Bossart
` (3 preceding siblings ...)
2022-04-06 19:40 ` [PATCH 4/4] ASoC: SOF: amd: Use dedicated MBOX for ACP and PSP communication Pierre-Louis Bossart
@ 2022-04-08 11:24 ` Mark Brown
4 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2022-04-08 11:24 UTC (permalink / raw)
To: pierre-louis.bossart, alsa-devel; +Cc: tiwai
On Wed, 6 Apr 2022 14:40:44 -0500, Pierre-Louis Bossart wrote:
> Hardware/IPC updates for AMD and shutdown support for Mediatek.
>
> Ajit Kumar Pandey (2):
> ASoC: SOF: amd: Add psp_mbox_ready() and psp_send_cmd() callback
> ASoC: SOF: amd: Use dedicated MBOX for ACP and PSP communication
>
> YC Hung (2):
> ASoC: SOF: OF: Add shutdown callback for SOF OF device
> ASoC: SOF: mediatek: mt8195 add shutdown callback
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/4] ASoC: SOF: OF: Add shutdown callback for SOF OF device
commit: fe70300c70baa82fd3024af9a1d2838610a35005
[2/4] ASoC: SOF: mediatek: mt8195 add shutdown callback
commit: 5cfe477f6a3f9a4d9b2906d442964f2115b0403f
[3/4] ASoC: SOF: amd: Add psp_mbox_ready() and psp_send_cmd() callback
(no commit info)
[4/4] ASoC: SOF: amd: Use dedicated MBOX for ACP and PSP communication
(no commit info)
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-04-08 11:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06 19:40 [PATCH 0/4] ASoC: SOF: AMD/Mediatek updates Pierre-Louis Bossart
2022-04-06 19:40 ` [PATCH 1/4] ASoC: SOF: OF: Add shutdown callback for SOF OF device Pierre-Louis Bossart
2022-04-06 19:40 ` [PATCH 2/4] ASoC: SOF: mediatek: mt8195 add shutdown callback Pierre-Louis Bossart
2022-04-06 19:40 ` [PATCH 3/4] ASoC: SOF: amd: Add psp_mbox_ready() and psp_send_cmd() callback Pierre-Louis Bossart
2022-04-08 8:37 ` Mark Brown
2022-04-06 19:40 ` [PATCH 4/4] ASoC: SOF: amd: Use dedicated MBOX for ACP and PSP communication Pierre-Louis Bossart
2022-04-08 11:24 ` [PATCH 0/4] ASoC: SOF: AMD/Mediatek updates Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.