From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796235175; b=jxJ5gJcKFMdwPUD9aW+JbvPTRfWg4CFX5NHVJLtH4HAI+HD2pNUM5SBW2jtVJp1NAkLn XgVeMckYPcF5RnyG2rs/BLJjRYdTNppyFp7zhrcywW2AhoHFA4janQGHcwf/xbYyBJ4s8 BRjVXISFFfhAHZCqtlTpRID7RNIetVGhtvdFJdN9/+bODTyZ/JRzCLgholcw5TWexrxOo u/KFihwg7jqM36T1Xj3gbSTSEj7CXVmAoFLdPbc1tJfZ/WZAuuQr+y81Ljx+GGkU9/K14 yLHr43SEHRrZwQNpfq8L9YV+aLMJTxHpUlQQsCC0/0lj5RwZpA0fwO4BZeCByVZRfxw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796235175; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=sGu6WoGHrvVNVSwz84VTF5CWasrQwx5NyRQkXRHgtPY=; b=mzMB8a4zWP8DDG3Ny9bclxr5ob6em3MxW93TTowvi2Jr0lWmFgDZcPSuhgeGNi94Y3Cb OHhq4WnD0ya7SFAhZGXMaZm8DpvL9nlw3kDq+pCfbsL+VcvNkoicJvK0r/mtYOriv+BcP 6DhKo2RaBnIA54UQmURo9zuE/3TqTMyAZwH/4aaxrKQAsLfcofZHvRa2VdQQqvLswQMG/ lhrmYxD2ifYCpT1m0h19DAyLZhH7yeZSCNusYM0PNqWmvuzOPn3zNdUD5rkBgjFOZkEpp yN2322kH1c2aXGUdr4HBait2tpcA7A6ZF8SgHAledSjjp5PcZMIXpsEpEn48iNePRcA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=hmA5PdhC; arc=none smtp.remote-ip=209.85.208.172 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B8A360A2604 for ; Wed, 2 Dec 2026 18:12:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2B8A360A2604 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=hmA5PdhC Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-3ad5529ae64so108482851fa.2 for ; Wed, 02 Dec 2026 10:12:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796235173; x=1796839973; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=sGu6WoGHrvVNVSwz84VTF5CWasrQwx5NyRQkXRHgtPY=; b=hmA5PdhCWZbIUDYKZYD6uRxuJwfcu/0dpM1J1d33QiEfhNJ7KrOojtg34S+nJXJSrH 7S9wa6vA8tT8VJeJXVomzHb1Vb6KPvQQ+cMk+7u90Rzzn/kMuwsqpnrPFCkDYxTDcAs3 tHANwxffVL05SchrO2r8VsDcd4yev+Tetm7FmLFukqfCtm5STpNXL9N99oZK9Cf5reHq tGmSZMbjPLZzXg/wn3GwZXXxRPWekyzTEJ42EoGz0tt0ZJhDJCr4xNgr+ISooAkX6iJ3 eEa29xJToeIxMraPyPv3Bm//fVobjgJFSYNKMrtMc6PTVJVuHutsrWzo7E/RblVL/l6n GEKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796235173; x=1796839973; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=sGu6WoGHrvVNVSwz84VTF5CWasrQwx5NyRQkXRHgtPY=; b=a4CoR2tfEU5zC7mC2dEIAm3yvdhbAOENVWX4GxjfAJhIRXKd5LxGftSWdFowqqgygH RYrbj65Uc0kAdzJPMG54gD7bzJRLIOguKkYaz+fOQNSwSdBE4OyeCWY+vQxdxE0EykIa WuQbWSLHjU3trodGfBsaF8JoUKxF4Slt81EEU2tL0uPHqTE3cu/MxWX0Uw7Hl14zMhJu z9awPvlRl55HpF0rEjCQAlBBGUeDL/jopw5ofiAOkz1NZOfRJjGrXi6Mwn/4eHjjxanR T4Es0f8TeC7Ud5onJTHdVIdYXPxPt1efWUhiuXxPZArhlCblznfMLefKe7LJVJE4wXHf yZ6Q== X-Forwarded-Encrypted: i=1; AL+hErG1MUxnTN7jymOgwI1lNws42ysszY636+Luwhotb5PMvYCH0HDw8tx59u6sy5KTqbFwlO6FUQ1LvFengAo=@vger.kernel.org X-Gm-Message-State: APuU4Z98XFQcCinqgWSJoUKO0e2kdJbE91cT8RZmMF8+ScajCn+Evrg5 WpqWBDXLuEb22ddAACMtEz1i/0cPn5ogomYlxseaxg9kCCFpSnxPDgI+ X-Gm-Gg: AZFdTZfNUg6JzcyJUzxqu1gKSPAiH8a5V55bhWsRKeWesMiQm8+Hz56+B7cF83PxIWU v9Yw2byOFJiyKBgZHJmTRY4aSb2N3faVCP2Epenp79vOaGa4ierVFn5yL0k4yzl9MqaGXizIVxL ul7AVyQAtLy5CGYN6Gni/688zmJpCHnd8fyLh41LgT6QOl4vwbMHC5kfOSXZBcMqhQCz3evgTg6 EjSzAB/bu5FEccrZUGOErT3I0J8HKgwBiE55qzIflf2Uhy1qyOXM7p5YBHnJUy3L+6kUerKAsBE jWu3yhYpZk7BGw6QtKljaDJr3Ri0s4TLE86Gz4wpT6m03BsMp5BIankXTFqXZiePv3o6lYq7bER YFgA0kvdleKFB6bWC4qneyq9VC5U8zFNpy39TyIcpW+xYcdydzaqgCYKmYzmkKaETHZS1RAKu4a ZWipPTzvISYN7J+16hrgvSPg7V5LQiuXyeUNRvtHKbfEZU2iAPMRnBF+Cie8BCcJqBfXkow6AxK thWKLAC+UPSYfPJLkrOUARN5ecleI6Wn21YIJaVMrL131qo7gy0RxBCHlDuyO3zVEZ5J5yC40qp Onoatj0PgjlP0tRFM5t1x6V2QjR10TxWtsdppbpDckChjP734vcDc1v32/9Y210cyg== X-Received: by 2002:a05:6512:3c8e:b0:5c0:c5e:3ca with SMTP id 2adb3069b0e04-5c1bc7f974bmr13066039e87.37.1796235173355; Wed, 02 Dec 2026 10:12:53 -0800 (PST) Received: from v-nix (static.209.21.27.37.clients.your-server.de. [37.27.21.209]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5c36b51dcffsm850790e87.55.2026.12.02.10.12.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 10:12:52 -0800 (PST) From: Lee Volkov To: Takashi Iwai , Jaroslav Kysela Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Lee Volkov , stable@vger.kernel.org Subject: [PATCH 2/2] ALSA: usb-audio: Reuse active sync endpoint format for implicit feedback Date: Wed, 2 Dec 2026 21:10:13 +0300 Message-ID: <20261202181013.145045-3-voilthuman@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261202181013.145045-1-voilthuman@gmail.com> References: <20261202181013.145045-1-voilthuman@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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@vger.kernel.org Signed-off-by: Lee Volkov --- 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 #include #include #include @@ -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