aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-06-30 14:01:09 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-06-30 14:34:09 -0400
commitdf1ef7a38db21a92239c775a28f0c69124c9b454 (patch)
tree01f3c6408d17b4923a68072c1cc9f4b11ff99dbb
parent372a14a4a4db18751cd092aa3fe2a58216a8fc2f (diff)
ASoC: Refresh WM8974 bias configuration
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--sound/soc/codecs/wm8974.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
index d2a36ad256c5..c5d47bcd14a0 100644
--- a/sound/soc/codecs/wm8974.c
+++ b/sound/soc/codecs/wm8974.c
@@ -46,6 +46,9 @@ static const u16 wm8974_reg[WM8974_CACHEREGNUM] = {
46 0x0000, 46 0x0000,
47}; 47};
48 48
49#define WM8974_POWER1_BIASEN 0x08
50#define WM8974_POWER1_BUFIOEN 0x10
51
49struct wm8974_priv { 52struct wm8974_priv {
50 struct snd_soc_codec codec; 53 struct snd_soc_codec codec;
51 u16 reg_cache[WM8974_CACHEREGNUM]; 54 u16 reg_cache[WM8974_CACHEREGNUM];
@@ -528,22 +531,35 @@ static int wm8974_mute(struct snd_soc_dai *dai, int mute)
528static int wm8974_set_bias_level(struct snd_soc_codec *codec, 531static int wm8974_set_bias_level(struct snd_soc_codec *codec,
529 enum snd_soc_bias_level level) 532 enum snd_soc_bias_level level)
530{ 533{
534 u16 power1 = wm8974_read_reg_cache(codec, WM8974_POWER1) & ~0x3;
535
531 switch (level) { 536 switch (level) {
532 case SND_SOC_BIAS_ON: 537 case SND_SOC_BIAS_ON:
533 wm8974_write(codec, WM8974_POWER1, 0x1ff);
534 wm8974_write(codec, WM8974_POWER2, 0x1ff);
535 wm8974_write(codec, WM8974_POWER3, 0x1ff);
536 break;
537 case SND_SOC_BIAS_PREPARE: 538 case SND_SOC_BIAS_PREPARE:
539 power1 |= 0x1; /* VMID 50k */
540 wm8974_write(codec, WM8974_POWER1, power1);
538 break; 541 break;
542
539 case SND_SOC_BIAS_STANDBY: 543 case SND_SOC_BIAS_STANDBY:
544 power1 |= WM8974_POWER1_BIASEN | WM8974_POWER1_BUFIOEN;
545
546 if (codec->bias_level == SND_SOC_BIAS_OFF) {
547 /* Initial cap charge at VMID 5k */
548 wm8974_write(codec, WM8974_POWER1, power1 | 0x3);
549 mdelay(100);
550 }
551
552 power1 |= 0x2; /* VMID 500k */
553 wm8974_write(codec, WM8974_POWER1, power1);
540 break; 554 break;
555
541 case SND_SOC_BIAS_OFF: 556 case SND_SOC_BIAS_OFF:
542 wm8974_write(codec, WM8974_POWER1, 0x0); 557 wm8974_write(codec, WM8974_POWER1, 0);
543 wm8974_write(codec, WM8974_POWER2, 0x0); 558 wm8974_write(codec, WM8974_POWER2, 0);
544 wm8974_write(codec, WM8974_POWER3, 0x0); 559 wm8974_write(codec, WM8974_POWER3, 0);
545 break; 560 break;
546 } 561 }
562
547 codec->bias_level = level; 563 codec->bias_level = level;
548 return 0; 564 return 0;
549} 565}