ASoC: adav80x: Cleanup manual bias level transitions
authorLars-Peter Clausen <lars@metafoo.de>
Thu, 4 Sep 2014 17:44:10 +0000 (19:44 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 4 Sep 2014 19:10:25 +0000 (20:10 +0100)
Set the CODEC driver's suspend_bias_off flag rather than manually going to
SND_SOC_BIAS_OFF in suspend and SND_SOC_BIAS_STANDBY in resume. This makes
the code a bit shorter and cleaner. While we are at it also remove the
regcache_cache_only() calls from suspend/resume as there shouldn't be any IO
between suspend and resume.

Since the ASoC core now takes care of setting the bias level to
SND_SOC_BIAS_OFF when removing the CODEC there is no need to do it manually
anymore either.

The manual transition to SND_SOC_BIAS_STANDBY at the end of CODEC probe()
can also be removed as the core will automatically do this after the CODEC
has been probed.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/adav80x.c

index c43b93fdf0dfe466e3c72e97eec0c5da5da06ecb..ce3cdca9fc62d7efca27b9904a883decd0341a7f 100644 (file)
@@ -812,42 +812,23 @@ static int adav80x_probe(struct snd_soc_codec *codec)
        /* Disable DAC zero flag */
        regmap_write(adav80x->regmap, ADAV80X_DAC_CTRL3, 0x6);
 
-       return adav80x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
-}
-
-static int adav80x_suspend(struct snd_soc_codec *codec)
-{
-       struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
-       int ret;
-
-       ret = adav80x_set_bias_level(codec, SND_SOC_BIAS_OFF);
-       regcache_cache_only(adav80x->regmap, true);
-
-       return ret;
+       return 0;
 }
 
 static int adav80x_resume(struct snd_soc_codec *codec)
 {
        struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
 
-       regcache_cache_only(adav80x->regmap, false);
-       adav80x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
        regcache_sync(adav80x->regmap);
 
        return 0;
 }
 
-static int adav80x_remove(struct snd_soc_codec *codec)
-{
-       return adav80x_set_bias_level(codec, SND_SOC_BIAS_OFF);
-}
-
 static struct snd_soc_codec_driver adav80x_codec_driver = {
        .probe = adav80x_probe,
-       .remove = adav80x_remove,
-       .suspend = adav80x_suspend,
        .resume = adav80x_resume,
        .set_bias_level = adav80x_set_bias_level,
+       .suspend_bias_off = true,
 
        .set_pll = adav80x_set_pll,
        .set_sysclk = adav80x_set_sysclk,