From patchwork Thu Nov 10 06:34:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ai Chao X-Patchwork-Id: 623801 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8D3C5C4332F for ; Thu, 10 Nov 2022 06:36:43 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 8C473161E; Thu, 10 Nov 2022 07:35:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8C473161E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1668062200; bh=ibgHr35XDfMTJ2UjEz9u8ZjIk/hjzQkX9qgn68MWnMw=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=TJLRSI+QFmEiScW9C33Rr2grctIbGelmqR04twsb7WNDC20uosmx1UVnQkutKVtd5 bHm+4SvnaUtC9JFN6YP+eGdOe/g753sOPueimDdQ5hFvjUR29nCANnpTBsR+3HeIB0 FWeXi/5VhU0Flesvv9m4OQGGPpu96XGDzjzWNco8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1BD96F80163; Thu, 10 Nov 2022 07:35:50 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0260BF8021D; Thu, 10 Nov 2022 07:35:47 +0100 (CET) Received: from mailgw.kylinos.cn (unknown [124.126.103.232]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8D0B5F80104 for ; Thu, 10 Nov 2022 07:35:33 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8D0B5F80104 X-UUID: 1fd1dcfed96446f39a9e257f6dd04a06-20221110 X-CPASD-INFO: a0408637b65f4fd388b92b5f90b85330@qoBuUGVoYWeOVneyg6mvbVhpkmlijlW 1e2qCaGNjX1CVhH5xTV5uYFV9fWtVYV9dYVR6eGxQYmBgZFJ4i3-XblBgXoZgUZB3sHJuUGhkYw== X-CLOUD-ID: a0408637b65f4fd388b92b5f90b85330 X-CPASD-SUMMARY: SIP:-1, APTIP:-2.0, KEY:0.0, FROMBLOCK:1, OB:0.0, URL:-5, TVAL:161. 0, ESV:0.0, ECOM:-5.0, ML:0.0, FD:0.0, CUTS:253.0, IP:-2.0, MAL:-5.0, PHF:-5.0, PHC:-5 .0, SPF:4.0, EDMS:-5, IPLABEL:4480.0, FROMTO:0, AD:0, FFOB:0.0, CFOB:0.0, SPC:0, SIG:- 5, AUF:2, DUF:7967, ACD:137, DCD:137, SL:0, EISP:0, AG:0, CFC:0.49, CFSR:0.068, UAT:0, R AF:0, IMG:-5.0, DFA:0, DTA:0, IBL:-2.0, ADI:-5, SBL:0, REDM:0, REIP:0, ESB:0, ATTNUM:0, EAF:0,CID:-5.0,VERSION:2.3.17 X-CPASD-ID: 1fd1dcfed96446f39a9e257f6dd04a06-20221110 X-CPASD-BLOCK: 1000 X-CPASD-STAGE: 1 X-UUID: 1fd1dcfed96446f39a9e257f6dd04a06-20221110 X-User: aichao@kylinos.cn Received: from localhost.localdomain [(112.64.161.44)] by mailgw (envelope-from ) (Generic MTA) with ESMTP id 1994489489; Thu, 10 Nov 2022 14:35:40 +0800 From: Ai Chao To: perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Subject: [PATCH] ALSA: usb-audio: add quirk to fix Hamedal C20 disconnect issue Date: Thu, 10 Nov 2022 14:34:52 +0800 Message-Id: <20221110063452.295110-1-aichao@kylinos.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Cc: aichao@kylinos.cn, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" For Hamedal C20, the current rate is different from the runtime rate, snd_usb_endpoint stop and close endpoint to resetting rate. if snd_usb_endpoint close the endpoint, sometimes usb will disconnect the device. Signed-off-by: Ai Chao --- sound/usb/endpoint.c | 3 ++- sound/usb/quirks.c | 2 ++ sound/usb/usbaudio.h | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index d0b8d61d1d22..310cd6fb0038 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -931,7 +931,8 @@ void snd_usb_endpoint_close(struct snd_usb_audio *chip, usb_audio_dbg(chip, "Closing EP 0x%x (count %d)\n", ep->ep_num, ep->opened); - if (!--ep->iface_ref->opened) + if (!--ep->iface_ref->opened && + !(chip->quirk_flags & QUIRK_FLAG_IFACE_SKIP_CLOSE)) endpoint_set_interface(chip, ep, false); if (!--ep->opened) { diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index eadac586bcc8..a50e15be1229 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -2185,6 +2185,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_GENERIC_IMPLICIT_FB), DEVICE_FLG(0x2b53, 0x0031, /* Fiero SC-01 (firmware v1.1.0) */ QUIRK_FLAG_GENERIC_IMPLICIT_FB), + DEVICE_FLG(0x0525, 0xa4ad, /* Hamedal C20 usb camero */ + QUIRK_FLAG_IFACE_SKIP_CLOSE), /* Vendor matches */ VENDOR_FLG(0x045e, /* MS Lifecam */ diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index 2c6575029b1c..e97141ef730a 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h @@ -170,6 +170,8 @@ extern bool snd_usb_skip_validation; * Apply the generic implicit feedback sync mode (same as implicit_fb=1 option) * QUIRK_FLAG_SKIP_IMPLICIT_FB * Don't apply implicit feedback sync mode + * QUIRK_FLAG_IFACE_SKIP_CLOSE + * Don't closed interface during setting sample rate */ #define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0) @@ -191,5 +193,6 @@ extern bool snd_usb_skip_validation; #define QUIRK_FLAG_SET_IFACE_FIRST (1U << 16) #define QUIRK_FLAG_GENERIC_IMPLICIT_FB (1U << 17) #define QUIRK_FLAG_SKIP_IMPLICIT_FB (1U << 18) +#define QUIRK_FLAG_IFACE_SKIP_CLOSE (1U << 19) #endif /* __USBAUDIO_H */