[PATCH 2/2] ALSA: usb-audio: Reuse active sync endpoint format for implicit feedback
From: Lee Volkov
Date: Wed Dec 02 2026 - 13:13:11 EST
On devices where implicit feedback shares a capture endpoint with
multiple altsettings (such as Solid State Logic SSL 12, where 16/12ch
capture altsets support up to 96 kHz and 10ch Altset 3 supports up to
192 kHz), opening capture on a non-first altsetting (e.g. Altset 3 at
48 or 96 kHz) and then starting playback triggers a failure:
snd_usb_find_implicit_fb_sync_format() scans subs->fmt_list from the
first entry and picks Altset 1 because it also matches the rate and
channel-agnostic check, ignoring that the shared sync endpoint is
already open in Altset 3. snd_usb_endpoint_open() then rejects the
mismatch in endpoint_compatible() and fails playback with -EINVAL
("Incompatible EP setup for 0x81").
Look up the live sync endpoint with snd_usb_get_endpoint() under
chip->mutex first; if it is already opened with a compatible
cur_audiofmt, reuse that active audioformat directly instead of
selecting a conflicting altsetting.
Fixes: 5d15f1eb4560 ("ALSA: usb-audio: Choose audioformat of a counter-part substream")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Volkov <voilthuman@xxxxxxxxx>
---
sound/usb/implicit.c | 24 +++++++++++++++++++++++-
1 file changed, 23 insertions(+), 1 deletion(-)
diff --git a/sound/usb/implicit.c b/sound/usb/implicit.c
index bd4d569a8..56fb87345 100644
--- a/sound/usb/implicit.c
+++ b/sound/usb/implicit.c
@@ -3,6 +3,7 @@
// Special handling for implicit feedback mode
//
+#include <linux/cleanup.h>
#include <linux/init.h>
#include <linux/usb.h>
#include <linux/usb/audio.h>
@@ -16,6 +17,7 @@
#include "card.h"
#include "helper.h"
#include "pcm.h"
+#include "endpoint.h"
#include "implicit.h"
enum {
@@ -462,7 +464,8 @@ snd_usb_find_implicit_fb_sync_format(struct snd_usb_audio *chip,
bool *fixed_rate)
{
struct snd_usb_substream *subs;
- const struct audioformat *fp, *sync_fmt = NULL;
+ struct snd_usb_endpoint *ep;
+ const struct audioformat *fp, *sync_fmt = NULL, *active_fmt = NULL;
int score, high_score;
/* Use the original audioformat as fallback for the shared altset */
@@ -475,6 +478,25 @@ snd_usb_find_implicit_fb_sync_format(struct snd_usb_audio *chip,
if (!subs)
goto end;
+ /*
+ * If the shared sync endpoint is already open in a compatible format,
+ * reuse that active audioformat instead of picking another altsetting
+ * and failing endpoint_compatible() later.
+ */
+ scoped_guard(mutex, &chip->mutex) {
+ ep = snd_usb_get_endpoint(chip, target->sync_ep);
+ if (ep && ep->opened && ep->cur_audiofmt &&
+ match_endpoint_audioformats(subs, ep->cur_audiofmt,
+ params_rate(params),
+ params_channels(params),
+ params_format(params)))
+ active_fmt = ep->cur_audiofmt;
+ }
+ if (active_fmt) {
+ sync_fmt = active_fmt;
+ goto end;
+ }
+
high_score = 0;
list_for_each_entry(fp, &subs->fmt_list, list) {
score = match_endpoint_audioformats(subs, fp,
--
2.55.0