diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-11-26 12:23:43 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-11-27 05:32:14 -0500 |
commit | 39fb51a123c125e36e9bcb67686b3e2945784250 (patch) | |
tree | 6406dea4ae13d45077fe39e40c6b5c90b2ccabad /sound/soc/codecs/wm8994.c | |
parent | 2e19b0c8c21cb06eb5b902588c30ae0529ce8ec3 (diff) |
ASoC: Implement runtime PM for WM8994/58
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>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/codecs/wm8994.c')
-rw-r--r-- | 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 5f203c545e00..bfd4cf4fde5f 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
19 | #include <linux/i2c.h> | 19 | #include <linux/i2c.h> |
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/pm_runtime.h> | ||
21 | #include <linux/regulator/consumer.h> | 22 | #include <linux/regulator/consumer.h> |
22 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
23 | #include <sound/core.h> | 24 | #include <sound/core.h> |
@@ -1803,6 +1804,8 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, | |||
1803 | 1804 | ||
1804 | case SND_SOC_BIAS_STANDBY: | 1805 | case SND_SOC_BIAS_STANDBY: |
1805 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 1806 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { |
1807 | pm_runtime_get_sync(codec->dev); | ||
1808 | |||
1806 | /* Tweak DC servo and DSP configuration for | 1809 | /* Tweak DC servo and DSP configuration for |
1807 | * improved performance. */ | 1810 | * improved performance. */ |
1808 | if (control->type == WM8994 && wm8994->revision < 4) { | 1811 | if (control->type == WM8994 && wm8994->revision < 4) { |
@@ -1878,6 +1881,8 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec, | |||
1878 | WM8994_STARTUP_BIAS_ENA | | 1881 | WM8994_STARTUP_BIAS_ENA | |
1879 | WM8994_VMID_BUF_ENA | | 1882 | WM8994_VMID_BUF_ENA | |
1880 | WM8994_VMID_RAMP_MASK, 0); | 1883 | WM8994_VMID_RAMP_MASK, 0); |
1884 | |||
1885 | pm_runtime_put(codec->dev); | ||
1881 | } | 1886 | } |
1882 | break; | 1887 | break; |
1883 | } | 1888 | } |
@@ -2780,6 +2785,9 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
2780 | wm8994->pdata = dev_get_platdata(codec->dev->parent); | 2785 | wm8994->pdata = dev_get_platdata(codec->dev->parent); |
2781 | wm8994->codec = codec; | 2786 | wm8994->codec = codec; |
2782 | 2787 | ||
2788 | pm_runtime_enable(codec->dev); | ||
2789 | pm_runtime_resume(codec->dev); | ||
2790 | |||
2783 | /* Read our current status back from the chip - we don't want to | 2791 | /* Read our current status back from the chip - we don't want to |
2784 | * reset as this may interfere with the GPIO or LDO operation. */ | 2792 | * reset as this may interfere with the GPIO or LDO operation. */ |
2785 | for (i = 0; i < WM8994_CACHE_SIZE; i++) { | 2793 | for (i = 0; i < WM8994_CACHE_SIZE; i++) { |
@@ -2995,6 +3003,8 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec) | |||
2995 | 3003 | ||
2996 | wm8994_set_bias_level(codec, SND_SOC_BIAS_OFF); | 3004 | wm8994_set_bias_level(codec, SND_SOC_BIAS_OFF); |
2997 | 3005 | ||
3006 | pm_runtime_disable(codec->dev); | ||
3007 | |||
2998 | switch (control->type) { | 3008 | switch (control->type) { |
2999 | case WM8994: | 3009 | case WM8994: |
3000 | wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_SHRT, | 3010 | wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_SHRT, |