ASoC: uda134x: Cleanup manual bias level transitions
authorLars-Peter Clausen <lars@metafoo.de>
Sun, 23 Nov 2014 14:04:13 +0000 (15:04 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 24 Nov 2014 18:04:50 +0000 (18:04 +0000)
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.

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/uda134x.c

index 54240f14211fc15b6cf90cfee2b5285ebc5bfba7..4056260a502e245680f9cdce095fb0dfe30d6252 100644 (file)
@@ -518,8 +518,6 @@ static int uda134x_soc_probe(struct snd_soc_codec *codec)
 
        uda134x_reset(codec);
 
-       uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
-
        if (pd->model == UDA134X_UDA1341) {
                widgets = uda1341_dapm_widgets;
                num_widgets = ARRAY_SIZE(uda1341_dapm_widgets);
@@ -571,44 +569,21 @@ static int uda134x_soc_remove(struct snd_soc_codec *codec)
 {
        struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec);
 
-       uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
-       uda134x_set_bias_level(codec, SND_SOC_BIAS_OFF);
-
        kfree(uda134x);
        return 0;
 }
 
-#if defined(CONFIG_PM)
-static int uda134x_soc_suspend(struct snd_soc_codec *codec)
-{
-       uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
-       uda134x_set_bias_level(codec, SND_SOC_BIAS_OFF);
-       return 0;
-}
-
-static int uda134x_soc_resume(struct snd_soc_codec *codec)
-{
-       uda134x_set_bias_level(codec, SND_SOC_BIAS_PREPARE);
-       uda134x_set_bias_level(codec, SND_SOC_BIAS_ON);
-       return 0;
-}
-#else
-#define uda134x_soc_suspend NULL
-#define uda134x_soc_resume NULL
-#endif /* CONFIG_PM */
-
 static struct snd_soc_codec_driver soc_codec_dev_uda134x = {
        .probe =        uda134x_soc_probe,
        .remove =       uda134x_soc_remove,
-       .suspend =      uda134x_soc_suspend,
-       .resume =       uda134x_soc_resume,
        .reg_cache_size = sizeof(uda134x_reg),
        .reg_word_size = sizeof(u8),
        .reg_cache_default = uda134x_reg,
        .reg_cache_step = 1,
        .read = uda134x_read_reg_cache,
-       .write = uda134x_write,
        .set_bias_level = uda134x_set_bias_level,
+       .suspend_bias_off = true,
+
        .dapm_widgets = uda134x_dapm_widgets,
        .num_dapm_widgets = ARRAY_SIZE(uda134x_dapm_widgets),
        .dapm_routes = uda134x_dapm_routes,