Commit 93134842 authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Mark Brown

ASoC: ak4535: Cleanup manual 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: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f114040e
...@@ -373,36 +373,19 @@ static struct snd_soc_dai_driver ak4535_dai = { ...@@ -373,36 +373,19 @@ static struct snd_soc_dai_driver ak4535_dai = {
.ops = &ak4535_dai_ops, .ops = &ak4535_dai_ops,
}; };
static int ak4535_suspend(struct snd_soc_codec *codec)
{
ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
}
static int ak4535_resume(struct snd_soc_codec *codec) static int ak4535_resume(struct snd_soc_codec *codec)
{ {
snd_soc_cache_sync(codec); snd_soc_cache_sync(codec);
ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
return 0; return 0;
} }
static int ak4535_probe(struct snd_soc_codec *codec) static int ak4535_probe(struct snd_soc_codec *codec)
{ {
/* power on device */
ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
snd_soc_add_codec_controls(codec, ak4535_snd_controls, snd_soc_add_codec_controls(codec, ak4535_snd_controls,
ARRAY_SIZE(ak4535_snd_controls)); ARRAY_SIZE(ak4535_snd_controls));
return 0; return 0;
} }
/* power down chip */
static int ak4535_remove(struct snd_soc_codec *codec)
{
ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
}
static const struct regmap_config ak4535_regmap = { static const struct regmap_config ak4535_regmap = {
.reg_bits = 8, .reg_bits = 8,
.val_bits = 8, .val_bits = 8,
...@@ -417,10 +400,10 @@ static const struct regmap_config ak4535_regmap = { ...@@ -417,10 +400,10 @@ static const struct regmap_config ak4535_regmap = {
static struct snd_soc_codec_driver soc_codec_dev_ak4535 = { static struct snd_soc_codec_driver soc_codec_dev_ak4535 = {
.probe = ak4535_probe, .probe = ak4535_probe,
.remove = ak4535_remove,
.suspend = ak4535_suspend,
.resume = ak4535_resume, .resume = ak4535_resume,
.set_bias_level = ak4535_set_bias_level, .set_bias_level = ak4535_set_bias_level,
.suspend_bias_off = true,
.dapm_widgets = ak4535_dapm_widgets, .dapm_widgets = ak4535_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(ak4535_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(ak4535_dapm_widgets),
.dapm_routes = ak4535_audio_map, .dapm_routes = ak4535_audio_map,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment