[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-omap / linus / 0024-ASoC-codecs-wm9090-Fix-register-cache-incoherency.patch
1 From 2f2f23c75c1c055ca6274b04bd2dc71d0a6e8c62 Mon Sep 17 00:00:00 2001
2 From: Lars-Peter Clausen <lars@metafoo.de>
3 Date: Tue, 28 Dec 2010 21:38:02 +0100
4 Subject: [PATCH 24/65] ASoC: codecs: wm9090: Fix register cache incoherency
6 The multi-component patch(commit f0fba2ad1) moved the allocation of the
7 register cache from the driver to the ASoC core. Most drivers where adjusted to
8 this, but the wm9090 driver still uses its own register cache for its
9 private functions, while functions from the ASoC core use the generic cache.
10 Thus we end up with two from each other incoherent caches, which can lead to
11 undefined behaviour.
12 This patch fixes the issue by changing the wm9090 driver to use the
13 generic register cache in its private functions.
15 Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
16 Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
17 Cc: stable@kernel.org (for 2.6.37 only)
18 ---
19 sound/soc/codecs/wm9090.c | 18 +++++++++---------
20 1 files changed, 9 insertions(+), 9 deletions(-)
22 diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c
23 index 99c046b..6e5f64f 100644
24 --- a/sound/soc/codecs/wm9090.c
25 +++ b/sound/soc/codecs/wm9090.c
26 @@ -141,7 +141,6 @@ static const u16 wm9090_reg_defaults[] = {
27 /* This struct is used to save the context */
28 struct wm9090_priv {
29 struct mutex mutex;
30 - u16 reg_cache[WM9090_MAX_REGISTER + 1];
31 struct wm9090_platform_data pdata;
32 void *control_data;
33 };
34 @@ -552,6 +551,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec,
35 static int wm9090_probe(struct snd_soc_codec *codec)
36 {
37 struct wm9090_priv *wm9090 = snd_soc_codec_get_drvdata(codec);
38 + u16 *reg_cache = codec->reg_cache;
39 int ret;
41 codec->control_data = wm9090->control_data;
42 @@ -576,22 +576,22 @@ static int wm9090_probe(struct snd_soc_codec *codec)
43 /* Configure some defaults; they will be written out when we
44 * bring the bias up.
45 */
46 - wm9090->reg_cache[WM9090_IN1_LINE_INPUT_A_VOLUME] |= WM9090_IN1_VU
47 + reg_cache[WM9090_IN1_LINE_INPUT_A_VOLUME] |= WM9090_IN1_VU
48 | WM9090_IN1A_ZC;
49 - wm9090->reg_cache[WM9090_IN1_LINE_INPUT_B_VOLUME] |= WM9090_IN1_VU
50 + reg_cache[WM9090_IN1_LINE_INPUT_B_VOLUME] |= WM9090_IN1_VU
51 | WM9090_IN1B_ZC;
52 - wm9090->reg_cache[WM9090_IN2_LINE_INPUT_A_VOLUME] |= WM9090_IN2_VU
53 + reg_cache[WM9090_IN2_LINE_INPUT_A_VOLUME] |= WM9090_IN2_VU
54 | WM9090_IN2A_ZC;
55 - wm9090->reg_cache[WM9090_IN2_LINE_INPUT_B_VOLUME] |= WM9090_IN2_VU
56 + reg_cache[WM9090_IN2_LINE_INPUT_B_VOLUME] |= WM9090_IN2_VU
57 | WM9090_IN2B_ZC;
58 - wm9090->reg_cache[WM9090_SPEAKER_VOLUME_LEFT] |=
59 + reg_cache[WM9090_SPEAKER_VOLUME_LEFT] |=
60 WM9090_SPKOUT_VU | WM9090_SPKOUTL_ZC;
61 - wm9090->reg_cache[WM9090_LEFT_OUTPUT_VOLUME] |=
62 + reg_cache[WM9090_LEFT_OUTPUT_VOLUME] |=
63 WM9090_HPOUT1_VU | WM9090_HPOUT1L_ZC;
64 - wm9090->reg_cache[WM9090_RIGHT_OUTPUT_VOLUME] |=
65 + reg_cache[WM9090_RIGHT_OUTPUT_VOLUME] |=
66 WM9090_HPOUT1_VU | WM9090_HPOUT1R_ZC;
68 - wm9090->reg_cache[WM9090_CLOCKING_1] |= WM9090_TOCLK_ENA;
69 + reg_cache[WM9090_CLOCKING_1] |= WM9090_TOCLK_ENA;
71 wm9090_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
73 --
74 1.6.6.1