OSDN Git Service

ALSA: usb-audio: Initialize every feature unit once at probe time
authorTakashi Iwai <tiwai@suse.de>
Thu, 14 Oct 2021 13:06:36 +0000 (15:06 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 14 Oct 2021 14:51:56 +0000 (16:51 +0200)
commitb96681bd58276e1c7ca4ca37bbaab9f8f1738d61
tree179f9e7e79dccf1f67b4c7711167304fc0cb2232
parent509975c7789f84b4d98e06fe2db51ee4ec02eef5
ALSA: usb-audio: Initialize every feature unit once at probe time

So far we used to read the current value of the mixer element
dynamically at the first access, and the error from a GET_CUR message
is treated as a fatal error (unless QUIRK_IGNORE_CTL_ERROR is set).
It's rather inconvenient, as most of GET_CUR errors are no fatal, and
we can continue operation with assumption of some fixed value.

This patch makes the USB-audio driver to change the behavior at probe
time; now it tries to initialize the current value of each mixer
element that is built from a feature unit (those for typically for
mixer volumes and switches).  When a read failure happens, it tries to
set the known minimum value.  After that point, a cached value is used
always, hence we won't hit GET_CUR message error any longer.

The error from GET_CUR message is still shown as a warning normally,
but only once at the probe time, and it'll keep operating.  If the
message is confirmed to be harmless, it can be shut up by
QUIRK_IGNORE_CTL_ERROR quirk flag, too.

Tested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20211014130636.17860-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/mixer.c