Skip to contentSkip to conversation

ASoC: SOF: imx8: check imx_sc_pm_cpu_start() return value

PATCH In review Ștefan Ghețu 2 participants 2 messages Sep 2 – Sep 7

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: SOF: imx8: check imx_sc_pm_cpu_start() return value

imx8_run(), imx8x_run() and imx8_shutdown() check the return value of every imx_sc_misc_set_control() call but ignore the one from imx_sc_pm_cpu_start(), which propagates errors from imx_scu_call_rpc() and can fail with -ETIMEDOUT, -EINVAL or -EPERM.

Reporting success after a failed start leaves the caller loading firmware onto a core that is not running, and a failed shutdown is similarly hidden from imx_chip_core_shutdown() callers, which do act on the return value.

Propagate the error, matching imx95_core_shutdown() in imx9.c.

---
 sound/soc/sof/imx/imx8.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)
sound/soc/sof/imx/imx8.c +19 -6
index c2b4d379a3a3a..0820724dbb349 100644
@@ -41,13 +41,18 @@ struct imx8m_chip_data {
 
 static int imx8_shutdown(struct snd_sof_dev *sdev)
 {
+	int ret;
 	/*
 	 * 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);
+	ret = imx_sc_pm_cpu_start(get_chip_pdata(sdev), IMX_SC_R_DSP, false,
+				  RESET_VECTOR_VADDR);
+	if (ret < 0) {
+		dev_err(sdev->dev, "Error stalling DSP core %d\n", ret);
+		return ret;
+	}
 
 	return 0;
 }
@@ -88,8 +93,12 @@ static int imx8x_run(struct snd_sof_dev *sdev)
 		return ret;
 	}
 
-	imx_sc_pm_cpu_start(get_chip_pdata(sdev), IMX_SC_R_DSP, true,
-			    RESET_VECTOR_VADDR);
+	ret = imx_sc_pm_cpu_start(get_chip_pdata(sdev), IMX_SC_R_DSP, true,
+				  RESET_VECTOR_VADDR);
+	if (ret < 0) {
+		dev_err(sdev->dev, "Error starting DSP %d\n", ret);
+		return ret;
+	}
 
 	return 0;
 }
@@ -105,8 +114,12 @@ static int imx8_run(struct snd_sof_dev *sdev)
 		return ret;
 	}
 
-	imx_sc_pm_cpu_start(get_chip_pdata(sdev), IMX_SC_R_DSP, true,
-			    RESET_VECTOR_VADDR);
+	ret = imx_sc_pm_cpu_start(get_chip_pdata(sdev), IMX_SC_R_DSP, true,
+				  RESET_VECTOR_VADDR);
+	if (ret < 0) {
+		dev_err(sdev->dev, "Error starting DSP %d\n", ret);
+		return ret;
+	}
 
 	return 0;
 }
Signature · 1 line
2.53.0
maintainer
#1 lore raw
Quoted 1 line · Ștefan Ghețu

ASoC: SOF: imx8: check imx_sc_pm_cpu_start() return value

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4

Thanks!

[1/1] ASoC: SOF: imx8: check imx_sc_pm_cpu_start() return value

      https://git.kernel.org/broonie/sound/c/88be49b2f848

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