aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm2708/patches-3.14/0052-fix-soc-core-s-inverse-range-and-let-IQaudIO-DAC-use.patch
blob: 9007bcd1debb14240dd18efc028445a33f9c0220 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
From 7d86ec6d4ad388d8287a68d31ff3e3028477fd86 Mon Sep 17 00:00:00 2001
From: Gordon Garrity <gordon@iqaudio.com>
Date: Sun, 30 Mar 2014 13:52:33 +0100
Subject: [PATCH 52/54] fix soc-core's inverse range and let IQaudIO DAC use
 this fixed SOC_DOUBLE_R_RANGE_TLV support

---
 sound/soc/codecs/pcm512x.c | 3 ++-
 sound/soc/soc-core.c       | 8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
index 2653311..b669e15 100644
--- a/sound/soc/codecs/pcm512x.c
+++ b/sound/soc/codecs/pcm512x.c
@@ -239,9 +239,10 @@ static const struct soc_enum pcm512x_veds =
 	SOC_ENUM_SINGLE(PCM512x_DIGITAL_MUTE_2, PCM512x_VEDS_SHIFT, 4,
 			pcm512x_ramp_step_text);
 
+/* Don't let the DAC go into clipping by limiting the alsa volume control range */
 static const struct snd_kcontrol_new pcm512x_controls[] = {
 SOC_DOUBLE_R_RANGE_TLV("Playback Digital Volume", PCM512x_DIGITAL_VOLUME_2,
-		 PCM512x_DIGITAL_VOLUME_3, 0, 48, 255, 1, digital_tlv),
+		 PCM512x_DIGITAL_VOLUME_3, 0, 40, 255, 1, digital_tlv),
 SOC_DOUBLE("Playback Digital Switch", PCM512x_MUTE, PCM512x_RQML_SHIFT,
 	   PCM512x_RQMR_SHIFT, 1, 1),
 
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index c3f41e7..a8a753f 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3072,8 +3072,8 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
 
 	if (invert)
 		val = ((max - ucontrol->value.integer.value[0] + min) & mask);
-    else
-	val = (ucontrol->value.integer.value[0] & mask);
+	else
+		val = (ucontrol->value.integer.value[0] & mask);
 	val_mask = mask << shift;
 	val = val << shift;
 
@@ -3084,8 +3084,8 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
 	if (snd_soc_volsw_is_stereo(mc)) {
 		if (invert)
 			val = ((max - ucontrol->value.integer.value[1] + min) & mask);
-        else
-            val = (ucontrol->value.integer.value[1] & mask);
+		else
+			val = (ucontrol->value.integer.value[1] & mask);
 		val_mask = mask << shift;
 		val = val << shift;
 
-- 
1.9.1