From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>,
Takashi Iwai <tiwai@suse.de>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10.y 2/5] ALSA: usb-audio: Check connector value on resume
Date: Tue, 1 Sep 2026 16:40:15 -0400 [thread overview]
Message-ID: <20260901204018.1548593-2-sashal@kernel.org> (raw)
In-Reply-To: <20260901204018.1548593-1-sashal@kernel.org>
From: Kai-Heng Feng <kai.heng.feng@canonical.com>
[ Upstream commit 44609fc01f280d6b4067262ecbb00e3128d718ae ]
Rear Mic on Lenovo P620 cannot record after S3, despite that there's no
error and the other two functions of the USB audio, Line In and Line
Out, work just fine.
The mic starts to work again after running userspace app like "alsactl
store". Following the lead, the evidence shows that as soon as connector
status is queried, the mic can work again.
So also check connector value on resume to "wake up" the USB audio to
make it functional.
This can be device specific, however I think this generic approach may
benefit more than one device.
Now the resume callback checks connector, and a new callback,
reset_resume, to also restore switches and volumes.
Suggested-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Link: https://lore.kernel.org/r/20210325165918.22593-2-kai.heng.feng@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Stable-dep-of: 1739a976312e ("ALSA: usb-audio: Complete cleanup after system-resume errors")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/usb/mixer.c | 44 +++++++++++++++++++++++++++++++---------
sound/usb/mixer.h | 1 +
sound/usb/mixer_quirks.c | 2 +-
3 files changed, 36 insertions(+), 11 deletions(-)
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index f1a20c196d849..918f6980de3d7 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -3719,20 +3719,43 @@ static int restore_mixer_value(struct usb_mixer_elem_list *list)
return 0;
}
+static int default_mixer_resume(struct usb_mixer_elem_list *list)
+{
+ struct usb_mixer_elem_info *cval = mixer_elem_list_to_info(list);
+
+ /* get connector value to "wake up" the USB audio */
+ if (cval->val_type == USB_MIXER_BOOLEAN && cval->channels == 1)
+ get_connector_value(cval, NULL, NULL);
+
+ return 0;
+}
+
+static int default_mixer_reset_resume(struct usb_mixer_elem_list *list)
+{
+ int err = default_mixer_resume(list);
+
+ if (err < 0)
+ return err;
+ return restore_mixer_value(list);
+}
+
int snd_usb_mixer_resume(struct usb_mixer_interface *mixer, bool reset_resume)
{
struct usb_mixer_elem_list *list;
+ usb_mixer_elem_resume_func_t f;
int id, err;
- if (reset_resume) {
- /* restore cached mixer values */
- for (id = 0; id < MAX_ID_ELEMS; id++) {
- for_each_mixer_elem(list, mixer, id) {
- if (list->resume) {
- err = list->resume(list);
- if (err < 0)
- return err;
- }
+ /* restore cached mixer values */
+ for (id = 0; id < MAX_ID_ELEMS; id++) {
+ for_each_mixer_elem(list, mixer, id) {
+ if (reset_resume)
+ f = list->reset_resume;
+ else
+ f = list->resume;
+ if (f) {
+ err = f(list);
+ if (err < 0)
+ return err;
}
}
}
@@ -3751,6 +3774,7 @@ void snd_usb_mixer_elem_init_std(struct usb_mixer_elem_list *list,
list->id = unitid;
list->dump = snd_usb_mixer_dump_cval;
#ifdef CONFIG_PM
- list->resume = restore_mixer_value;
+ list->resume = default_mixer_resume;
+ list->reset_resume = default_mixer_reset_resume;
#endif
}
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
index 6d20ba7ee88fd..ea41e7a1f7bf2 100644
--- a/sound/usb/mixer.h
+++ b/sound/usb/mixer.h
@@ -70,6 +70,7 @@ struct usb_mixer_elem_list {
bool is_std_info;
usb_mixer_elem_dump_func_t dump;
usb_mixer_elem_resume_func_t resume;
+ usb_mixer_elem_resume_func_t reset_resume;
};
/* iterate over mixer element list of the given unit id */
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index f1012c1b99fb2..24d2618c37896 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -154,7 +154,7 @@ static int add_single_ctl_with_resume(struct usb_mixer_interface *mixer,
*listp = list;
list->mixer = mixer;
list->id = id;
- list->resume = resume;
+ list->reset_resume = resume;
kctl = snd_ctl_new1(knew, list);
if (!kctl) {
kfree(list);
--
2.53.0
next prev parent reply other threads:[~2026-09-01 20:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 13:20 FAILED: patch "[PATCH] ALSA: usb-audio: Complete cleanup after system-resume errors" failed to apply to 5.10-stable tree gregkh
2026-09-01 20:40 ` [PATCH 5.10.y 1/5] ALSA: usb-audio: Carve out connector value checking into a helper Sasha Levin
2026-09-01 20:40 ` Sasha Levin [this message]
2026-09-01 20:40 ` [PATCH 5.10.y 3/5] ALSA: usb-audio: Avoid unnecessary or invalid connector selection at resume Sasha Levin
2026-09-01 20:40 ` [PATCH 5.10.y 4/5] ALSA: usb-audio: Unify mixer resume and reset_resume procedure Sasha Levin
2026-09-01 20:40 ` [PATCH 5.10.y 5/5] ALSA: usb-audio: Complete cleanup after system-resume errors Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260901204018.1548593-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=kai.heng.feng@canonical.com \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox