[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190821100225.9254-1-srinivas.kandagatla@linaro.org>
Date: Wed, 21 Aug 2019 11:02:25 +0100
From: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
To: broonie@...nel.org, tiwai@...e.de
Cc: alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
lgirdwood@...il.com, Deepa Madiregama <dmadireg@...eaurora.org>,
Banajit Goswami <bgoswami@...eaurora.org>,
Meng Wang <mwang@...eaurora.org>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Subject: [PATCH] ALSA: usb-audio: Fix the mixer control range limiting issue
From: Deepa Madiregama <dmadireg@...eaurora.org>
- 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.
Signed-off-by: Deepa Madiregama <dmadireg@...eaurora.org>
Signed-off-by: Banajit Goswami <bgoswami@...eaurora.org>
Signed-off-by: Meng Wang <mwang@...eaurora.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
---
sound/usb/mixer.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 5070a6a76ab3..a67448327d07 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1248,8 +1248,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)
--
2.21.0
Powered by blists - more mailing lists