From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: broonie@kernel.org, tiwai@suse.de
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
lgirdwood@gmail.com, Deepa Madiregama <dmadireg@codeaurora.org>,
Banajit Goswami <bgoswami@codeaurora.org>,
Meng Wang <mwang@codeaurora.org>,
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: [PATCH] ALSA: usb-audio: Fix the mixer control range limiting issue
Date: Wed, 21 Aug 2019 11:02:25 +0100 [thread overview]
Message-ID: <20190821100225.9254-1-srinivas.kandagatla@linaro.org> (raw)
From: Deepa Madiregama <dmadireg@codeaurora.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@codeaurora.org>
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
Signed-off-by: Meng Wang <mwang@codeaurora.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.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
next reply other threads:[~2019-08-21 10:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-21 10:02 Srinivas Kandagatla [this message]
2019-08-21 17:05 ` [PATCH] ALSA: usb-audio: Fix the mixer control range limiting issue Takashi Iwai
2019-08-22 11:39 ` Srinivas Kandagatla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190821100225.9254-1-srinivas.kandagatla@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=alsa-devel@alsa-project.org \
--cc=bgoswami@codeaurora.org \
--cc=broonie@kernel.org \
--cc=dmadireg@codeaurora.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mwang@codeaurora.org \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.