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: 17965 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp759791wru; Wed, 9 Nov 2022 22:39:30 -0800 (PST) X-Google-Smtp-Source: AMsMyM7OikYjnAFQnydJMCv0j+cUKUbA8bUkAeFTqY3XxeSkK8nutjr69ZAbblu3/7hh9PyTWxE2 X-Received: by 2002:a17:907:c004:b0:7ae:1826:b27b with SMTP id ss4-20020a170907c00400b007ae1826b27bmr2059640ejc.692.1668062370540; Wed, 09 Nov 2022 22:39:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668062370; cv=none; d=google.com; s=arc-20160816; b=Y08I0KxjNQRCU7BwfWp72fG84/ab9ianDLKYBDk47W+MjvV7+ZaE8Je3xZpiZrb4yT ugZdJjk4XGR99aExv5+qXy8zpiB4yTMixb2DQ4wGd67LwCyYEVGJ2nlF4AHjWeBAOGDj apKNUIyb+fF0DrY8GbSsdMk4/Fkb0PQIiiWbIvdjy1gN05c6jitsfwpejpSNYIV+K17W vNCdKO2X0CRgNPbtiYR8AF4LOdPimp2Y16+JGzg7oCJ4Oc7oGUunLUoD+unnGm8efqXe /4kpvYN0f3JKyIaHXw/j5kf0udJXTf8PYqJzCYOiS2r31iXVpyadV6thhp3BIwL8a7PO Hidw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=jAOxCD5vC/U8lDtgZFnZC+b5vL6iTgK6YVDktk5Yo2M=; b=FuaSKfWxhLYBx6wvR1x2E6yN4lPa01iCX3H8v3N1fbCEIJ9q7jIn83tjzYHWGA77Ik 1zCV5SGdwQwGeh1CRlUl8qObOdYM72uFT/BjgB1G6FhHyrnq572TnJc1ZcAqz0Zew4b8 WRVCNolh8ghTt5ldFRERlHHxu6YJcqoypPsfhtQoqh8Hxunr7CsioN/2YgyutAW6+YlM qhOeCNv8JUXBcVfgHrAIiadyMFeKgCCKBDeqRGhzqqtGOqv90XGt4vy0CILEYfnZ0H5y 1UuEniZWpxBHL/J36CXbUTICBsNWOyQse83z+v7AEHscD7toaft4+lQfZMKpPVeihM+1 HRdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s17-20020aa7c551000000b0045903f0af9dsi15267093edr.111.2022.11.09.22.39.06; Wed, 09 Nov 2022 22:39:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232486AbiKJGfd (ORCPT + 99 others); Thu, 10 Nov 2022 01:35:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229897AbiKJGfc (ORCPT ); Thu, 10 Nov 2022 01:35:32 -0500 Received: from mailgw.kylinos.cn (unknown [124.126.103.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D0C62B26C for ; Wed, 9 Nov 2022 22:35:30 -0800 (PST) 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 Cc: linux-kernel@vger.kernel.org, aichao@kylinos.cn 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 X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, PDS_RDNS_DYNAMIC_FP,RDNS_DYNAMIC,SPF_HELO_NONE,T_SPF_PERMERROR, UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749090168210285130?= X-GMAIL-MSGID: =?utf-8?q?1749090168210285130?= 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 */