diff mbox series

[SRU,H/OEM-5.10,v2,5/6] UBUNTU: SAUCE: ASoC: SOF: Intel: TGL: set shutdown callback to hda_dsp_shutdown

Message ID 20210318043918.9900-6-hui.wang@canonical.com
State New
Headers show
Series power off stress test will hang on the TGL machines | expand

Commit Message

Hui Wang March 18, 2021, 4:39 a.m. UTC
From: Libin Yang <libin.yang@intel.com>

BugLink: https://bugs.launchpad.net/bugs/1919930

According to hardware spec and PMC FW requirement, the DSP must be
in D3 state before entering S5. Define the shutdown function to use
snd_sof_suspend as shutdown callback to make sure DSP is in D3 state.

Fixes: 44a4cfad8d78 ("ASoC: SOF: Intel: tgl: do thorough remove at .shutdown() callback")
Signed-off-by: Pan Xiuli <xiuli.pan@linux.intel.com>
Signed-off-by: Libin Yang <libin.yang@intel.com>
(cherry picked from commit 31627609bbf60163317832644a241f6dc1f3e9b6
git://github.com/thesofproject/linux.git topic/sof-dev)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
 sound/soc/sof/intel/hda-dsp.c | 6 ++++++
 sound/soc/sof/intel/hda.h     | 1 +
 sound/soc/sof/intel/tgl.c     | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c
index 1799fc56a3e4..28c51e5923ab 100644
--- a/sound/soc/sof/intel/hda-dsp.c
+++ b/sound/soc/sof/intel/hda-dsp.c
@@ -885,6 +885,12 @@  int hda_dsp_suspend(struct snd_sof_dev *sdev, u32 target_state)
 	return snd_sof_dsp_set_power_state(sdev, &target_dsp_state);
 }
 
+int hda_dsp_shutdown(struct snd_sof_dev *sdev)
+{
+	sdev->system_suspend_target = SOF_SUSPEND_S3;
+	return snd_sof_suspend(sdev->dev);
+}
+
 int hda_dsp_set_hw_params_upon_resume(struct snd_sof_dev *sdev)
 {
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_HDA)
diff --git a/sound/soc/sof/intel/hda.h b/sound/soc/sof/intel/hda.h
index a3b6f3e9121c..010577885913 100644
--- a/sound/soc/sof/intel/hda.h
+++ b/sound/soc/sof/intel/hda.h
@@ -512,6 +512,7 @@  int hda_dsp_resume(struct snd_sof_dev *sdev);
 int hda_dsp_runtime_suspend(struct snd_sof_dev *sdev);
 int hda_dsp_runtime_resume(struct snd_sof_dev *sdev);
 int hda_dsp_runtime_idle(struct snd_sof_dev *sdev);
+int hda_dsp_shutdown(struct snd_sof_dev *sdev);
 int hda_dsp_set_hw_params_upon_resume(struct snd_sof_dev *sdev);
 void hda_dsp_dump_skl(struct snd_sof_dev *sdev, u32 flags);
 void hda_dsp_dump(struct snd_sof_dev *sdev, u32 flags);
diff --git a/sound/soc/sof/intel/tgl.c b/sound/soc/sof/intel/tgl.c
index 419f05ba1920..3e46fac53f78 100644
--- a/sound/soc/sof/intel/tgl.c
+++ b/sound/soc/sof/intel/tgl.c
@@ -25,7 +25,7 @@  const struct snd_sof_dsp_ops sof_tgl_ops = {
 	/* probe/remove/shutdown */
 	.probe		= hda_dsp_probe,
 	.remove		= hda_dsp_remove,
-	.shutdown	= hda_dsp_remove,
+	.shutdown	= hda_dsp_shutdown,
 
 	/* Register IO */
 	.write		= sof_io_write,