Skip to content

Commit

Permalink
ASoC: SOF: pm: Tear down pipelines only if DSP was active
Browse files Browse the repository at this point in the history
commit 0b186bb upstream.

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 <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20230405092655.19587-1-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
dbaluta authored and gregkh committed Apr 26, 2023
1 parent b528537 commit 7a6593b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sound/soc/sof/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend)
const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
pm_message_t pm_state;
u32 target_state = snd_sof_dsp_power_target(sdev);
u32 old_state = sdev->dsp_power_state.state;
int ret;

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

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

if (sdev->fw_state != SOF_FW_BOOT_COMPLETE)
Expand Down

0 comments on commit 7a6593b

Please sign in to comment.