OSDN Git Service

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)
commit7b9cf9036609428e845dc300aec13822ba2c4ab3
tree2985c41791de5090080745743e530f5ad6bec7ce
parent6f44578430d7888ade1e3bd919c1c2c0724409e5
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