kernel: refresh patches
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-3.14 / 0052-fix-soc-core-s-inverse-range-and-let-IQaudIO-DAC-use.patch
1 From 7d86ec6d4ad388d8287a68d31ff3e3028477fd86 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 52/54] 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 --- a/sound/soc/codecs/pcm512x.c
13 +++ b/sound/soc/codecs/pcm512x.c
14 @@ -239,9 +239,10 @@ static const struct soc_enum pcm512x_ved
15 SOC_ENUM_SINGLE(PCM512x_DIGITAL_MUTE_2, PCM512x_VEDS_SHIFT, 4,
16 pcm512x_ramp_step_text);
17
18 +/* Don't let the DAC go into clipping by limiting the alsa volume control range */
19 static const struct snd_kcontrol_new pcm512x_controls[] = {
20 SOC_DOUBLE_R_RANGE_TLV("Playback Digital Volume", PCM512x_DIGITAL_VOLUME_2,
21 - PCM512x_DIGITAL_VOLUME_3, 0, 48, 255, 1, digital_tlv),
22 + PCM512x_DIGITAL_VOLUME_3, 0, 40, 255, 1, digital_tlv),
23 SOC_DOUBLE("Playback Digital Switch", PCM512x_MUTE, PCM512x_RQML_SHIFT,
24 PCM512x_RQMR_SHIFT, 1, 1),
25
26 --- a/sound/soc/soc-core.c
27 +++ b/sound/soc/soc-core.c
28 @@ -3072,8 +3072,8 @@ int snd_soc_put_volsw_range(struct snd_k
29
30 if (invert)
31 val = ((max - ucontrol->value.integer.value[0] + min) & mask);
32 - else
33 - val = (ucontrol->value.integer.value[0] & mask);
34 + else
35 + val = (ucontrol->value.integer.value[0] & mask);
36 val_mask = mask << shift;
37 val = val << shift;
38
39 @@ -3084,8 +3084,8 @@ int snd_soc_put_volsw_range(struct snd_k
40 if (snd_soc_volsw_is_stereo(mc)) {
41 if (invert)
42 val = ((max - ucontrol->value.integer.value[1] + min) & mask);
43 - else
44 - val = (ucontrol->value.integer.value[1] & mask);
45 + else
46 + val = (ucontrol->value.integer.value[1] & mask);
47 val_mask = mask << shift;
48 val = val << shift;
49