diff mbox series

[SRU,H/OEM-5.10,1/6] ASoC: SOF: add .shutdown() callback to snd_sof_dsp_ops

Message ID 20210318034922.7546-2-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, 3:49 a.m. UTC
From: Keyon Jie <yang.jie@linux.intel.com>

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

Add .shutdown() callback to the struct snd_sof_dsp_ops, for
doing platform specific actions at shutdown.

Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20210113152617.4048541-1-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
(cherry picked from commit 7edb3051f11683640c38b93e183ef1676090a79b)
Signed-off-by: Hui Wang <hui.wang@canonical.com>
---
 sound/soc/sof/ops.h      | 8 ++++++++
 sound/soc/sof/sof-priv.h | 4 +++-
 2 files changed, 11 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sound/soc/sof/ops.h b/sound/soc/sof/ops.h
index 95e748b36903..7562097bd7d5 100644
--- a/sound/soc/sof/ops.h
+++ b/sound/soc/sof/ops.h
@@ -37,6 +37,14 @@  static inline int snd_sof_remove(struct snd_sof_dev *sdev)
 	return 0;
 }
 
+static inline int snd_sof_shutdown(struct snd_sof_dev *sdev)
+{
+	if (sof_ops(sdev)->shutdown)
+		return sof_ops(sdev)->shutdown(sdev);
+
+	return 0;
+}
+
 /* control */
 
 /*
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 68da8f797403..8d0c33c6d053 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -98,9 +98,10 @@  struct snd_sof_pdata;
  */
 struct snd_sof_dsp_ops {
 
-	/* probe and remove */
+	/* probe/remove/shutdown */
 	int (*probe)(struct snd_sof_dev *sof_dev); /* mandatory */
 	int (*remove)(struct snd_sof_dev *sof_dev); /* optional */
+	int (*shutdown)(struct snd_sof_dev *sof_dev); /* optional */
 
 	/* DSP core boot / reset */
 	int (*run)(struct snd_sof_dev *sof_dev); /* mandatory */
@@ -460,6 +461,7 @@  struct snd_sof_dev {
 
 int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data);
 int snd_sof_device_remove(struct device *dev);
+int snd_sof_device_shutdown(struct device *dev);
 
 int snd_sof_runtime_suspend(struct device *dev);
 int snd_sof_runtime_resume(struct device *dev);