aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-10-20 04:56:28 -0400
committerMark Brown <broonie@kernel.org>2014-10-22 06:27:45 -0400
commit9313484238ca49fe5c7513dfcb36aaddcea8c298 (patch)
treeb35971c97ec98927590ca3fdbd36d88be541b723
parentf114040e3ea6e07372334ade75d1ee0775c355e1 (diff)
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: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/ak4535.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c
index 30e297890fec..eced46d7d6cb 100644
--- a/sound/soc/codecs/ak4535.c
+++ b/sound/soc/codecs/ak4535.c
@@ -373,36 +373,19 @@ static struct snd_soc_dai_driver ak4535_dai = {
373 .ops = &ak4535_dai_ops, 373 .ops = &ak4535_dai_ops,
374}; 374};
375 375
376static int ak4535_suspend(struct snd_soc_codec *codec)
377{
378 ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF);
379 return 0;
380}
381
382static int ak4535_resume(struct snd_soc_codec *codec) 376static int ak4535_resume(struct snd_soc_codec *codec)
383{ 377{
384 snd_soc_cache_sync(codec); 378 snd_soc_cache_sync(codec);
385 ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
386 return 0; 379 return 0;
387} 380}
388 381
389static int ak4535_probe(struct snd_soc_codec *codec) 382static int ak4535_probe(struct snd_soc_codec *codec)
390{ 383{
391 /* power on device */
392 ak4535_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
393
394 snd_soc_add_codec_controls(codec, ak4535_snd_controls, 384 snd_soc_add_codec_controls(codec, ak4535_snd_controls,
395 ARRAY_SIZE(ak4535_snd_controls)); 385 ARRAY_SIZE(ak4535_snd_controls));
396 return 0; 386 return 0;
397} 387}
398 388
399/* power down chip */
400static int ak4535_remove(struct snd_soc_codec *codec)
401{
402 ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF);
403 return 0;
404}
405
406static const struct regmap_config ak4535_regmap = { 389static const struct regmap_config ak4535_regmap = {
407 .reg_bits = 8, 390 .reg_bits = 8,
408 .val_bits = 8, 391 .val_bits = 8,
@@ -417,10 +400,10 @@ static const struct regmap_config ak4535_regmap = {
417 400
418static struct snd_soc_codec_driver soc_codec_dev_ak4535 = { 401static struct snd_soc_codec_driver soc_codec_dev_ak4535 = {
419 .probe = ak4535_probe, 402 .probe = ak4535_probe,
420 .remove = ak4535_remove,
421 .suspend = ak4535_suspend,
422 .resume = ak4535_resume, 403 .resume = ak4535_resume,
423 .set_bias_level = ak4535_set_bias_level, 404 .set_bias_level = ak4535_set_bias_level,
405 .suspend_bias_off = true,
406
424 .dapm_widgets = ak4535_dapm_widgets, 407 .dapm_widgets = ak4535_dapm_widgets,
425 .num_dapm_widgets = ARRAY_SIZE(ak4535_dapm_widgets), 408 .num_dapm_widgets = ARRAY_SIZE(ak4535_dapm_widgets),
426 .dapm_routes = ak4535_audio_map, 409 .dapm_routes = ak4535_audio_map,