aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-05 15:17:06 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-08 09:22:36 +0800
commitf1aac484f705007caf0d7c256a1a29506600cae3 (patch)
tree5b279475aa5332bb21d75aa4c2632525f37ef017 /sound/soc/soc-dapm.c
parentASoC: Use core pm_runtime callbacks for omap-mcpdm (diff)
downloadlinux-dev-f1aac484f705007caf0d7c256a1a29506600cae3.tar.xz
linux-dev-f1aac484f705007caf0d7c256a1a29506600cae3.zip
ASoC: Take a pm_runtime reference on DAPM devices that are enabled
As for PCMs take a runtime power management reference to devices that are in a non-off bias, avoiding the need to do this in individual drivers. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 6bb327e431a5..e174d0811dae 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -39,6 +39,7 @@
#include <linux/platform_device.h>
#include <linux/jiffies.h>
#include <linux/debugfs.h>
+#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <sound/core.h>
#include <sound/pcm.h>
@@ -1206,6 +1207,9 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie)
/* If we're off and we're not supposed to be go into STANDBY */
if (d->bias_level == SND_SOC_BIAS_OFF &&
d->target_bias_level != SND_SOC_BIAS_OFF) {
+ if (d->dev)
+ pm_runtime_get_sync(d->dev);
+
ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_STANDBY);
if (ret != 0)
dev_err(d->dev,
@@ -1245,6 +1249,9 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie)
ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_OFF);
if (ret != 0)
dev_err(d->dev, "Failed to turn off bias: %d\n", ret);
+
+ if (d->dev)
+ pm_runtime_put_sync(d->dev);
}
/* If we just powered up then move to active bias */