]>
Commit | Line | Data |
---|---|---|
3d50c1d1 GKH |
1 | From 2e7ee15ced914e109a1a5b6dfcd463d846a13bd5 Mon Sep 17 00:00:00 2001 |
2 | From: Nicolin Chen <b42378@freescale.com> | |
3 | Date: Fri, 14 Jun 2013 12:34:50 +0800 | |
4 | Subject: ASoC: wm8962: Remove remaining direct register cache accesses | |
5 | ||
6 | From: Nicolin Chen <b42378@freescale.com> | |
7 | ||
8 | commit 2e7ee15ced914e109a1a5b6dfcd463d846a13bd5 upstream. | |
9 | ||
10 | Also fix return values for headphone switch updates. | |
11 | ||
12 | Signed-off-by: Nicolin Chen <b42378@freescale.com> | |
13 | Signed-off-by: Mark Brown <broonie@linaro.org> | |
14 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
15 | ||
16 | --- | |
17 | sound/soc/codecs/wm8962.c | 24 +++++++++++++----------- | |
18 | 1 file changed, 13 insertions(+), 11 deletions(-) | |
19 | ||
20 | --- a/sound/soc/codecs/wm8962.c | |
21 | +++ b/sound/soc/codecs/wm8962.c | |
22 | @@ -1599,7 +1599,6 @@ static int wm8962_put_hp_sw(struct snd_k | |
23 | struct snd_ctl_elem_value *ucontrol) | |
24 | { | |
25 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | |
26 | - u16 *reg_cache = codec->reg_cache; | |
27 | int ret; | |
28 | ||
29 | /* Apply the update (if any) */ | |
30 | @@ -1608,16 +1607,19 @@ static int wm8962_put_hp_sw(struct snd_k | |
31 | return 0; | |
32 | ||
33 | /* If the left PGA is enabled hit that VU bit... */ | |
34 | - if (snd_soc_read(codec, WM8962_PWR_MGMT_2) & WM8962_HPOUTL_PGA_ENA) | |
35 | - return snd_soc_write(codec, WM8962_HPOUTL_VOLUME, | |
36 | - reg_cache[WM8962_HPOUTL_VOLUME]); | |
37 | + ret = snd_soc_read(codec, WM8962_PWR_MGMT_2); | |
38 | + if (ret & WM8962_HPOUTL_PGA_ENA) { | |
39 | + snd_soc_write(codec, WM8962_HPOUTL_VOLUME, | |
40 | + snd_soc_read(codec, WM8962_HPOUTL_VOLUME)); | |
41 | + return 1; | |
42 | + } | |
43 | ||
44 | /* ...otherwise the right. The VU is stereo. */ | |
45 | - if (snd_soc_read(codec, WM8962_PWR_MGMT_2) & WM8962_HPOUTR_PGA_ENA) | |
46 | - return snd_soc_write(codec, WM8962_HPOUTR_VOLUME, | |
47 | - reg_cache[WM8962_HPOUTR_VOLUME]); | |
48 | + if (ret & WM8962_HPOUTR_PGA_ENA) | |
49 | + snd_soc_write(codec, WM8962_HPOUTR_VOLUME, | |
50 | + snd_soc_read(codec, WM8962_HPOUTR_VOLUME)); | |
51 | ||
52 | - return 0; | |
53 | + return 1; | |
54 | } | |
55 | ||
56 | /* The VU bits for the speakers are in a different register to the mute | |
57 | @@ -3363,7 +3365,6 @@ static int wm8962_probe(struct snd_soc_c | |
58 | int ret; | |
59 | struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); | |
60 | struct wm8962_pdata *pdata = dev_get_platdata(codec->dev); | |
61 | - u16 *reg_cache = codec->reg_cache; | |
62 | int i, trigger, irq_pol; | |
63 | bool dmicclk, dmicdat; | |
64 | ||
65 | @@ -3421,8 +3422,9 @@ static int wm8962_probe(struct snd_soc_c | |
66 | ||
67 | /* Put the speakers into mono mode? */ | |
68 | if (pdata->spk_mono) | |
69 | - reg_cache[WM8962_CLASS_D_CONTROL_2] | |
70 | - |= WM8962_SPK_MONO; | |
71 | + snd_soc_update_bits(codec, WM8962_CLASS_D_CONTROL_2, | |
72 | + WM8962_SPK_MONO_MASK, WM8962_SPK_MONO); | |
73 | + | |
74 | ||
75 | /* Micbias setup, detection enable and detection | |
76 | * threasholds. */ |