Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b7f7fe4 authored by Deepa Madiregama's avatar Deepa Madiregama Committed by Banajit Goswami
Browse files

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: default avatarDeepa Madiregama <dmadireg@codeaurora.org>
Signed-off-by: default avatarBanajit Goswami <bgoswami@codeaurora.org>
parent 5d05d2b5
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -1037,8 +1037,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
	/* USB descriptions contain the dB scale in 1/256 dB unit
	 * while ALSA TLV contains in 1/100 dB unit
	 * while ALSA TLV contains in 1/100 dB unit
	 */
	 */
	cval->dBmin = (convert_signed_value(cval, cval->min) * 100) / 256;
	cval->dBmin =
	cval->dBmax = (convert_signed_value(cval, cval->max) * 100) / 256;
		(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) {
	if (cval->dBmin > cval->dBmax) {
		/* something is wrong; assume it's either from/to 0dB */
		/* something is wrong; assume it's either from/to 0dB */
		if (cval->dBmin < 0)
		if (cval->dBmin < 0)