brcm2708: update 3.10 patches with raspberrypi/rpi-3.10.y of 27 Apr. 2014
[openwrt/svn-archive/archive.git] / target / linux / brcm2708 / patches-3.10 / 0186-Fix-volsw_range-functions-so-SOC_DOUBLE_R_RANGE_TLV-.patch
1 From 4c91cfe1cfa38f4e17e96cd7d78ac2a4fa86d5c9 Mon Sep 17 00:00:00 2001
2 From: Howard Mitchell <hm@hmbedded.co.uk>
3 Date: Fri, 28 Mar 2014 16:27:57 +0000
4 Subject: [PATCH 186/196] Fix volsw_range functions so SOC_DOUBLE_R_RANGE_TLV
5 works.
6
7 This is so that the correct rabge of values as specified
8 with the SOC_DOUBLE_R_RANGE_TLV macro are sent to the
9 hardware for both the normal and invert cases.
10 ---
11 sound/soc/soc-core.c | 22 ++++++++++------------
12 1 file changed, 10 insertions(+), 12 deletions(-)
13
14 diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
15 index d18272c..be302e1 100644
16 --- a/sound/soc/soc-core.c
17 +++ b/sound/soc/soc-core.c
18 @@ -2925,8 +2925,8 @@ int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol,
19
20 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
21 uinfo->count = snd_soc_volsw_is_stereo(mc) ? 2 : 1;
22 - uinfo->value.integer.min = 0;
23 - uinfo->value.integer.max = platform_max - min;
24 + uinfo->value.integer.min = min;
25 + uinfo->value.integer.max = platform_max;
26
27 return 0;
28 }
29 @@ -2957,9 +2957,10 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
30 unsigned int val, val_mask;
31 int ret;
32
33 - val = ((ucontrol->value.integer.value[0] + min) & mask);
34 if (invert)
35 - val = max - val;
36 + val = ((max - ucontrol->value.integer.value[0] + min) & mask);
37 + else
38 + val = (ucontrol->value.integer.value[0] & mask);
39 val_mask = mask << shift;
40 val = val << shift;
41
42 @@ -2968,9 +2969,10 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
43 return ret;
44
45 if (snd_soc_volsw_is_stereo(mc)) {
46 - val = ((ucontrol->value.integer.value[1] + min) & mask);
47 if (invert)
48 - val = max - val;
49 + val = ((max - ucontrol->value.integer.value[1] + min) & mask);
50 + else
51 + val = (ucontrol->value.integer.value[1] & mask);
52 val_mask = mask << shift;
53 val = val << shift;
54
55 @@ -3008,18 +3010,14 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
56 (snd_soc_read(codec, reg) >> shift) & mask;
57 if (invert)
58 ucontrol->value.integer.value[0] =
59 - max - ucontrol->value.integer.value[0];
60 - ucontrol->value.integer.value[0] =
61 - ucontrol->value.integer.value[0] - min;
62 + max - ucontrol->value.integer.value[0] + min;
63
64 if (snd_soc_volsw_is_stereo(mc)) {
65 ucontrol->value.integer.value[1] =
66 (snd_soc_read(codec, rreg) >> shift) & mask;
67 if (invert)
68 ucontrol->value.integer.value[1] =
69 - max - ucontrol->value.integer.value[1];
70 - ucontrol->value.integer.value[1] =
71 - ucontrol->value.integer.value[1] - min;
72 + max - ucontrol->value.integer.value[1] + min;
73 }
74
75 return 0;
76 --
77 1.9.1
78