Re: [PATCH 2/3] ALSA: usb-audio: Add QUIRK_FLAG_MIXER_SKIP_GET_CUR_VOL
From: Rong Zhang
Date: Wed May 27 2026 - 14:08:27 EST
Hi Takashi,
Thanks for your review.
On Wed, 2026-05-27 at 07:37 +0200, Takashi Iwai wrote:
> On Tue, 26 May 2026 19:49:24 +0200,
> Rong Zhang wrote:
> >
> > Since commit 86aa1ea1f15c ("ALSA: usb-audio: Do not expose sticky
> > mixers"), the UAC mixer core utilizes volume SET_CUR and GET_CUR to
> > identify devices with sticky mixers. Unfortunately, even though most
> > devices with sticky GET_CUR also have corresponding sticky SET_CUR,
> > which I actually met more since the commit had been merged, there is
> > also a rare case that some devices may have volume mixers that responds
> > to SET_CUR properly but with its GET_CUR stubbed. This cause the sticky
> > check to consider the mixer to be sticky and unnecessarily disable it.
> >
> > Add QUIRK_FLAG_MIXER_SKIP_GET_CUR_VOL to prevent sending GET_CUR to
> > mixers by returning -ENXIO early. The error effectively skips the sticky
> > check as it's only meaningful when the mixer has some sort of self-
> > awareness. Similar to QUIRK_FLAG_GET_SAMPLE_RATE, this should also help
> > if some unmet devices can't tolerate volume GET_CUR in other ways.
> >
> > Signed-off-by: Rong Zhang <i@xxxxxxxx>
> > ---
> > Documentation/sound/alsa-configuration.rst | 4 ++++
> > sound/usb/mixer.c | 5 +++++
> > sound/usb/quirks.c | 1 +
> > sound/usb/usbaudio.h | 6 ++++++
> > 4 files changed, 16 insertions(+)
> >
> > diff --git a/Documentation/sound/alsa-configuration.rst b/Documentation/sound/alsa-configuration.rst
> > index 4b30cd63c5a5..bc3bc65c379a 100644
> > --- a/Documentation/sound/alsa-configuration.rst
> > +++ b/Documentation/sound/alsa-configuration.rst
> > @@ -2389,6 +2389,10 @@ quirk_flags
> > from snd_usb_handle_sync_urb. Instead fall through and enqueue a
> > packet_info containing only size-0 packets, so the OUT ring keeps
> > moving (emits silence). Needed by Behringer Flow 8 (1397:050c).
> > + * bit 30: ``mixer_skip_get_cur_vol``
> > + Skip reading current volume for mixers, as some devices return
> > + constant values or errors but otherwise works fine, i.e., setting
> > + volume takes desired effect.
> >
> > This module supports multiple devices, autoprobe and hotplugging.
> >
> > diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
> > index d61bde654219..3b745aebb181 100644
> > --- a/sound/usb/mixer.c
> > +++ b/sound/usb/mixer.c
> > @@ -420,6 +420,11 @@ static int get_cur_ctl_value(struct usb_mixer_elem_info *cval,
> > static inline int get_cur_mix_raw(struct usb_mixer_elem_info *cval,
> > int channel, int *value)
> > {
> > + struct snd_usb_audio *chip = cval->head.mixer->chip;
> > +
> > + if (chip->quirk_flags & QUIRK_FLAG_MIXER_SKIP_GET_CUR_VOL)
> > + return -ENXIO;
>
> So this workaround is applied to all mixer controls?
Hmm, it is indeed not very optimal. My initial idea was to prevent
returning bogus values at all, so I gated GET_CUR here. But as you've
said this could have a wide impact on other mixers...
>
> We can put it as a common quirk as you've done, but the question is
> how many devices need this, too...
While I am not sure if more devices need this (my intuition says yes),
how about a less radical approach that still relies on the sticky check?
- Rename the quirk flag to QUIRK_FLAG_MIXER_GET_CUR_BROKEN.
- Add a flag to struct usb_mixer_elem_info to gate GET_CUR.
- When the sticky check fails, check quirk flags. Gate further GET_CUR
if the quirk flag is set, otherwise disable the mixer as usual.
- A mixer with GET_CUR gated will solely relies on the internal cache of
last set volume.
The quirk flag still applies to all mixers, but as long as a mixer makes
the sticky check happy, it won't be affected at all. Only those mixers
with constant GET_CUR values will have their GET_CUR gated. I assume the
impact is minimal, since it's very unlikely a device would have sticky
mixers (broken SET_CUR) along with mixers with working SET_CUR but
broken GET_CUR at the same time.
Thanks,
Rong
>
>
> thanks,
>
> Takashi