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

ASoC: ssm2602: 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. 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: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0f0cc5a7
...@@ -502,18 +502,11 @@ static struct snd_soc_dai_driver ssm2602_dai = { ...@@ -502,18 +502,11 @@ static struct snd_soc_dai_driver ssm2602_dai = {
.symmetric_samplebits = 1, .symmetric_samplebits = 1,
}; };
static int ssm2602_suspend(struct snd_soc_codec *codec)
{
ssm2602_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
}
static int ssm2602_resume(struct snd_soc_codec *codec) static int ssm2602_resume(struct snd_soc_codec *codec)
{ {
struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec);
regcache_sync(ssm2602->regmap); regcache_sync(ssm2602->regmap);
ssm2602_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
return 0; return 0;
} }
...@@ -586,27 +579,14 @@ static int ssm260x_codec_probe(struct snd_soc_codec *codec) ...@@ -586,27 +579,14 @@ static int ssm260x_codec_probe(struct snd_soc_codec *codec)
break; break;
} }
if (ret) return ret;
return ret;
ssm2602_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
return 0;
}
/* remove everything here */
static int ssm2602_remove(struct snd_soc_codec *codec)
{
ssm2602_set_bias_level(codec, SND_SOC_BIAS_OFF);
return 0;
} }
static struct snd_soc_codec_driver soc_codec_dev_ssm2602 = { static struct snd_soc_codec_driver soc_codec_dev_ssm2602 = {
.probe = ssm260x_codec_probe, .probe = ssm260x_codec_probe,
.remove = ssm2602_remove,
.suspend = ssm2602_suspend,
.resume = ssm2602_resume, .resume = ssm2602_resume,
.set_bias_level = ssm2602_set_bias_level, .set_bias_level = ssm2602_set_bias_level,
.suspend_bias_off = true,
.controls = ssm260x_snd_controls, .controls = ssm260x_snd_controls,
.num_controls = ARRAY_SIZE(ssm260x_snd_controls), .num_controls = ARRAY_SIZE(ssm260x_snd_controls),
......
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