summaryrefslogtreecommitdiff
path: root/sound/usb/mixer.c
diff options
context:
space:
mode:
authorDeepa Madiregama <dmadireg@codeaurora.org>2013-08-21 17:54:08 +0530
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:10:58 -0700
commit8152f43f0addbcf967d8c807d93f31034a53ad19 (patch)
treee7b66b8d1946d61005c02a8d47769f7ed8c22fe7 /sound/usb/mixer.c
parentf18c9be9d4bd7bca2091219ddbbb0e7243c75260 (diff)
ALSA: usb-audio: Fix the mixer control range limiting issue
- mixer_ctl_set() function is limiting the volume level to particular range. This results in incorrect initial volume setting for that device. - In USB mixer while calculating the dBmin/dBmax values resolution factor is hardcoded to 256 which results in populating the wrong values for dBmin/dBmax. - Fix is to use appropriate resolution factor while calculating the dBmin/dBmax values. CRs-Fixed: 515012 Change-Id: I502355af66f850bb65380c27333c3341fa43a947 Signed-off-by: Deepa Madiregama <dmadireg@codeaurora.org>
Diffstat (limited to 'sound/usb/mixer.c')
-rw-r--r--sound/usb/mixer.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 4f85757009b3..606fd473454b 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1036,8 +1036,10 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
/* USB descriptions contain the dB scale in 1/256 dB unit
* while ALSA TLV contains in 1/100 dB unit
*/
- cval->dBmin = (convert_signed_value(cval, cval->min) * 100) / 256;
- cval->dBmax = (convert_signed_value(cval, cval->max) * 100) / 256;
+ cval->dBmin =
+ (convert_signed_value(cval, cval->min) * 100) / (cval->res);
+ cval->dBmax =
+ (convert_signed_value(cval, cval->max) * 100) / (cval->res);
if (cval->dBmin > cval->dBmax) {
/* something is wrong; assume it's either from/to 0dB */
if (cval->dBmin < 0)