From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH 3/4] ASoC: Implement runtime PM for WM8994
Date: Fri, 26 Nov 2010 17:23:43 +0000 [thread overview]
Message-ID: <1290792224-21758-3-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1290792224-21758-1-git-send-email-broonie@opensource.wolfsonmicro.com>
This allows us to communicate our power management state back to the
parent device, allowing it to do a full power down when the device is
idle.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
sound/soc/codecs/wm8994.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 5f203c5..bfd4cf4 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -18,6 +18,7 @@
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <sound/core.h>
@@ -1803,6 +1804,8 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
case SND_SOC_BIAS_STANDBY:
if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
+ pm_runtime_get_sync(codec->dev);
+
/* Tweak DC servo and DSP configuration for
* improved performance. */
if (control->type == WM8994 && wm8994->revision < 4) {
@@ -1878,6 +1881,8 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
WM8994_STARTUP_BIAS_ENA |
WM8994_VMID_BUF_ENA |
WM8994_VMID_RAMP_MASK, 0);
+
+ pm_runtime_put(codec->dev);
}
break;
}
@@ -2780,6 +2785,9 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
wm8994->pdata = dev_get_platdata(codec->dev->parent);
wm8994->codec = codec;
+ pm_runtime_enable(codec->dev);
+ pm_runtime_resume(codec->dev);
+
/* Read our current status back from the chip - we don't want to
* reset as this may interfere with the GPIO or LDO operation. */
for (i = 0; i < WM8994_CACHE_SIZE; i++) {
@@ -2995,6 +3003,8 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec)
wm8994_set_bias_level(codec, SND_SOC_BIAS_OFF);
+ pm_runtime_disable(codec->dev);
+
switch (control->type) {
case WM8994:
wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_SHRT,
--
1.7.1
next prev parent reply other threads:[~2010-11-26 17:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-26 17:23 [PATCH 1/4] ASoC: Convert WM8994 to use soc-cache.c cache functions Mark Brown
2010-11-26 17:23 ` [PATCH 2/4] ASoC: Enable rbtree compression for WM8994/58 register cache Mark Brown
2010-11-26 17:23 ` Mark Brown [this message]
2010-11-26 17:23 ` [PATCH 4/4] ASoC: Use DC servo startup mode when not doing DCS correction Mark Brown
2010-11-26 18:01 ` [PATCH 1/4] ASoC: Convert WM8994 to use soc-cache.c cache functions Liam Girdwood
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1290792224-21758-3-git-send-email-broonie@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=alsa-devel@alsa-project.org \
--cc=lrg@slimlogic.co.uk \
--cc=patches@opensource.wolfsonmicro.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox