Skip to content

Commit 0b186bb

Browse files
dbalutabroonie
authored andcommitted
ASoC: SOF: pm: Tear down pipelines only if DSP was active
With PCI if the device was suspended it is brought back to full power and then suspended again. This doesn't happen when device is described via DT. We need to make sure that we tear down pipelines only if the device was previously active (thus the pipelines were setup). Otherwise, we can break the use_count: [ 219.009743] sof-audio-of-imx8m 3b6e8000.dsp: sof_ipc3_tear_down_all_pipelines: widget PIPELINE.2.SAI3.IN is still in use: count -1 and after this everything stops working. Fixes: d185e06 ("ASoC: SOF: pm: Always tear down pipelines before DSP suspend") Reviewed-by: Pierre-Louis Bossart <[email protected]> Reviewed-by: Ranjani Sridharan <[email protected]> Signed-off-by: Daniel Baluta <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent de6aa72 commit 0b186bb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

sound/soc/sof/pm.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
183183
const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
184184
pm_message_t pm_state;
185185
u32 target_state = snd_sof_dsp_power_target(sdev);
186+
u32 old_state = sdev->dsp_power_state.state;
186187
int ret;
187188

188189
/* do nothing if dsp suspend callback is not set */
@@ -192,7 +193,12 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
192193
if (runtime_suspend && !sof_ops(sdev)->runtime_suspend)
193194
return 0;
194195

195-
if (tplg_ops && tplg_ops->tear_down_all_pipelines)
196+
/* we need to tear down pipelines only if the DSP hardware is
197+
* active, which happens for PCI devices. if the device is
198+
* suspended, it is brought back to full power and then
199+
* suspended again
200+
*/
201+
if (tplg_ops && tplg_ops->tear_down_all_pipelines && (old_state == SOF_DSP_PM_D0))
196202
tplg_ops->tear_down_all_pipelines(sdev, false);
197203

198204
if (sdev->fw_state != SOF_FW_BOOT_COMPLETE)

0 commit comments

Comments
 (0)