diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-09-06 08:29:35 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-09-06 08:38:07 -0400 |
commit | e649057a41c24b4122e976746649e471709d4b16 (patch) | |
tree | 45fcea4e8a11b1f5475f0a0f6f5a4bbb903cdba5 | |
parent | 35199a7c11d5f6a87a5b35dfd69fde3f65d37fac (diff) |
ASoC: sgtl5000: 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>
-rw-r--r-- | sound/soc/codecs/sgtl5000.c | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index e997d271728d..a604a225a8a3 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
@@ -1073,26 +1073,6 @@ static bool sgtl5000_readable(struct device *dev, unsigned int reg) | |||
1073 | } | 1073 | } |
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | #ifdef CONFIG_SUSPEND | ||
1077 | static int sgtl5000_suspend(struct snd_soc_codec *codec) | ||
1078 | { | ||
1079 | sgtl5000_set_bias_level(codec, SND_SOC_BIAS_OFF); | ||
1080 | |||
1081 | return 0; | ||
1082 | } | ||
1083 | |||
1084 | static int sgtl5000_resume(struct snd_soc_codec *codec) | ||
1085 | { | ||
1086 | /* Bring the codec back up to standby to enable regulators */ | ||
1087 | sgtl5000_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | ||
1088 | |||
1089 | return 0; | ||
1090 | } | ||
1091 | #else | ||
1092 | #define sgtl5000_suspend NULL | ||
1093 | #define sgtl5000_resume NULL | ||
1094 | #endif /* CONFIG_SUSPEND */ | ||
1095 | |||
1096 | /* | 1076 | /* |
1097 | * sgtl5000 has 3 internal power supplies: | 1077 | * sgtl5000 has 3 internal power supplies: |
1098 | * 1. VAG, normally set to vdda/2 | 1078 | * 1. VAG, normally set to vdda/2 |
@@ -1352,11 +1332,6 @@ static int sgtl5000_probe(struct snd_soc_codec *codec) | |||
1352 | */ | 1332 | */ |
1353 | snd_soc_write(codec, SGTL5000_DAP_CTRL, 0); | 1333 | snd_soc_write(codec, SGTL5000_DAP_CTRL, 0); |
1354 | 1334 | ||
1355 | /* leading to standby state */ | ||
1356 | ret = sgtl5000_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | ||
1357 | if (ret) | ||
1358 | goto err; | ||
1359 | |||
1360 | return 0; | 1335 | return 0; |
1361 | 1336 | ||
1362 | err: | 1337 | err: |
@@ -1373,8 +1348,6 @@ static int sgtl5000_remove(struct snd_soc_codec *codec) | |||
1373 | { | 1348 | { |
1374 | struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); | 1349 | struct sgtl5000_priv *sgtl5000 = snd_soc_codec_get_drvdata(codec); |
1375 | 1350 | ||
1376 | sgtl5000_set_bias_level(codec, SND_SOC_BIAS_OFF); | ||
1377 | |||
1378 | regulator_bulk_disable(ARRAY_SIZE(sgtl5000->supplies), | 1351 | regulator_bulk_disable(ARRAY_SIZE(sgtl5000->supplies), |
1379 | sgtl5000->supplies); | 1352 | sgtl5000->supplies); |
1380 | regulator_bulk_free(ARRAY_SIZE(sgtl5000->supplies), | 1353 | regulator_bulk_free(ARRAY_SIZE(sgtl5000->supplies), |
@@ -1387,9 +1360,8 @@ static int sgtl5000_remove(struct snd_soc_codec *codec) | |||
1387 | static struct snd_soc_codec_driver sgtl5000_driver = { | 1360 | static struct snd_soc_codec_driver sgtl5000_driver = { |
1388 | .probe = sgtl5000_probe, | 1361 | .probe = sgtl5000_probe, |
1389 | .remove = sgtl5000_remove, | 1362 | .remove = sgtl5000_remove, |
1390 | .suspend = sgtl5000_suspend, | ||
1391 | .resume = sgtl5000_resume, | ||
1392 | .set_bias_level = sgtl5000_set_bias_level, | 1363 | .set_bias_level = sgtl5000_set_bias_level, |
1364 | .suspend_bias_off = true, | ||
1393 | .controls = sgtl5000_snd_controls, | 1365 | .controls = sgtl5000_snd_controls, |
1394 | .num_controls = ARRAY_SIZE(sgtl5000_snd_controls), | 1366 | .num_controls = ARRAY_SIZE(sgtl5000_snd_controls), |
1395 | .dapm_widgets = sgtl5000_dapm_widgets, | 1367 | .dapm_widgets = sgtl5000_dapm_widgets, |