diff options
author | Nicolin Chen <b42378@freescale.com> | 2013-06-14 00:34:50 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-06-14 05:13:53 -0400 |
commit | 2e7ee15ced914e109a1a5b6dfcd463d846a13bd5 (patch) | |
tree | bff25721beec92469c2c39c59f278b244d882680 | |
parent | 317ddd256b9c24b0d78fa8018f80f1e495481a10 (diff) |
ASoC: wm8962: Remove remaining direct register cache accesses
Also fix return values for headphone switch updates.
Signed-off-by: Nicolin Chen <b42378@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org
-rw-r--r-- | sound/soc/codecs/wm8962.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index e9710280e5e1..730dd0c0f0ab 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. */ |