ASoC: alc5632: Cleanup bias level transitions

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>
This commit is contained in:
Lars-Peter Clausen 2014-11-23 13:47:51 +01:00 committed by Mark Brown
parent f114040e3e
commit 5c9dc0898f

View File

@ -1038,23 +1038,15 @@ static struct snd_soc_dai_driver alc5632_dai = {
};
#ifdef CONFIG_PM
static int alc5632_suspend(struct snd_soc_codec *codec)
{
alc5632_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
}
static int alc5632_resume(struct snd_soc_codec *codec)
{
struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
regcache_sync(alc5632->regmap);
alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
return 0;
}
#else
#define alc5632_suspend NULL
#define alc5632_resume NULL
#endif
@ -1062,9 +1054,6 @@ static int alc5632_probe(struct snd_soc_codec *codec)
{
struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
/* power on device */
alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
switch (alc5632->id) {
case 0x5c:
snd_soc_add_codec_controls(codec, alc5632_vol_snd_controls,
@ -1077,19 +1066,12 @@ static int alc5632_probe(struct snd_soc_codec *codec)
return 0;
}
/* power down chip */
static int alc5632_remove(struct snd_soc_codec *codec)
{
alc5632_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
}
static struct snd_soc_codec_driver soc_codec_device_alc5632 = {
.probe = alc5632_probe,
.remove = alc5632_remove,
.suspend = alc5632_suspend,
.resume = alc5632_resume,
.set_bias_level = alc5632_set_bias_level,
.suspend_bias_off = true,
.controls = alc5632_snd_controls,
.num_controls = ARRAY_SIZE(alc5632_snd_controls),
.dapm_widgets = alc5632_dapm_widgets,