summaryrefslogtreecommitdiffstats
path: root/extras/recipes-kernel/linux/linux-omap/linus/0021-ASoC-codecs-wm8904-Fix-register-cache-incoherency.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap/linus/0021-ASoC-codecs-wm8904-Fix-register-cache-incoherency.patch')
-rw-r--r--extras/recipes-kernel/linux/linux-omap/linus/0021-ASoC-codecs-wm8904-Fix-register-cache-incoherency.patch131
1 files changed, 131 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap/linus/0021-ASoC-codecs-wm8904-Fix-register-cache-incoherency.patch b/extras/recipes-kernel/linux/linux-omap/linus/0021-ASoC-codecs-wm8904-Fix-register-cache-incoherency.patch
new file mode 100644
index 00000000..51363a40
--- /dev/null
+++ b/extras/recipes-kernel/linux/linux-omap/linus/0021-ASoC-codecs-wm8904-Fix-register-cache-incoherency.patch
@@ -0,0 +1,131 @@
1From 2f369c65cdd41f8eda535cd4065edd63346a016b Mon Sep 17 00:00:00 2001
2From: Lars-Peter Clausen <lars@metafoo.de>
3Date: Tue, 28 Dec 2010 21:37:59 +0100
4Subject: [PATCH 21/65] ASoC: codecs: wm8904: Fix register cache incoherency
5
6The multi-component patch(commit f0fba2ad1) moved the allocation of the
7register cache from the driver to the ASoC core. Most drivers where adjusted to
8this, but the wm8904 driver still uses its own register cache for its
9private functions, while functions from the ASoC core use the generic cache.
10Thus we end up with two from each other incoherent caches, which can lead to
11undefined behaviour.
12This patch fixes the issue by changing the wm8904 driver to use the
13generic register cache in its private functions.
14
15Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
16Cc: Ian Lartey <ian@opensource.wolfsonmicro.com>
17Cc: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
18Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
19Cc: stable@kernel.org (for 2.6.37 only)
20---
21 sound/soc/codecs/wm8904.c | 37 ++++++++++++++++++-------------------
22 1 files changed, 18 insertions(+), 19 deletions(-)
23
24diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
25index 9001cc4..1ec12ef 100644
26--- a/sound/soc/codecs/wm8904.c
27+++ b/sound/soc/codecs/wm8904.c
28@@ -50,8 +50,6 @@ static const char *wm8904_supply_names[WM8904_NUM_SUPPLIES] = {
29 /* codec private data */
30 struct wm8904_priv {
31
32- u16 reg_cache[WM8904_MAX_REGISTER + 1];
33-
34 enum wm8904_type devtype;
35 void *control_data;
36
37@@ -2094,7 +2092,7 @@ static int wm8904_digital_mute(struct snd_soc_dai *codec_dai, int mute)
38
39 static void wm8904_sync_cache(struct snd_soc_codec *codec)
40 {
41- struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
42+ u16 *reg_cache = codec->reg_cache;
43 int i;
44
45 if (!codec->cache_sync)
46@@ -2105,14 +2103,14 @@ static void wm8904_sync_cache(struct snd_soc_codec *codec)
47 /* Sync back cached values if they're different from the
48 * hardware default.
49 */
50- for (i = 1; i < ARRAY_SIZE(wm8904->reg_cache); i++) {
51+ for (i = 1; i < codec->driver->reg_cache_size; i++) {
52 if (!wm8904_access[i].writable)
53 continue;
54
55- if (wm8904->reg_cache[i] == wm8904_reg[i])
56+ if (reg_cache[i] == wm8904_reg[i])
57 continue;
58
59- snd_soc_write(codec, i, wm8904->reg_cache[i]);
60+ snd_soc_write(codec, i, reg_cache[i]);
61 }
62
63 codec->cache_sync = 0;
64@@ -2371,6 +2369,7 @@ static int wm8904_probe(struct snd_soc_codec *codec)
65 {
66 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
67 struct wm8904_pdata *pdata = wm8904->pdata;
68+ u16 *reg_cache = codec->reg_cache;
69 int ret, i;
70
71 codec->cache_sync = 1;
72@@ -2437,19 +2436,19 @@ static int wm8904_probe(struct snd_soc_codec *codec)
73 }
74
75 /* Change some default settings - latch VU and enable ZC */
76- wm8904->reg_cache[WM8904_ADC_DIGITAL_VOLUME_LEFT] |= WM8904_ADC_VU;
77- wm8904->reg_cache[WM8904_ADC_DIGITAL_VOLUME_RIGHT] |= WM8904_ADC_VU;
78- wm8904->reg_cache[WM8904_DAC_DIGITAL_VOLUME_LEFT] |= WM8904_DAC_VU;
79- wm8904->reg_cache[WM8904_DAC_DIGITAL_VOLUME_RIGHT] |= WM8904_DAC_VU;
80- wm8904->reg_cache[WM8904_ANALOGUE_OUT1_LEFT] |= WM8904_HPOUT_VU |
81+ reg_cache[WM8904_ADC_DIGITAL_VOLUME_LEFT] |= WM8904_ADC_VU;
82+ reg_cache[WM8904_ADC_DIGITAL_VOLUME_RIGHT] |= WM8904_ADC_VU;
83+ reg_cache[WM8904_DAC_DIGITAL_VOLUME_LEFT] |= WM8904_DAC_VU;
84+ reg_cache[WM8904_DAC_DIGITAL_VOLUME_RIGHT] |= WM8904_DAC_VU;
85+ reg_cache[WM8904_ANALOGUE_OUT1_LEFT] |= WM8904_HPOUT_VU |
86 WM8904_HPOUTLZC;
87- wm8904->reg_cache[WM8904_ANALOGUE_OUT1_RIGHT] |= WM8904_HPOUT_VU |
88+ reg_cache[WM8904_ANALOGUE_OUT1_RIGHT] |= WM8904_HPOUT_VU |
89 WM8904_HPOUTRZC;
90- wm8904->reg_cache[WM8904_ANALOGUE_OUT2_LEFT] |= WM8904_LINEOUT_VU |
91+ reg_cache[WM8904_ANALOGUE_OUT2_LEFT] |= WM8904_LINEOUT_VU |
92 WM8904_LINEOUTLZC;
93- wm8904->reg_cache[WM8904_ANALOGUE_OUT2_RIGHT] |= WM8904_LINEOUT_VU |
94+ reg_cache[WM8904_ANALOGUE_OUT2_RIGHT] |= WM8904_LINEOUT_VU |
95 WM8904_LINEOUTRZC;
96- wm8904->reg_cache[WM8904_CLOCK_RATES_0] &= ~WM8904_SR_MODE;
97+ reg_cache[WM8904_CLOCK_RATES_0] &= ~WM8904_SR_MODE;
98
99 /* Apply configuration from the platform data. */
100 if (wm8904->pdata) {
101@@ -2457,23 +2456,23 @@ static int wm8904_probe(struct snd_soc_codec *codec)
102 if (!pdata->gpio_cfg[i])
103 continue;
104
105- wm8904->reg_cache[WM8904_GPIO_CONTROL_1 + i]
106+ reg_cache[WM8904_GPIO_CONTROL_1 + i]
107 = pdata->gpio_cfg[i] & 0xffff;
108 }
109
110 /* Zero is the default value for these anyway */
111 for (i = 0; i < WM8904_MIC_REGS; i++)
112- wm8904->reg_cache[WM8904_MIC_BIAS_CONTROL_0 + i]
113+ reg_cache[WM8904_MIC_BIAS_CONTROL_0 + i]
114 = pdata->mic_cfg[i];
115 }
116
117 /* Set Class W by default - this will be managed by the Class
118 * G widget at runtime where bypass paths are available.
119 */
120- wm8904->reg_cache[WM8904_CLASS_W_0] |= WM8904_CP_DYN_PWR;
121+ reg_cache[WM8904_CLASS_W_0] |= WM8904_CP_DYN_PWR;
122
123 /* Use normal bias source */
124- wm8904->reg_cache[WM8904_BIAS_CONTROL_0] &= ~WM8904_POBCTRL;
125+ reg_cache[WM8904_BIAS_CONTROL_0] &= ~WM8904_POBCTRL;
126
127 wm8904_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
128
129--
1301.6.6.1
131