summary refs log tree commit diff
path: root/sound/soc/sof/pm.c
diff options
context:
space:
mode:
authorDaniel Baluta <daniel.baluta@nxp.com>2020-09-21 13:50:38 +0300
committerMark Brown <broonie@kernel.org>2020-09-21 17:28:10 +0100
commit43437d0417a36bc9174deedce4ecc2c516ffde57 (patch)
tree419a0d811f97e78cfa0bfee5115167b3cd0e9099 /sound/soc/sof/pm.c
parent641088722244f59fed00b68f7f5aaa3d56c1d73d (diff)
downloadlinux-43437d0417a36bc9174deedce4ecc2c516ffde57.tar.gz
ASoC: SOF: pm: Fix prepare callback behavior for OF usecase
On i.MX platforms PM is not managed via ACPI although CONFIG_ACPI
can be set. So, in order to correctly set the system target state
we introduce a flag for platforms that require to use acpi target
states.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.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/20200921105038.2909899-1-kai.vehmanen@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.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c
index a5f7c7f024a1..c83fb6255961 100644
--- a/sound/soc/sof/pm.c
+++ b/sound/soc/sof/pm.c
@@ -305,15 +305,17 @@ EXPORT_SYMBOL(snd_sof_suspend);
 int snd_sof_prepare(struct device *dev)
 {
 	struct snd_sof_dev *sdev = dev_get_drvdata(dev);
+	const struct sof_dev_desc *desc = sdev->pdata->desc;
+
+	/* will suspend to S3 by default */
+	sdev->system_suspend_target = SOF_SUSPEND_S3;
+
+	if (!desc->use_acpi_target_states)
+		return 0;
 
 #if defined(CONFIG_ACPI)
 	if (acpi_target_system_state() == ACPI_STATE_S0)
 		sdev->system_suspend_target = SOF_SUSPEND_S0IX;
-	else
-		sdev->system_suspend_target = SOF_SUSPEND_S3;
-#else
-	/* will suspend to S3 by default */
-	sdev->system_suspend_target = SOF_SUSPEND_S3;
 #endif
 
 	return 0;