Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 113697
b: refs/heads/master
c: 09af98b
h: refs/heads/master
i:
  113695: 1a5456a
v: v3
  • Loading branch information
Mark Brown authored and Takashi Iwai committed Oct 13, 2008
1 parent e9f349f commit a8cbf4d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3ab57fbe91994e5d6fb371a34390520c6c905bee
refs/heads/master: 09af98b08f72471ea53efe26494eef0947a6a10d
32 changes: 24 additions & 8 deletions trunk/sound/soc/codecs/wm8510.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ static const u16 wm8510_reg[WM8510_CACHEREGNUM] = {
0x0001,
};

#define WM8510_POWER1_BIASEN 0x08
#define WM8510_POWER1_BUFIOEN 0x10

/*
* read wm8510 register cache
*/
Expand Down Expand Up @@ -526,23 +529,35 @@ static int wm8510_mute(struct snd_soc_dai *dai, int mute)
static int wm8510_set_bias_level(struct snd_soc_codec *codec,
enum snd_soc_bias_level level)
{
u16 power1 = wm8510_read_reg_cache(codec, WM8510_POWER1) & ~0x3;

switch (level) {
case SND_SOC_BIAS_ON:
wm8510_write(codec, WM8510_POWER1, 0x1ff);
wm8510_write(codec, WM8510_POWER2, 0x1ff);
wm8510_write(codec, WM8510_POWER3, 0x1ff);
break;
case SND_SOC_BIAS_PREPARE:
power1 |= 0x1; /* VMID 50k */
wm8510_write(codec, WM8510_POWER1, power1);
break;

case SND_SOC_BIAS_STANDBY:
power1 |= WM8510_POWER1_BIASEN | WM8510_POWER1_BUFIOEN;

if (codec->bias_level == SND_SOC_BIAS_OFF) {
/* Initial cap charge at VMID 5k */
wm8510_write(codec, WM8510_POWER1, power1 | 0x3);
mdelay(100);
}

power1 |= 0x2; /* VMID 500k */
wm8510_write(codec, WM8510_POWER1, power1);
break;

case SND_SOC_BIAS_OFF:
/* everything off, dac mute, inactive */
wm8510_write(codec, WM8510_POWER1, 0x0);
wm8510_write(codec, WM8510_POWER2, 0x0);
wm8510_write(codec, WM8510_POWER3, 0x0);
wm8510_write(codec, WM8510_POWER1, 0);
wm8510_write(codec, WM8510_POWER2, 0);
wm8510_write(codec, WM8510_POWER3, 0);
break;
}

codec->bias_level = level;
return 0;
}
Expand Down Expand Up @@ -640,6 +655,7 @@ static int wm8510_init(struct snd_soc_device *socdev)
}

/* power on device */
codec->bias_level = SND_SOC_BIAS_OFF;
wm8510_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
wm8510_add_controls(codec);
wm8510_add_widgets(codec);
Expand Down

0 comments on commit a8cbf4d

Please sign in to comment.