aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-06-17 12:20:12 -0400
committerMark Brown <broonie@linaro.org>2013-06-17 12:20:12 -0400
commitc38a881ebbb15c3b1832adaad844e7ce73503f4f (patch)
treec9d63d5f9697fc1bf828c1b531415ec46ca95d80
parenta87c863c7b8e05874887347397b0c687b31d12b8 (diff)
parentf5055f93733730b61a8a69dedbb216e6b4dd84c5 (diff)
Merge remote-tracking branch 'asoc/fix/wm8962' into asoc-linus
-rw-r--r--sound/soc/codecs/wm8962.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index e9710280e5e1..4b7915bec2f1 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -1600,7 +1600,6 @@ static int wm8962_put_hp_sw(struct snd_kcontrol *kcontrol,
1600 struct snd_ctl_elem_value *ucontrol) 1600 struct snd_ctl_elem_value *ucontrol)
1601{ 1601{
1602 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 1602 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
1603 u16 *reg_cache = codec->reg_cache;
1604 int ret; 1603 int ret;
1605 1604
1606 /* Apply the update (if any) */ 1605 /* Apply the update (if any) */
@@ -1609,16 +1608,19 @@ static int wm8962_put_hp_sw(struct snd_kcontrol *kcontrol,
1609 return 0; 1608 return 0;
1610 1609
1611 /* If the left PGA is enabled hit that VU bit... */ 1610 /* If the left PGA is enabled hit that VU bit... */
1612 if (snd_soc_read(codec, WM8962_PWR_MGMT_2) & WM8962_HPOUTL_PGA_ENA) 1611 ret = snd_soc_read(codec, WM8962_PWR_MGMT_2);
1613 return snd_soc_write(codec, WM8962_HPOUTL_VOLUME, 1612 if (ret & WM8962_HPOUTL_PGA_ENA) {
1614 reg_cache[WM8962_HPOUTL_VOLUME]); 1613 snd_soc_write(codec, WM8962_HPOUTL_VOLUME,
1614 snd_soc_read(codec, WM8962_HPOUTL_VOLUME));
1615 return 1;
1616 }
1615 1617
1616 /* ...otherwise the right. The VU is stereo. */ 1618 /* ...otherwise the right. The VU is stereo. */
1617 if (snd_soc_read(codec, WM8962_PWR_MGMT_2) & WM8962_HPOUTR_PGA_ENA) 1619 if (ret & WM8962_HPOUTR_PGA_ENA)
1618 return snd_soc_write(codec, WM8962_HPOUTR_VOLUME, 1620 snd_soc_write(codec, WM8962_HPOUTR_VOLUME,
1619 reg_cache[WM8962_HPOUTR_VOLUME]); 1621 snd_soc_read(codec, WM8962_HPOUTR_VOLUME));
1620 1622
1621 return 0; 1623 return 1;
1622} 1624}
1623 1625
1624/* The VU bits for the speakers are in a different register to the mute 1626/* The VU bits for the speakers are in a different register to the mute
@@ -3374,7 +3376,6 @@ static int wm8962_probe(struct snd_soc_codec *codec)
3374 int ret; 3376 int ret;
3375 struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); 3377 struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
3376 struct wm8962_pdata *pdata = dev_get_platdata(codec->dev); 3378 struct wm8962_pdata *pdata = dev_get_platdata(codec->dev);
3377 u16 *reg_cache = codec->reg_cache;
3378 int i, trigger, irq_pol; 3379 int i, trigger, irq_pol;
3379 bool dmicclk, dmicdat; 3380 bool dmicclk, dmicdat;
3380 3381
@@ -3432,8 +3433,9 @@ static int wm8962_probe(struct snd_soc_codec *codec)
3432 3433
3433 /* Put the speakers into mono mode? */ 3434 /* Put the speakers into mono mode? */
3434 if (pdata->spk_mono) 3435 if (pdata->spk_mono)
3435 reg_cache[WM8962_CLASS_D_CONTROL_2] 3436 snd_soc_update_bits(codec, WM8962_CLASS_D_CONTROL_2,
3436 |= WM8962_SPK_MONO; 3437 WM8962_SPK_MONO_MASK, WM8962_SPK_MONO);
3438
3437 3439
3438 /* Micbias setup, detection enable and detection 3440 /* Micbias setup, detection enable and detection
3439 * threasholds. */ 3441 * threasholds. */
@@ -3721,6 +3723,17 @@ static int wm8962_runtime_resume(struct device *dev)
3721 3723
3722 regcache_sync(wm8962->regmap); 3724 regcache_sync(wm8962->regmap);
3723 3725
3726 regmap_update_bits(wm8962->regmap, WM8962_ANTI_POP,
3727 WM8962_STARTUP_BIAS_ENA | WM8962_VMID_BUF_ENA,
3728 WM8962_STARTUP_BIAS_ENA | WM8962_VMID_BUF_ENA);
3729
3730 /* Bias enable at 2*5k (fast start-up) */
3731 regmap_update_bits(wm8962->regmap, WM8962_PWR_MGMT_1,
3732 WM8962_BIAS_ENA | WM8962_VMID_SEL_MASK,
3733 WM8962_BIAS_ENA | 0x180);
3734
3735 msleep(5);
3736
3724 return 0; 3737 return 0;
3725} 3738}
3726 3739