Skip to content

Commit 696426b

Browse files
ujfalusibardliao
authored andcommitted
ASoC: SOF: Intel: mtl: Power down DSP if it is left enabled in pre_fw_run()
It is expected that the DSP is in power down state when the firmware boot is attempted. If the DSP for any reason was left powered up then the DSP boot will fail since the ROM boot sequence might not be able to run. Make sure that the DSP is off before proceeding to boot it up. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent b11a610 commit 696426b

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

sound/soc/sof/intel/mtl.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,17 @@ int mtl_enable_interrupts(struct snd_sof_dev *sdev, bool enable)
236236
}
237237
EXPORT_SYMBOL_NS(mtl_enable_interrupts, "SND_SOC_SOF_INTEL_MTL");
238238

239+
static bool mtl_dsp_is_enabled(struct snd_sof_dev *sdev)
240+
{
241+
int val;
242+
243+
val = snd_sof_dsp_read(sdev, HDA_DSP_BAR, MTL_HFDSSCS);
244+
if (val & MTL_HFDSSCS_CPA_MASK)
245+
return true;
246+
247+
return false;
248+
}
249+
239250
/* pre fw run operations */
240251
static int mtl_dsp_pre_fw_run(struct snd_sof_dev *sdev)
241252
{
@@ -249,6 +260,18 @@ static int mtl_dsp_pre_fw_run(struct snd_sof_dev *sdev)
249260
u32 dsppwrsts;
250261
const struct sof_intel_dsp_desc *chip;
251262

263+
/* Power down the DSP if it is left enabled to ensure clean boot state */
264+
if (mtl_dsp_is_enabled(sdev)) {
265+
dev_dbg(sdev->dev, "powering down DSP first\n");
266+
267+
ret = mtl_power_down_dsp(sdev);
268+
if (ret < 0) {
269+
dev_warn(sdev->dev,
270+
"%s: failed to power down already-enabled DSP\n", __func__);
271+
/* Continue anyway to attempt recovery */
272+
}
273+
}
274+
252275
chip = get_chip_info(sdev->pdata);
253276
if (chip->hw_ip_version > SOF_INTEL_ACE_2_0) {
254277
dsppwrctl = PTL_HFPWRCTL2;

0 commit comments

Comments
 (0)