]> git.ipfire.org Git - thirdparty/linux.git/commit
ALSA: usb-audio: Improve volume range checks
authorRong Zhang <i@rong.moe>
Tue, 3 Mar 2026 19:47:58 +0000 (03:47 +0800)
committerTakashi Iwai <tiwai@suse.de>
Wed, 4 Mar 2026 11:05:57 +0000 (12:05 +0100)
commit52dc4b190a31d5a5f43aadc51f5297048bfb6d52
treecc15d3b88cc019392b9ebc9b0fd737a5ef37d86f
parent1060dbbbb2f260e4755dbd8d2f53f5a1894397d8
ALSA: usb-audio: Improve volume range checks

Currently the volume range check is only meant to discover quirky
microphone on webcam devices and facing these issues:

- The check is only meaningful for dB volume, but it doesn't check if
  the TLV callback is the corresponding one
- A common quirky pattern "val = 0/100/1" doesn't trigger any warning
- Some modern devices trigger the check, but they are legit
- The warning message doesn't apply to some quirky messages with linear
  volume
- The term "range" in the warning message is confusing. At readers'
  first glance it should be (max - min), but it turns out to be
  ((max - min) / res)

Solve these issues by improving the checking logic to:

- Ignore mixers with non-dB TLV
- Warn on unlikely small volume ranges (max - min < 256)
- Add some heuristics to determine if the volume range is unlikely big
- Rephrase the warning message to mention linear volume
- Rephrase the warning message in correct wording

Signed-off-by: Rong Zhang <i@rong.moe>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260303194805.266158-4-i@rong.moe
sound/usb/mixer.c