Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp206148rwb; Wed, 9 Nov 2022 22:56:14 -0800 (PST) X-Google-Smtp-Source: AMsMyM7bb0azmJtJj2yLI6gEN63Mnxm45WhEya1ETd+bt8W1jkRrbzrd0a5Jhurq0CbWIuU5sORl X-Received: by 2002:a05:6402:3202:b0:461:46c7:310b with SMTP id g2-20020a056402320200b0046146c7310bmr1816335eda.307.1668063374058; Wed, 09 Nov 2022 22:56:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668063374; cv=none; d=google.com; s=arc-20160816; b=ctNfrRNY1UNfEII5mVXPnltvEz4edi1j/7p35+nXkAgkT1Y+6NVk+2/BBACfjSv9x6 i7cHhewEcZGK/3eY2OgcbNu6Tf0fpejCLd9LTzrQa62xjgAWGzTUVoBKCIDvaF3xR0f4 YRGEgHNl1vD89Kfl9Q0QbOTxMu5skMRmOHb9N3we03JssTLaSWWQ79bn3xCMgdAQ26Tq u+XdYDS8pWBdN+G0SNpABI9vGfl6ywuKamZ4V8jIgtsFoby2unyZTE5XlcJzEdm/G8JT 6ZheKRhhrazuE0KgrPyvwnD8kF+uo4iji0VHA/2m8o6h9ANymBTIDBPjhl6Tp6r3AWFH wYrQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y22-20020a056402359600b0045c13366de4si19506399edc.572.2022.11.09.22.55.49; Wed, 09 Nov 2022 22:56:14 -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 + 93 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 Content-Transfer-Encoding: 8bit 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 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 */ -- 2.25.1