9007bcd1debb14240dd18efc028445a33f9c0220
[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 diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
13 index 2653311..b669e15 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 c3f41e7..a8a753f 100644
30 --- a/sound/soc/soc-core.c
31 +++ b/sound/soc/soc-core.c
32 @@ -3072,8 +3072,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 @@ -3084,8 +3084,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