* [PATCH] ASoC: SOF: imx8: add core shutdown operation for imx8/imx8x
@ 2025-06-13 19:43 Laurentiu Mihalcea
2025-06-16 7:33 ` Daniel Baluta
2025-06-16 15:50 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Laurentiu Mihalcea @ 2025-06-13 19:43 UTC (permalink / raw)
To: Liam Girdwood, Peter Ujfalusi, Bard Liao, Ranjani Sridharan,
Daniel Baluta, Mark Brown
Cc: linux-sound, imx, linux-arm-kernel, linux-kernel
From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Currently, the DSP core from i.MX8QM/i.MX8QXP is able to operate while the
firmware image is being loaded. Because of this, the DSP may change the
content of the firmware data just after it was loaded, thus leading to the
data having unexpected values when the DSP is reset (via run()).
Fix this by implementing the core_shutdown() operation that will put the
DSP in stall during suspend(). The stall will be removed during the run()
opertion, thus guaranteeing that the DSP core will not be able to run
while the firmware image is being loaded.
Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
---
sound/soc/sof/imx/imx8.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/sound/soc/sof/imx/imx8.c b/sound/soc/sof/imx/imx8.c
index a40a8047873e..b73dd91bd529 100644
--- a/sound/soc/sof/imx/imx8.c
+++ b/sound/soc/sof/imx/imx8.c
@@ -40,6 +40,19 @@ struct imx8m_chip_data {
struct reset_control *run_stall;
};
+static int imx8_shutdown(struct snd_sof_dev *sdev)
+{
+ /*
+ * Force the DSP to stall. After the firmware image is loaded,
+ * the stall will be removed during run() by a matching
+ * imx_sc_pm_cpu_start() call.
+ */
+ imx_sc_pm_cpu_start(get_chip_pdata(sdev), IMX_SC_R_DSP, false,
+ RESET_VECTOR_VADDR);
+
+ return 0;
+}
+
/*
* DSP control.
*/
@@ -281,11 +294,13 @@ static int imx8_ops_init(struct snd_sof_dev *sdev)
static const struct imx_chip_ops imx8_chip_ops = {
.probe = imx8_probe,
.core_kick = imx8_run,
+ .core_shutdown = imx8_shutdown,
};
static const struct imx_chip_ops imx8x_chip_ops = {
.probe = imx8_probe,
.core_kick = imx8x_run,
+ .core_shutdown = imx8_shutdown,
};
static const struct imx_chip_ops imx8m_chip_ops = {
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: SOF: imx8: add core shutdown operation for imx8/imx8x
2025-06-13 19:43 [PATCH] ASoC: SOF: imx8: add core shutdown operation for imx8/imx8x Laurentiu Mihalcea
@ 2025-06-16 7:33 ` Daniel Baluta
2025-06-16 15:50 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Baluta @ 2025-06-16 7:33 UTC (permalink / raw)
To: Laurentiu Mihalcea
Cc: Liam Girdwood, Peter Ujfalusi, Bard Liao, Ranjani Sridharan,
Daniel Baluta, Mark Brown, linux-sound, imx, linux-arm-kernel,
linux-kernel
On Fri, Jun 13, 2025 at 10:43 PM Laurentiu Mihalcea
<laurentiumihalcea111@gmail.com> wrote:
>
> From: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
>
> Currently, the DSP core from i.MX8QM/i.MX8QXP is able to operate while the
> firmware image is being loaded. Because of this, the DSP may change the
> content of the firmware data just after it was loaded, thus leading to the
> data having unexpected values when the DSP is reset (via run()).
>
> Fix this by implementing the core_shutdown() operation that will put the
> DSP in stall during suspend(). The stall will be removed during the run()
> opertion, thus guaranteeing that the DSP core will not be able to run
> while the firmware image is being loaded.
>
> Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: SOF: imx8: add core shutdown operation for imx8/imx8x
2025-06-13 19:43 [PATCH] ASoC: SOF: imx8: add core shutdown operation for imx8/imx8x Laurentiu Mihalcea
2025-06-16 7:33 ` Daniel Baluta
@ 2025-06-16 15:50 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2025-06-16 15:50 UTC (permalink / raw)
To: Liam Girdwood, Peter Ujfalusi, Bard Liao, Ranjani Sridharan,
Daniel Baluta, Laurentiu Mihalcea
Cc: linux-sound, imx, linux-arm-kernel, linux-kernel
On Fri, 13 Jun 2025 15:43:10 -0400, Laurentiu Mihalcea wrote:
> Currently, the DSP core from i.MX8QM/i.MX8QXP is able to operate while the
> firmware image is being loaded. Because of this, the DSP may change the
> content of the firmware data just after it was loaded, thus leading to the
> data having unexpected values when the DSP is reset (via run()).
>
> Fix this by implementing the core_shutdown() operation that will put the
> DSP in stall during suspend(). The stall will be removed during the run()
> opertion, thus guaranteeing that the DSP core will not be able to run
> while the firmware image is being loaded.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: SOF: imx8: add core shutdown operation for imx8/imx8x
commit: b081d8564e4a396843a78788476fdcbf70efed06
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] 3+ messages in thread
end of thread, other threads:[~2025-06-16 15:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-13 19:43 [PATCH] ASoC: SOF: imx8: add core shutdown operation for imx8/imx8x Laurentiu Mihalcea
2025-06-16 7:33 ` Daniel Baluta
2025-06-16 15:50 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).