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 / 0188-fix-soc-core-s-inverse-range-and-let-IQaudIO-DAC-use.patch
1 From 23744308d6343449e4a037d6bf35d9566c711983 Mon Sep 17 00:00:00 2001
2 From: Gordon Garrity <gordon@iqaudio.com>
3 Date: Sun, 30 Mar 2014 13:52:33 +0100
4 Subject: [PATCH 188/196] fix soc-core's inverse range and let IQaudIO DAC use
5 this fixed SOC_DOUBLE_R_RANGE_TLV support
6
7 ---
8 sound/soc/codecs/pcm512x.c | 3 ++-
9 sound/soc/soc-core.c | 8 ++++----
10 2 files changed, 6 insertions(+), 5 deletions(-)
11
12 diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
13 index 5bc96ec..504da38 100644
14 --- a/sound/soc/codecs/pcm512x.c
15 +++ b/sound/soc/codecs/pcm512x.c
16 @@ -239,9 +239,10 @@ static const struct soc_enum pcm512x_veds =
17 SOC_ENUM_SINGLE(PCM512x_DIGITAL_MUTE_2, PCM512x_VEDS_SHIFT, 4,
18 pcm512x_ramp_step_text);
19
20 +/* Don't let the DAC go into clipping by limiting the alsa volume control range */
21 static const struct snd_kcontrol_new pcm512x_controls[] = {
22 SOC_DOUBLE_R_RANGE_TLV("Playback Digital Volume", PCM512x_DIGITAL_VOLUME_2,
23 - PCM512x_DIGITAL_VOLUME_3, 0, 48, 255, 1, digital_tlv),
24 + PCM512x_DIGITAL_VOLUME_3, 0, 40, 255, 1, digital_tlv),
25 SOC_DOUBLE("Playback Digital Switch", PCM512x_MUTE, PCM512x_RQML_SHIFT,
26 PCM512x_RQMR_SHIFT, 1, 1),
27
28 diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
29 index be302e1..2c28df1 100644
30 --- a/sound/soc/soc-core.c
31 +++ b/sound/soc/soc-core.c
32 @@ -2959,8 +2959,8 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
33
34 if (invert)
35 val = ((max - ucontrol->value.integer.value[0] + min) & mask);
36 - else
37 - val = (ucontrol->value.integer.value[0] & mask);
38 + else
39 + val = (ucontrol->value.integer.value[0] & mask);
40 val_mask = mask << shift;
41 val = val << shift;
42
43 @@ -2971,8 +2971,8 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
44 if (snd_soc_volsw_is_stereo(mc)) {
45 if (invert)
46 val = ((max - ucontrol->value.integer.value[1] + min) & mask);
47 - else
48 - val = (ucontrol->value.integer.value[1] & mask);
49 + else
50 + val = (ucontrol->value.integer.value[1] & mask);
51 val_mask = mask << shift;
52 val = val << shift;
53
54 --
55 1.9.1
56