ASoC: rt5640: Power down LDO while suspended
authorMark Brown <broonie@linaro.org>
Wed, 16 Oct 2013 16:26:22 +0000 (17:26 +0100)
committerMark Brown <broonie@linaro.org>
Sat, 19 Oct 2013 20:24:30 +0000 (21:24 +0100)
If we have control over the LDO then disable it during suspend; the device
is already being put into reset so will be non-functional over suspend
anyway and this will save a small amount of power.

Signed-off-by: Mark Brown <broonie@linaro.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
sound/soc/codecs/rt5640.c

index 641eeeb00c5c4170ca9fff1307337d02f1532163..b0cde92be7ebe5f19e3a023f8dce8353cf778d86 100644 (file)
@@ -1979,12 +1979,20 @@ static int rt5640_suspend(struct snd_soc_codec *codec)
        rt5640_reset(codec);
        regcache_cache_only(rt5640->regmap, true);
        regcache_mark_dirty(rt5640->regmap);
+       if (gpio_is_valid(rt5640->pdata.ldo1_en))
+               gpio_set_value_cansleep(rt5640->pdata.ldo1_en, 0);
 
        return 0;
 }
 
 static int rt5640_resume(struct snd_soc_codec *codec)
 {
+       struct rt5640_priv *rt5640 = snd_soc_codec_get_drvdata(codec);
+
+       if (gpio_is_valid(rt5640->pdata.ldo1_en)) {
+               gpio_set_value_cansleep(rt5640->pdata.ldo1_en, 1);
+               msleep(400);
+       }
        rt5640_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
 
        return 0;