提交 67a1dba1 编写于 作者: T Takashi Iwai 提交者: Zheng Zengkai

ALSA: usb-audio: Drop bogus dB range in too low level

stable inclusion
from stable-5.10.22
commit 86c524934277b279785659f7b453b31c8d143d0e
bugzilla: 50796

--------------------------------

commit 21cba9c5 upstream.

Some USB audio firmware seem to report broken dB values for the volume
controls, and this screws up applications like PulseAudio who blindly
trusts the given data.  For example, Edifier G2000 reports a PCM
volume from -128dB to -127dB, and this results in barely inaudible
sound.

This patch adds a sort of sanity check at parsing the dB values in
USB-audio driver and disables the dB reporting if the range looks
bogus.  Here, we assume -96dB as the bottom line of the max dB.

Note that, if one can figure out that proper dB range later, it can be
patched in the mixer maps.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=211929
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210227105737.3656-1-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: N  Weilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 5f526a9f
...@@ -1301,6 +1301,17 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval, ...@@ -1301,6 +1301,17 @@ static int get_min_max_with_quirks(struct usb_mixer_elem_info *cval,
/* totally crap, return an error */ /* totally crap, return an error */
return -EINVAL; return -EINVAL;
} }
} else {
/* if the max volume is too low, it's likely a bogus range;
* here we use -96dB as the threshold
*/
if (cval->dBmax <= -9600) {
usb_audio_info(cval->head.mixer->chip,
"%d:%d: bogus dB values (%d/%d), disabling dB reporting\n",
cval->head.id, mixer_ctrl_intf(cval->head.mixer),
cval->dBmin, cval->dBmax);
cval->dBmin = cval->dBmax = 0;
}
} }
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册