]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: usb-audio: Unify mixer resume and reset_resume procedure
authorTakashi Iwai <tiwai@suse.de>
Fri, 10 Sep 2021 10:51:55 +0000 (12:51 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 13 Sep 2021 13:00:31 +0000 (15:00 +0200)
commit6700c002d056894367bcbe4517b460760df0a9a9
tree2985c41791de5090080745743e530f5ad6bec7ce
parente4a9a21c93a9b9d03b9e0863a8c51379fcb7fa93
ALSA: usb-audio: Unify mixer resume and reset_resume procedure

USB-audio driver assumes that the normal resume would preserve the
device configuration while reset_resume wouldn't, and tries to restore
the mixer elements only at reset_resume callback.  However, this seems
too naive, and some devices do behave differently, resetting the
volume at the normal resume; this resulted in the inconsistent volume
that surprised users.

This patch changes the mixer resume code to handle both the normal and
reset resume in the same way, always restoring the original mixer
element values.  This allows us to unify the both callbacks as well as
dropping the no longer used reset_resume field, which ends up with a
good code reduction.

A slight behavior change by this patch is that now we assign
restore_mixer_value() as the default resume callback, and the function
is no longer called at reset-resume when the resume callback is
overridden by the quirk function.  That is, if needed, the quirk
resume function would have to handle similarly as
restore_mixer_value() by itself.

Reported-by: En-Shuo Hsu <enshuo@chromium.org>
Cc: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Link: https://lore.kernel.org/r/CADDZ45UPsbpAAqP6=ZkTT8BE-yLii4Y7xSDnjK550G2DhQsMew@mail.gmail.com
Link: https://lore.kernel.org/r/20210910105155.12862-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/card.c
sound/usb/mixer.c
sound/usb/mixer.h
sound/usb/mixer_quirks.c