]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.4.56/asoc-wm8962-remove-remaining-direct-register-cache-accesses.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.4.56 / asoc-wm8962-remove-remaining-direct-register-cache-accesses.patch
CommitLineData
3d50c1d1
GKH
1From 2e7ee15ced914e109a1a5b6dfcd463d846a13bd5 Mon Sep 17 00:00:00 2001
2From: Nicolin Chen <b42378@freescale.com>
3Date: Fri, 14 Jun 2013 12:34:50 +0800
4Subject: ASoC: wm8962: Remove remaining direct register cache accesses
5
6From: Nicolin Chen <b42378@freescale.com>
7
8commit 2e7ee15ced914e109a1a5b6dfcd463d846a13bd5 upstream.
9
10Also fix return values for headphone switch updates.
11
12Signed-off-by: Nicolin Chen <b42378@freescale.com>
13Signed-off-by: Mark Brown <broonie@linaro.org>
14Signed-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. */