From patchwork Wed Jul 31 11:49:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?6IOh6L+e5Yuk?= X-Patchwork-Id: 13748576 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2065.outbound.protection.outlook.com [40.107.255.65]) (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 5D3681A8BE6; Wed, 31 Jul 2024 11:49:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.255.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722426558; cv=fail; b=IktNMFUIK/bhkx0w7+ZtOUXNhkkF9bShIWUlsX3YmaKbeibyWmJtb2P/RflhuUcOx1ULmqn+YWeEluYO5oWmi3Obx43pkw4z3kCzJhD32pD6G90jCc5+lXjeWpQ23J95eRwBMh7PISFaWqFiTDp5HMIowupvZDRhNj6WgleVwLE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722426558; c=relaxed/simple; bh=JRarj0BFR6m01sisJExv46Skkp/UMRV3P8jZ7bTykrU=; h=From:To:CC:Subject:Date:Message-ID:Content-Type:MIME-Version; b=PHVLS9a9tFYF9cDKOaB8n1m43Wu79J/OJja0kRT3hUBf19xFOZP7t/UWoJRkh0NYdVkIUbUGH4yBpQw6NjH7uL6/o5WHdMxE1pmjDznqOFB9VhvYDkiSjU5udODENbp/3X2nkRtV3SAbcc0a8VUgQQWBj70SQwbDdPpwdQvxPPc= 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=iKZSf4jP; arc=fail smtp.client-ip=40.107.255.65 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="iKZSf4jP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=xN9RaLUZIPdm9cOscLZRA62FmsgEgurXgHXVsrjKOv8wfNTq/hoplooWDkTBbk4sAaacE4/JEFbEExWkrIkUCmM+gc6mVA+xGgmseyP5ebFjvkFBB1vg9aIyQXtH5UT9yXqAtsNoydgSoGIbIJK3ggYGrEkLrqKJ0eIgbbACNyPZCqIt7zej5NV5gk83fvGWYFgWcsNOTtikmhq0cW056iSzR01/TmshPmDVaH40s0r/rcgBYJGCuSYA9QMGuQtO1YePMDDv97aobzPIl7ISOLlHzwwPwRycdeMzTvY7sMtVgXyp8/XV37NfsD3RzY5gZuwHh5BxcastmAnjzv0OiA== 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=JRarj0BFR6m01sisJExv46Skkp/UMRV3P8jZ7bTykrU=; b=bUaiRgWMym8Bh5L70iahgXCG35WL1boj1O2/TvRU7ED0cEu6/2DFT7xQhZ1Px4bB46B5lV+TjRr0L1TwzMga3Ld3ZZwQHNz1LlFvh2h9bZnIdqNLlrNY8hqNmAxBxt0vQOtWR0xn9c8LLbv8KVX3G7J0pCmybDIi/cBYeu0P7oLDZuj/Hdwrac6QEorBUtU7W8sHYfICm+eyy+qkb9fOOoGQe6EKzqL7j+qtli2VwzcnsOXVUci2s4OrHO89DJTnPeWgGOsFX7VJ4XfpgJxdx20XQDj1f28nw1xARJgW6XZU4NY82kwqXtXjL+LqHVtTfGcGBujVzmGfLku6mPX+Eg== 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=JRarj0BFR6m01sisJExv46Skkp/UMRV3P8jZ7bTykrU=; b=iKZSf4jP6XoGLtjrMx9dD8yY9I8DLR2eX8oTjvH1ONfepGKeslRMqeaoDZbMKntd1cTu1KehhItaNfmkxoPoxuNmi/nir6Yn4BolIQMuJHN3sUgQPUqAPnkArx+bV5LsvUunvjmeCrT4GeD7fY7AMNqHcZ6bTN0bicX0zhlulWmDFUHWU3XkcHD2skzKodTvZd9ET/Gn2h5LCiYsEZJSEyE4s1xipzklQk+RE78K9r1VxTEyrPS14ApLPc3kCUEHP3fTYssnOPLKrkQkg+ot6xtXUMkdAh6gah/8DCrsRwy1+onvLlvAYKTVHb2QiC8v7uZHg2o1EBi6X1LAO8l9cA== Received: from TYUPR06MB6217.apcprd06.prod.outlook.com (2603:1096:400:358::7) by KL1PR06MB6473.apcprd06.prod.outlook.com (2603:1096:820:ef::13) 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:49:12 +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:49:12 +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 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/Kw== Date: Wed, 31 Jul 2024 11:49:11 +0000 Message-ID: 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_|KL1PR06MB6473:EE_ x-ms-office365-filtering-correlation-id: ac38e28d-c586-468f-e10d-08dcb156cb87 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|366016|1800799024|376014|38070700018; x-microsoft-antispam-message-info: =?utf-8?q?O1fYGYjMJto922XjNc3V/RtMWdmPVes?= =?utf-8?q?0UAYQ+us9IIxrbF7rlxZn1cAlh1Hs6N0iZHFrVAYq3jsOG6gA1RqZGe7zQCFHFrev?= =?utf-8?q?39k2UTLlVRIZUAknNWPA0Hkmb23AkYSg3NitVFiLHzqroGdRcIx8eDqJLY+RBSGY2?= =?utf-8?q?u9cnwarWBcRzHzbCJE2G+PlAQXAxZYYi5ebmf7o0OdUv3vKikh6LYD5j0Kc9wq63Z?= =?utf-8?q?3QiH5R5xhuuokxJubpxWciI9iiG5GqounMLpVDufOpPKvZno4eXc3wbyjs1TrIbef?= =?utf-8?q?6Hq5RowvUs1g9nTBiZJLACxoK+nmqlHJTlppVvC/SFOzgpt0pcVDRtOBcQFCR2JMX?= =?utf-8?q?NpkYXvLhxv72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jqYwtEmQ5N1dKC8+PlCqXgGVM85H/LF0duqHF?= =?utf-8?q?uMOQWfGT8fYVs48SqeemjE64fPPPbKLMGjLvPiN0F3cj4fARcHgvffTfN82l0+Jp5?= =?utf-8?q?YgcGpMgQzu4MX08dBkUZVzVHDYwTF4U1rA=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)(1800799024)(376014)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?/adUdanLnpcxRfGtWjCCdyEwOKD7?= =?utf-8?q?joMpf6PMpkhNVeHqVRHbd5LMWaNO6zI8MJQS5iG7QAitZDtcWQDuMlrqbpLkk7z0l?= =?utf-8?q?1+8Kr6+SyCiQ5hgP3yrTJW6mfNAr1UkVbNec+QObQ9gAg9/m13wIVTK3a04Hz2ToN?= =?utf-8?q?/D/yerzO67rwX9xV3Jey+NbBmUMH9N6EVfmx6IGmRQBZLj1jXSdjglTVEF9VreJb7?= =?utf-8?q?MNcLSqyOmBXUzAa9fm05JFQ4idSpwblAH7ZUk0XkeROmkF5FDrs1wHlD0KoaALHCL?= =?utf-8?q?+kmlInRoOSldk50HPHnzsnYzkjCfjfinSWiaL2tYEiqn9VYBtk3eTGN7+d0xvKTiN?= =?utf-8?q?BK8Hkf3oKTWnW7qVeYdrEY9Hw2TrJsi466wzcZjmmGbgII7iLvIRiExnaMQ9IxpXG?= =?utf-8?q?3jYCpnVt7ULWmNn1Y0L/NELm6Mt34wCNCsuWT422zdxeT0HeUC+xuKIRlB8lVrZis?= =?utf-8?q?bWuvFCLGYS49GehQI1SGyI8fiHivEItMYYEuhCCb01LFuEM6ntW4Y5ALxSqsVxy+T?= =?utf-8?q?I6HaQh/+5yqj07VUmvd+Zszhtx8/Qaae59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TBvoLtau+/xcyf496Ced?= =?utf-8?q?eb80m8Xol1OmhQF28yGsi3mmtT8j9Ca2sl9p+pqs1euHfDdAgov3hr5o=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: ac38e28d-c586-468f-e10d-08dcb156cb87 X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Jul 2024 11:49:11.9248 (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: HPIUpaHSTpRuGzfQfQVc2etxBGOPxhZqOQF4WoXAwA48W40UdbYpYFg4tMC9pUtEd0b8xDswSgJzJ9c7b8Yr1g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6473 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;