diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-11-23 09:04:13 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-11-24 13:04:50 -0500 |
commit | e03b975506545d21b1daa5c8310b59d66e74919c (patch) | |
tree | 34a0f2b3bbcec4983e846b335c534476dac40171 | |
parent | a6e4599f8d232b5911c46bb16f5a79b86f3dfb75 (diff) |
ASoC: uda134x: 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/uda134x.c | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index 54240f14211f..4056260a502e 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c | |||
@@ -518,8 +518,6 @@ static int uda134x_soc_probe(struct snd_soc_codec *codec) | |||
518 | 518 | ||
519 | uda134x_reset(codec); | 519 | uda134x_reset(codec); |
520 | 520 | ||
521 | uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | ||
522 | |||
523 | if (pd->model == UDA134X_UDA1341) { | 521 | if (pd->model == UDA134X_UDA1341) { |
524 | widgets = uda1341_dapm_widgets; | 522 | widgets = uda1341_dapm_widgets; |
525 | num_widgets = ARRAY_SIZE(uda1341_dapm_widgets); | 523 | num_widgets = ARRAY_SIZE(uda1341_dapm_widgets); |
@@ -571,44 +569,21 @@ static int uda134x_soc_remove(struct snd_soc_codec *codec) | |||
571 | { | 569 | { |
572 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); | 570 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); |
573 | 571 | ||
574 | uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | ||
575 | uda134x_set_bias_level(codec, SND_SOC_BIAS_OFF); | ||
576 | |||
577 | kfree(uda134x); | 572 | kfree(uda134x); |
578 | return 0; | 573 | return 0; |
579 | } | 574 | } |
580 | 575 | ||
581 | #if defined(CONFIG_PM) | ||
582 | static int uda134x_soc_suspend(struct snd_soc_codec *codec) | ||
583 | { | ||
584 | uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | ||
585 | uda134x_set_bias_level(codec, SND_SOC_BIAS_OFF); | ||
586 | return 0; | ||
587 | } | ||
588 | |||
589 | static int uda134x_soc_resume(struct snd_soc_codec *codec) | ||
590 | { | ||
591 | uda134x_set_bias_level(codec, SND_SOC_BIAS_PREPARE); | ||
592 | uda134x_set_bias_level(codec, SND_SOC_BIAS_ON); | ||
593 | return 0; | ||
594 | } | ||
595 | #else | ||
596 | #define uda134x_soc_suspend NULL | ||
597 | #define uda134x_soc_resume NULL | ||
598 | #endif /* CONFIG_PM */ | ||
599 | |||
600 | static struct snd_soc_codec_driver soc_codec_dev_uda134x = { | 576 | static struct snd_soc_codec_driver soc_codec_dev_uda134x = { |
601 | .probe = uda134x_soc_probe, | 577 | .probe = uda134x_soc_probe, |
602 | .remove = uda134x_soc_remove, | 578 | .remove = uda134x_soc_remove, |
603 | .suspend = uda134x_soc_suspend, | ||
604 | .resume = uda134x_soc_resume, | ||
605 | .reg_cache_size = sizeof(uda134x_reg), | 579 | .reg_cache_size = sizeof(uda134x_reg), |
606 | .reg_word_size = sizeof(u8), | 580 | .reg_word_size = sizeof(u8), |
607 | .reg_cache_default = uda134x_reg, | 581 | .reg_cache_default = uda134x_reg, |
608 | .reg_cache_step = 1, | 582 | .reg_cache_step = 1, |
609 | .read = uda134x_read_reg_cache, | 583 | .read = uda134x_read_reg_cache, |
610 | .write = uda134x_write, | ||
611 | .set_bias_level = uda134x_set_bias_level, | 584 | .set_bias_level = uda134x_set_bias_level, |
585 | .suspend_bias_off = true, | ||
586 | |||
612 | .dapm_widgets = uda134x_dapm_widgets, | 587 | .dapm_widgets = uda134x_dapm_widgets, |
613 | .num_dapm_widgets = ARRAY_SIZE(uda134x_dapm_widgets), | 588 | .num_dapm_widgets = ARRAY_SIZE(uda134x_dapm_widgets), |
614 | .dapm_routes = uda134x_dapm_routes, | 589 | .dapm_routes = uda134x_dapm_routes, |