summaryrefslogtreecommitdiff
path: root/sound/soc/sof/pm.c
diff options
context:
space:
mode:
authorKeyon Jie <yang.jie@linux.intel.com>2019-10-26 01:41:17 +0300
committerMark Brown <broonie@kernel.org>2019-10-28 17:45:33 +0300
commit0b50b3b1c3bc2a2c9eeab418b3de3e60e0530cf4 (patch)
tree0870669fceacc91436882c7d1d0a4cedab8de54c /sound/soc/sof/pm.c
parent4cd933abd4820da7eefe672ff439b32d199a07be (diff)
downloadlinux-0b50b3b1c3bc2a2c9eeab418b3de3e60e0530cf4.tar.xz
ASoC: SOF: PM: implement prepare/complete callbacks
Implement the prepare() and complete() callbacks for power management, initialize s0_suspend flag at prepare(), and reset it at complete(). Signed-off-by: Keyon Jie <yang.jie@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20191025224122.7718-22-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/pm.c')
-rw-r--r--sound/soc/sof/pm.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c
index 584241e9734a..99e4e6ffff74 100644
--- a/sound/soc/sof/pm.c
+++ b/sound/soc/sof/pm.c
@@ -439,3 +439,26 @@ int snd_sof_suspend(struct device *dev)
return sof_suspend(dev, false);
}
EXPORT_SYMBOL(snd_sof_suspend);
+
+int snd_sof_prepare(struct device *dev)
+{
+ struct snd_sof_dev *sdev = dev_get_drvdata(dev);
+
+#if defined(CONFIG_ACPI)
+ sdev->s0_suspend = acpi_target_system_state() == ACPI_STATE_S0;
+#else
+ /* will suspend to S3 by default */
+ sdev->s0_suspend = false;
+#endif
+
+ return 0;
+}
+EXPORT_SYMBOL(snd_sof_prepare);
+
+void snd_sof_complete(struct device *dev)
+{
+ struct snd_sof_dev *sdev = dev_get_drvdata(dev);
+
+ sdev->s0_suspend = false;
+}
+EXPORT_SYMBOL(snd_sof_complete);