[PATCH] ASoC: SOF: pm: Tear down pipelines only if DSP was active
From: Daniel Baluta daniel.baluta@nxp.com
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: d185e0689abc ("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 --- sound/soc/sof/pm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c index c74ce8d414e7..2fdbc53ca715 100644 --- a/sound/soc/sof/pm.c +++ b/sound/soc/sof/pm.c @@ -188,6 +188,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, 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 */ @@ -197,7 +198,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)
On Wed, Apr 05, 2023 at 12:26:55PM +0300, Daniel Baluta wrote:
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.
That's not a property of DT, it's a property of whatever integration is being described by DT.
On Wed, 05 Apr 2023 12:26:55 +0300, Daniel Baluta wrote:
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).
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: SOF: pm: Tear down pipelines only if DSP was active commit: 0b186bb06198653d74a141902a7739e0bde20cf4
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
participants (2)
-
Daniel Baluta
-
Mark Brown