A portion of USB Headsets loses previous sound volume setting after a suspend resume

En-Shuo Hsu enshuo at chromium.org
Thu Sep 9 12:21:46 CEST 2021


Hi

We recently found that some USB headsets may fall back to their full volume
after a suspend and resume. We think the issue is caused by the logic of
mixer_ctl_feature_put
<https://github.com/torvalds/linux/blob/a3fa7a101dcff93791d1b1bdb3affcad1410c8c1/sound/usb/mixer.c#L1396>
in
sound/usb/mixer.c:

err = snd_usb_get_cur_mix_value(cval, c + 1, cnt, &oval);
if (err < 0)
  return filter_error(cval, err);
  val = ucontrol->value.integer.value[cnt];
  val = get_abs_value(cval, val);
if (oval != val) {
  snd_usb_set_cur_mix_value(cval, c + 1, cnt, val);
  changed = 1;
}

The existing codes get the existing mixer control value and ignore the set
if the val doesn't change. However, in the suspend and resume case, the USB
headset's control value is actually changed.

Removing the cache logic is a potential fix, but a better solution may be
to properly handle the suspend resume scenario
in snd_usb_get_cur_mix_value. We may need to mark the cache
in usb_mixer_elem_info to be dirty.

The issue is verified to be reproduced with Dell WH3022 and Logitech USB
Headset H340 by:
1. Boot to OS.
2. Plug in the headset and check sound output.
3. Play an audio/video and keep with low volume.
4. Suspend.
5. Resume.
6. When audio/video is played, the headset's sound output can't keep the
original volume. --> issue "

Would like to know your thoughts on this issue.


More information about the Alsa-devel mailing list