Merge tag 'sound-6.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[linux-block.git] / sound / soc / sof / pm.c
index c74ce8d414e71a69592b402b34f5de33825fdae9..2fdbc53ca7150b3ad5f597d22705d83fc87ce7c3 100644 (file)
@@ -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)