Skip to content

Commit b081d85

Browse files
LaurentiuM1234broonie
authored andcommitted
ASoC: SOF: imx8: add core shutdown operation for imx8/imx8x
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 <[email protected]> Reviewed-by: Daniel Baluta <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 13b86ea commit b081d85

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

sound/soc/sof/imx/imx8.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ struct imx8m_chip_data {
4040
struct reset_control *run_stall;
4141
};
4242

43+
static int imx8_shutdown(struct snd_sof_dev *sdev)
44+
{
45+
/*
46+
* Force the DSP to stall. After the firmware image is loaded,
47+
* the stall will be removed during run() by a matching
48+
* imx_sc_pm_cpu_start() call.
49+
*/
50+
imx_sc_pm_cpu_start(get_chip_pdata(sdev), IMX_SC_R_DSP, false,
51+
RESET_VECTOR_VADDR);
52+
53+
return 0;
54+
}
55+
4356
/*
4457
* DSP control.
4558
*/
@@ -281,11 +294,13 @@ static int imx8_ops_init(struct snd_sof_dev *sdev)
281294
static const struct imx_chip_ops imx8_chip_ops = {
282295
.probe = imx8_probe,
283296
.core_kick = imx8_run,
297+
.core_shutdown = imx8_shutdown,
284298
};
285299

286300
static const struct imx_chip_ops imx8x_chip_ops = {
287301
.probe = imx8_probe,
288302
.core_kick = imx8x_run,
303+
.core_shutdown = imx8_shutdown,
289304
};
290305

291306
static const struct imx_chip_ops imx8m_chip_ops = {

0 commit comments

Comments
 (0)