From patchwork Wed Jul 31 11:54:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?6IOh6L+e5Yuk?= X-Patchwork-Id: 13748577 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2060.outbound.protection.outlook.com [40.107.255.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91D9E1AE876; Wed, 31 Jul 2024 11:54:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722426858; cv=fail; b=JmxNgUnCmLVTvGRMw4PFEtJP/t1TFsRAyeOK+ekNOXVws9KhxVN6fWOd71j57KXq5HO/UQBIyGgRSl8siS3Bs7B/jOycaDX0gySDGODgGKowx0UN1bEjetxdCLSys5g61LPKzmm2GQmowryuLnXBah/me4BHBncNCPvQnuHRCRo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722426858; c=relaxed/simple; bh=myEqsl+ZJrF0cXJ2pXGdB7NpofZj1KzOJ/OESo6v3+k=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=NVyC3YowPu2MTS7DijpdW4E4nYS7VyN2pyxaSLXvK92V4GHMAiZWEDSNRBXeS8nEY/mVDJaKoM61+41CDp3YETVINFUzSCahbnh3EWi9FRLg/ic4p8p2mGQc5Khif/KV6MYyaeEw66jc6azIz6FHvp7C4odHnlUS2U1Qr7XK+UQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=DCZMRKeE; arc=fail smtp.client-ip=40.107.255.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="DCZMRKeE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AX2vyIJcRnU1hUwwxBafnXWDL+1rGrSKgWpZxs9G04cUGSPrSQ18j1mLOij4vFKqc6jruZkAiUKu+dmG68m8qGezviwMJAkTpm8L7S8sfqfJpZj2BIEkQHwieE/skWg8z9wkm8D65iaB2gKHcaUijfU1z3ZvEw+4oe9VMyMB06s4TwSgdDYZauXFjPixxaDuJZnA1sUADpdfxKkty23qilnOlGJr1YOa1jmGx2ZT0p919unjAVlhUPAXE2EIUJpehtZiQcLSdNzDmPGPeAeDnN/PHBJT02b7CUkzuVzDiNExSyb4HKjNPWvOup/1e07NlYy2Us/ruEcdYnJg9Jk2qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=myEqsl+ZJrF0cXJ2pXGdB7NpofZj1KzOJ/OESo6v3+k=; b=n1bkisP8jf2hO4nkxcC+hKYcwRx/YsE2dYcwcshYOjT4yzUodwU530sWtCa6MldRQDOGkd+724yNoRtrFCvRKQvwYNebNs4Yd/rySZ93x2/ooCT91yLSOlL5Jy8TD2vLQvwi3isRdLlxAw/d3GGGFCvCtp1SQ99SJ/jC5esjDdQ0nEZAH1BMoDrIzQVQk14VJod4iOts/gADh5cz0dcJIQBccgl36j1LHD8ZUKw8pfqs8loJv3KE4nxX+kRkmPCOCprzjD9jkb2srPXbzBiR2FJDeLRro1f7QJT0loPLp18cp+DedLE6rV/LrTwmlMmF1BIAbj9rQ2s6rKnjq60SwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=myEqsl+ZJrF0cXJ2pXGdB7NpofZj1KzOJ/OESo6v3+k=; b=DCZMRKeEMYudJxBeZv8+gEIFWeLHxx8o+QMPN2dCfF8HxZSRSzRQqRJ1gL9XbQhEzT3PHQsdsMMp1N8s1Tor+S/pY/PK7uxACXipdaE62HjDVzAhgbEDWpsJAdGDXMDfSUu5jTR0g3FIWN72SLif0BJDkIAqn1Ex+i+9gp5TFdWtmIb9kufirGCXXUF/BzuAJaJYll2BSmKiMx11jclVJY/oYM9x4w7SSlObyaEaeChzVuimw7+52BIyvO/VYjWVvd/+cnV98jtZEwuRqrmv61AjtmU9CuU7zqOQyU0lSJIzWVl8yErqN+OVlQJujKDYM/x/8OwVc1ojJ/k/2bVktQ== Received: from TYUPR06MB6217.apcprd06.prod.outlook.com (2603:1096:400:358::7) by SEZPR06MB5072.apcprd06.prod.outlook.com (2603:1096:101:38::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Wed, 31 Jul 2024 11:54:07 +0000 Received: from TYUPR06MB6217.apcprd06.prod.outlook.com ([fe80::c18d:f7c6:7590:64fe]) by TYUPR06MB6217.apcprd06.prod.outlook.com ([fe80::c18d:f7c6:7590:64fe%4]) with mapi id 15.20.7807.026; Wed, 31 Jul 2024 11:54:07 +0000 From: =?utf-8?b?6IOh6L+e5Yuk?= To: "gregkh@linuxfoundation.org" , "laurent.pinchart@ideasonboard.com" , "dan.scally@ideasonboard.com" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: "akpm@linux-foundation.org" , "linux-kernel@vger.kernel.org" , opensource.kernel , =?utf-8?b?6IOh6L+e5Yuk?= Subject: =?utf-8?q?=E7=AD=94=E5=A4=8D=3A_=5BPATCH_v2=5D_usb=3A_gadget=3A_uvc?= =?utf-8?q?=3A_Fixes_the_abnormal_enumeration_problem_of_mobile_phone_as_UVC?= =?utf-8?q?_camera=2E?= Thread-Topic: [PATCH v2] usb: gadget: uvc: Fixes the abnormal enumeration problem of mobile phone as UVC camera. Thread-Index: AdrjPy5L8mvqthR7TX6KWxl0Ter/KwAAO1HQ Date: Wed, 31 Jul 2024 11:54:07 +0000 Message-ID: References: In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: TYUPR06MB6217:EE_|SEZPR06MB5072:EE_ x-ms-office365-filtering-correlation-id: aab9e675-3a58-466a-ea27-08dcb1577b88 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|376014|1800799024|38070700018; x-microsoft-antispam-message-info: =?utf-8?q?jAn+X6qZn1T7ExT4xK3wIrPLIxUFlqW?= =?utf-8?q?qgJ6rR1qmIedSRO0AKyGYTRTyKgs8BT88CK/IjWCyDNHwkBj3UX+dZnkneO7Jpcqi?= =?utf-8?q?CRcjf0rhgCPITl1hwk2SBl5vzCCD1S0QJ0fIPs6F0lilPy/l2b4adbIMcVDWESDZ6?= =?utf-8?q?9Th7VZis2WGa+iO5PHbhVHB1jCM9D0SwCTPd7KcT3HqBOuN4dhG1KxoIooS2MbTsP?= =?utf-8?q?azfzJ4UaDKHxGWKhTi/FzhX/fYnsZjiBup213r1XLvqs+zIbzDd55EbcnvwUWtOsz?= =?utf-8?q?ITPoyvsU5XwRmkypQBD0mbxAf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QrQalv4mDhKBGo/vVI3gLehsfans13s91h?= =?utf-8?q?DwH1WT7YYCkyGPAngaIs7+KOqJZP3xfpSCknKyCJARqNr30w5awDBvv40fvgHc/6f?= =?utf-8?q?lQF9JbLhGiJXXvwOaPzMKoMvBND/zty6buEgVLcWSbZH9UBPz9W76avD5LCRvcamk?= =?utf-8?q?/+Zuh04jeSAaYdFI4SJcShRwGMPR0DTV+Q=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:zh-cn;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYUPR06MB6217.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?stONmgF83hPh9jLFqVnkhwtt4Lh3?= =?utf-8?q?0uocFq/10Cazm+EGO/G0tlLTmNqq+dBwsO92bMyBd4wVQMvjwCPzXU1RFgKwkkguW?= =?utf-8?q?u82RtnIBi9oFBj543B0E3d1UIWXDpY870UwuVUicpvToMKI+dtET2y2HMGwgsyHZQ?= =?utf-8?q?ZQsAv/3cLUMIGTdfvop3j95mnJgaN/vUZFPPkVTplT2pfwj0UkUQfkSPOT0ESm3wE?= =?utf-8?q?lvDuS1bP4YzDYhFJbK01AF4XwF37mivNGDtZGm9kl6DQ7R1bdxXIIIQmA6m1AOgyk?= =?utf-8?q?2ypVLlyxgMoMMC1VTYZW/98Bthrf7JC3MRPPYY+Qy7kDoNhzI0bWQNjwP+HVwlYlm?= =?utf-8?q?UmqNNQUEZRzPl193Op0++SdLbX8U3/WHuon/opbJlCwIkKTl4OxqYOaDolbDRbzrL?= =?utf-8?q?BUbnORj1PMlWYG5BezqMhQre89TlJuKRYxVQrMM2n6o/ftDgenAM+xrd9cj4PSWdG?= =?utf-8?q?dktquqoyggC3o5KyzcFay0FlxrntGzU57SE+k+4AvmnGiWZGIbP3cwQWn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wKeOT?= =?utf-8?q?EkbaodU/x3NHDP1/7GHQcEnOolV1l7PWJWAXJACKBlD1VE1EI5+E6+SCyvyo5J19f?= =?utf-8?q?1w0HI9DBCj0Oo+EHhZjNDbUrIKmmlPtd13D13vkKto6YLrsMV/n3y+2Y=3D?= Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TYUPR06MB6217.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: aab9e675-3a58-466a-ea27-08dcb1577b88 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Jul 2024 11:54:07.2384 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: /u/nysP4qYaOzB7VHTXYYMq9vCspv8vOrh2Elz35OvqX7eKIpwjIOzdqCHymM3L5Dm1cVKrJ9g5QJ56H8Pu+8w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB5072 >When the phone is connected to the computer to use the webcam function, >the phone needs to be enumerated as a uvc camera function. > >Because uvc->func.bind_deactivated is configured as true in the f_uvc >driver uvc_alloc function, the usb_gadget_deactivate function is called >during the execution of the configfs_composite_bind function to >set gadget->deactivated to true, which in turn causes the >usb_gadget_connect_locked function to fail to call the corresponding >controller pullup operation (such as: dwc3_gadget_pullup, >mtu3_gadget_pullup), and the USB cannot be enumerated >normally under the uvc function combination. > >After applying this patch, we measured that under the uvc function, >the dwc3 controller and the mtu3 controller can be enumerated normally, >and the webcam function is normal. > >Fixes this by removing the setting of uvc->func.bind_deactivated to true. > >Signed-off-by: Lianqin Hu >--- >v2: > - Add "Fixes:" tag on the commit > - Modify description information. >--- > drivers/usb/gadget/function/f_uvc.c | 1 - > 1 file changed, 1 deletion(-) > >diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c >index 40187b7112e7..6d63bea14211 100644 >--- a/drivers/usb/gadget/function/f_uvc.c >+++ b/drivers/usb/gadget/function/f_uvc.c >@@ -1107,7 +1107,6 @@ static struct usb_function *uvc_alloc(struct usb_function_instance *fi) > uvc->func.disable = uvc_function_disable; > uvc->func.setup = uvc_function_setup; > uvc->func.free_func = uvc_free; >- uvc->func.bind_deactivated = true; > > return &uvc->func; > >-- >2.39.0 -----邮件原件----- 发件人: 胡连勤 发送时间: 2024年7月31日 19:49 收件人: gregkh@linuxfoundation.org; laurent.pinchart@ideasonboard.com; dan.scally@ideasonboard.com; linux-usb@vger.kernel.org; linux-kernel@vger.kernel.org 抄送: akpm@linux-foundation.org; linux-kernel@vger.kernel.org; opensource.kernel 主题: 答复: [PATCH v2] usb: gadget: uvc: Fixes the abnormal enumeration problem of mobile phone as UVC camera. When the phone is connected to the computer to use the webcam function, the phone needs to be enumerated as a uvc camera function. Because uvc->func.bind_deactivated is configured as true in the f_uvc driver uvc_alloc function, the usb_gadget_deactivate function is called during the execution of the configfs_composite_bind function to set gadget->deactivated to true, which in turn causes the usb_gadget_connect_locked function to fail to call the corresponding controller pullup operation (such as: dwc3_gadget_pullup, mtu3_gadget_pullup), and the USB cannot be enumerated normally under the uvc function combination. After applying this patch, we measured that under the uvc function, the dwc3 controller and the mtu3 controller can be enumerated normally, and the webcam function is normal. Fixes this by removing the setting of uvc->func.bind_deactivated to true. Signed-off-by: Lianqin Hu --- v2: - Add "Fixes:" tag on the commit - Modify description information. --- drivers/usb/gadget/function/f_uvc.c | 1 - 1 file changed, 1 deletion(-) -- 2.39.0 -----邮件原件----- 发件人: gregkh@linuxfoundation.org 发送时间: 2024年7月31日 19:13 收件人: 胡连勤 抄送: akpm@linux-foundation.org; linux-kernel@vger.kernel.org; opensource.kernel 主题: Re: [PATCH v1] usb: gadget: uvc: Fixed the abnormal enumeration problem of mobile phone as UVC camera. On Wed, Jul 31, 2024 at 08:45:31AM +0000, 胡连勤 wrote: > When the phone is connected to the computer to use the webcam > function, the phone needs to be enumerated as a uvc camera function. Note, why aren't you using scripts/get_maintainer.pl to find the proper mailing list and developers for this change? Please do so. thanks, greg k-h diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index 40187b7112e7..6d63bea14211 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c @@ -1107,7 +1107,6 @@ static struct usb_function *uvc_alloc(struct usb_function_instance *fi) uvc->func.disable = uvc_function_disable; uvc->func.setup = uvc_function_setup; uvc->func.free_func = uvc_free; - uvc->func.bind_deactivated = true; return &uvc->func;