Commit 8c9ff121 authored by Ranjani Sridharan's avatar Ranjani Sridharan Committed by Mark Brown

ASoC: SOF: topology: fix core enable sequence

Core power up involves 2 steps: The first step tries to
power up the core by setting the ADSPCS.SPA bit for the host-managed
cores. The second step involves sending the IPC to power up other
cores that are not host managed. The enabled_cores_mask should
be updated only when both these steps are successful. If the
IPC to the DSP fails, the host-managed core that was powered in
step 1 should be powered off before returning the error.
Signed-off-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: default avatarRander Wang <rander.wang@linux.intel.com>
Reviewed-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: default avatarKeyon Jie <yang.jie@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20200902140756.1427005-4-kai.vehmanen@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent d1c6c4a9
...@@ -1303,7 +1303,7 @@ static int sof_core_enable(struct snd_sof_dev *sdev, int core) ...@@ -1303,7 +1303,7 @@ static int sof_core_enable(struct snd_sof_dev *sdev, int core)
if (sdev->enabled_cores_mask & BIT(core)) if (sdev->enabled_cores_mask & BIT(core))
return 0; return 0;
/* power up the core */ /* power up the core if it is host managed */
ret = snd_sof_dsp_core_power_up(sdev, BIT(core)); ret = snd_sof_dsp_core_power_up(sdev, BIT(core));
if (ret < 0) { if (ret < 0) {
dev_err(sdev->dev, "error: %d powering up core %d\n", dev_err(sdev->dev, "error: %d powering up core %d\n",
...@@ -1311,16 +1311,24 @@ static int sof_core_enable(struct snd_sof_dev *sdev, int core) ...@@ -1311,16 +1311,24 @@ static int sof_core_enable(struct snd_sof_dev *sdev, int core)
return ret; return ret;
} }
/* update enabled cores mask */ /* Now notify DSP */
sdev->enabled_cores_mask |= BIT(core);
/* Now notify DSP that the core has been powered up */
ret = sof_ipc_tx_message(sdev->ipc, pm_core_config.hdr.cmd, ret = sof_ipc_tx_message(sdev->ipc, pm_core_config.hdr.cmd,
&pm_core_config, sizeof(pm_core_config), &pm_core_config, sizeof(pm_core_config),
&pm_core_config, sizeof(pm_core_config)); &pm_core_config, sizeof(pm_core_config));
if (ret < 0) if (ret < 0) {
dev_err(sdev->dev, "error: core %d enable ipc failure %d\n", dev_err(sdev->dev, "error: core %d enable ipc failure %d\n",
core, ret); core, ret);
goto err;
}
/* update enabled cores mask */
sdev->enabled_cores_mask |= BIT(core);
return ret;
err:
/* power down core if it is host managed and return the original error if this fails too */
if (snd_sof_dsp_core_power_down(sdev, BIT(core)) < 0)
dev_err(sdev->dev, "error: powering down core %d\n", core);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment