diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-02-12 13:37:03 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-02-14 21:13:06 -0500 |
commit | da157875cd6f3f282b9404e35d1507d8bbbd4c34 (patch) | |
tree | 46c7a7f90da8eed5f0139430299f0743601c0eb2 /sound/soc/codecs/wm9081.c | |
parent | 68fcde97e42af0ddd4a3665aeec0f5286577f0b5 (diff) |
ASoC: wm9081: Use idle_bias_off
The main role of the WM9081 is as a class D speaker amplifier so there
is no concern about pops. There are also very few registers and a fast
power up time so we can happily mark the driver as idle_bias_off.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm9081.c')
-rw-r--r-- | sound/soc/codecs/wm9081.c | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index c4b3fd923f28..076c126ed9b1 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c | |||
@@ -824,6 +824,8 @@ static const struct snd_soc_dapm_route wm9081_audio_paths[] = { | |||
824 | static int wm9081_set_bias_level(struct snd_soc_codec *codec, | 824 | static int wm9081_set_bias_level(struct snd_soc_codec *codec, |
825 | enum snd_soc_bias_level level) | 825 | enum snd_soc_bias_level level) |
826 | { | 826 | { |
827 | struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); | ||
828 | |||
827 | switch (level) { | 829 | switch (level) { |
828 | case SND_SOC_BIAS_ON: | 830 | case SND_SOC_BIAS_ON: |
829 | break; | 831 | break; |
@@ -841,6 +843,9 @@ static int wm9081_set_bias_level(struct snd_soc_codec *codec, | |||
841 | case SND_SOC_BIAS_STANDBY: | 843 | case SND_SOC_BIAS_STANDBY: |
842 | /* Initial cold start */ | 844 | /* Initial cold start */ |
843 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { | 845 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { |
846 | regcache_cache_only(wm9081->regmap, false); | ||
847 | regcache_sync(wm9081->regmap); | ||
848 | |||
844 | /* Disable LINEOUT discharge */ | 849 | /* Disable LINEOUT discharge */ |
845 | snd_soc_update_bits(codec, WM9081_ANTI_POP_CONTROL, | 850 | snd_soc_update_bits(codec, WM9081_ANTI_POP_CONTROL, |
846 | WM9081_LINEOUT_DISCH, 0); | 851 | WM9081_LINEOUT_DISCH, 0); |
@@ -892,6 +897,8 @@ static int wm9081_set_bias_level(struct snd_soc_codec *codec, | |||
892 | snd_soc_update_bits(codec, WM9081_ANTI_POP_CONTROL, | 897 | snd_soc_update_bits(codec, WM9081_ANTI_POP_CONTROL, |
893 | WM9081_LINEOUT_DISCH, | 898 | WM9081_LINEOUT_DISCH, |
894 | WM9081_LINEOUT_DISCH); | 899 | WM9081_LINEOUT_DISCH); |
900 | |||
901 | regcache_cache_only(wm9081->regmap, true); | ||
895 | break; | 902 | break; |
896 | } | 903 | } |
897 | 904 | ||
@@ -1289,38 +1296,15 @@ static int wm9081_remove(struct snd_soc_codec *codec) | |||
1289 | return 0; | 1296 | return 0; |
1290 | } | 1297 | } |
1291 | 1298 | ||
1292 | #ifdef CONFIG_PM | ||
1293 | static int wm9081_suspend(struct snd_soc_codec *codec) | ||
1294 | { | ||
1295 | wm9081_set_bias_level(codec, SND_SOC_BIAS_OFF); | ||
1296 | |||
1297 | return 0; | ||
1298 | } | ||
1299 | |||
1300 | static int wm9081_resume(struct snd_soc_codec *codec) | ||
1301 | { | ||
1302 | struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec); | ||
1303 | |||
1304 | regcache_sync(wm9081->regmap); | ||
1305 | |||
1306 | wm9081_set_bias_level(codec, SND_SOC_BIAS_STANDBY); | ||
1307 | |||
1308 | return 0; | ||
1309 | } | ||
1310 | #else | ||
1311 | #define wm9081_suspend NULL | ||
1312 | #define wm9081_resume NULL | ||
1313 | #endif | ||
1314 | |||
1315 | static struct snd_soc_codec_driver soc_codec_dev_wm9081 = { | 1299 | static struct snd_soc_codec_driver soc_codec_dev_wm9081 = { |
1316 | .probe = wm9081_probe, | 1300 | .probe = wm9081_probe, |
1317 | .remove = wm9081_remove, | 1301 | .remove = wm9081_remove, |
1318 | .suspend = wm9081_suspend, | ||
1319 | .resume = wm9081_resume, | ||
1320 | 1302 | ||
1321 | .set_sysclk = wm9081_set_sysclk, | 1303 | .set_sysclk = wm9081_set_sysclk, |
1322 | .set_bias_level = wm9081_set_bias_level, | 1304 | .set_bias_level = wm9081_set_bias_level, |
1323 | 1305 | ||
1306 | .idle_bias_off = true, | ||
1307 | |||
1324 | .controls = wm9081_snd_controls, | 1308 | .controls = wm9081_snd_controls, |
1325 | .num_controls = ARRAY_SIZE(wm9081_snd_controls), | 1309 | .num_controls = ARRAY_SIZE(wm9081_snd_controls), |
1326 | .dapm_widgets = wm9081_dapm_widgets, | 1310 | .dapm_widgets = wm9081_dapm_widgets, |
@@ -1392,6 +1376,7 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c, | |||
1392 | regmap_update_bits(wm9081->regmap, WM9081_INTERRUPT_CONTROL, | 1376 | regmap_update_bits(wm9081->regmap, WM9081_INTERRUPT_CONTROL, |
1393 | WM9081_IRQ_POL | WM9081_IRQ_OP_CTRL, reg); | 1377 | WM9081_IRQ_POL | WM9081_IRQ_OP_CTRL, reg); |
1394 | 1378 | ||
1379 | regcache_cache_only(wm9081->regmap, true); | ||
1395 | 1380 | ||
1396 | ret = snd_soc_register_codec(&i2c->dev, | 1381 | ret = snd_soc_register_codec(&i2c->dev, |
1397 | &soc_codec_dev_wm9081, &wm9081_dai, 1); | 1382 | &soc_codec_dev_wm9081, &wm9081_dai, 1); |