Message ID | 1677142665-8686-2-git-send-email-quic_prashk@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp213289wrd; Thu, 23 Feb 2023 01:11:57 -0800 (PST) X-Google-Smtp-Source: AK7set/SMJeRqiL23qBhRQcHR3/IywanYkUdvy5E0tlfljF5be6qGljQLy3zPsEioMAH4X5P/kof X-Received: by 2002:a17:906:7499:b0:8dc:ebb5:a115 with SMTP id e25-20020a170906749900b008dcebb5a115mr8731600ejl.0.1677143517612; Thu, 23 Feb 2023 01:11:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677143517; cv=none; d=google.com; s=arc-20160816; b=azd/F4r7OYnak7VbrQROdt4TdjFQkUYiEHtqJnytPv4OkfAq1XCom0ow7h65L3Ey7v Z7ldvxjODeoNa8U05WQTEHcgoOfFljlna0waxMzZ1gQgp5Ld/tIly8JfTSDEUoIwSs1i HbE9bIFTmy2VXF7P0IJZMPTmZdrQbXYdislwPkaERCk3XwaKv2AB7EeMe5EH9q6RELQ8 rBo6JiUTy60cx7sMm3tmsnLcbxW5UtqStMHtRUR7AOnN6/+OaDj4xiyUA9J/d1mhgGCT cEGyuC0vVUa2JdkXdH0a58G0RGi6hWNtAs8RYAYwpIC6Ss10/eI0S5B9qdrZDoNhL/JE xTgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=NjY00UcLF5Tg2ubWKuLj92kmkGy6Av+56YP17HzFbUI=; b=YhT4KEBnYzduQFsYp+CTAhOuEZ8Py6kdfv9bE5uZUpEfK87Y8lMKOvJr5nqlRl/k+h VoJ7JN+4l35aXx2nt+xQcNLsBzhY+KAM6tudvASLDorjRKekP4L4SwzzhDhtSE6Gy+Ke lMQr8X5XbOkv0HmUGlljjKKager4ml2o85uOC9tjKT4n7n2GPFnNCb2vMqhcyDPDKWTc yoN3RkUFpHmRSuGUG4U9m3E5P9Jl0WD8oWNpdNxWpPwevzeHi6SUXDBXRtyXtLnfEz+V AYLN7d4CkDtyH4Shp94oXc8KxKQjXBVHy+C38xJiNMvenQg7GZtZ5xBiZ1N8v3AzBC73 3onQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=SmLA9TB1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e25-20020a170906749900b008d10fe78243si13597441ejl.878.2023.02.23.01.11.34; Thu, 23 Feb 2023 01:11:57 -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; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=SmLA9TB1; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233761AbjBWI6F (ORCPT <rfc822;cambridge8321@gmail.com> + 99 others); Thu, 23 Feb 2023 03:58:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233299AbjBWI6D (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 23 Feb 2023 03:58:03 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6A523B0E2; Thu, 23 Feb 2023 00:58:02 -0800 (PST) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31N6Oj7E029247; Thu, 23 Feb 2023 08:57:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=NjY00UcLF5Tg2ubWKuLj92kmkGy6Av+56YP17HzFbUI=; b=SmLA9TB1clVuAMW5BpLy0fyK0YKYasYd9vcFkpuC5vqALHalmoDJhhWWow1inUkBqwaw BQ/yNas738inh3ZCLUVQeGXP9ba3pLObjcuiCWYopzYzzo+pDD+H3i5R5ZpH2Hv5sunI XJdUxAr/v2JnuG0qnbgYUyGt45U6RNBWbnSr+Y6TUzYQp8IGQYR6ca7zAFAPtSL4ASTg LFIKf0iq1p3767wJR2drspKJRn6QVt2ntaw86b5q2Jkodl33HjPIIEA8GE23ZKgwez0R FIdW087DH9Twyyuqge/21NSsH7VMZ5iIDkqGc4e0aqJXASlqFRVR/fhYC9XxBwdyk8vb Nw== Received: from nalasppmta02.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3nwybwgswn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Feb 2023 08:57:58 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 31N8vvgO016409 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Feb 2023 08:57:57 GMT Received: from hu-prashk-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 23 Feb 2023 00:57:54 -0800 From: Prashanth K <quic_prashk@quicinc.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Thinh Nguyen <Thinh.Nguyen@synopsys.com>, Jakob Koschel <jakobkoschel@gmail.com>, =?utf-8?b?SsOzIMOBZ2lsYSBCaXRzY2g=?= <jgilab@gmail.com>, Alan Stern <stern@rowland.harvard.edu> CC: Pratham Pratap <quic_ppratap@quicinc.com>, Jack Pham <quic_jackp@quicinc.com>, <linux-usb@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Prashanth K <quic_prashk@quicinc.com> Subject: [PATCH v2 1/2] usb: dwc3: gadget: Change condition for processing suspend event Date: Thu, 23 Feb 2023 14:27:44 +0530 Message-ID: <1677142665-8686-2-git-send-email-quic_prashk@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1677142665-8686-1-git-send-email-quic_prashk@quicinc.com> References: <1677142665-8686-1-git-send-email-quic_prashk@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: ZgQZ3GYkIVKXdfs9DhFTKsRAUwHgngm7 X-Proofpoint-ORIG-GUID: ZgQZ3GYkIVKXdfs9DhFTKsRAUwHgngm7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-23_04,2023-02-22_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=634 malwarescore=0 impostorscore=0 bulkscore=0 spamscore=0 mlxscore=0 priorityscore=1501 adultscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302230077 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758612441110030673?= X-GMAIL-MSGID: =?utf-8?q?1758612441110030673?= |
Series |
Fix vbus draw of dwc3 gadget
|
|
Commit Message
Prashanth K
Feb. 23, 2023, 8:57 a.m. UTC
Currently we process the suspend interrupt event only if the
device is in configured state. Consider a case where device
is not configured and got suspend interrupt, in that case our
gadget will still use 100mA as composite_suspend didn't happen.
But battery charging specification (BC1.2) expects a downstream
device to draw less than 2.5mA when unconnected OR suspended.
Fix this by removing the condition for processing suspend event,
and thus composite_resume would set vbus draw to 2.
Fixes: 72704f876f50 ("dwc3: gadget: Implement the suspend entry event handler")
Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
---
drivers/usb/dwc3/gadget.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 89dcfac..a83f34e 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -4241,15 +4241,8 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc, break; case DWC3_DEVICE_EVENT_SUSPEND: /* It changed to be suspend event for version 2.30a and above */ - if (!DWC3_VER_IS_PRIOR(DWC3, 230A)) { - /* - * Ignore suspend event until the gadget enters into - * USB_STATE_CONFIGURED state. - */ - if (dwc->gadget->state >= USB_STATE_CONFIGURED) - dwc3_gadget_suspend_interrupt(dwc, - event->event_info); - } + if (!DWC3_VER_IS_PRIOR(DWC3, 230A)) + dwc3_gadget_suspend_interrupt(dwc, event->event_info); break; case DWC3_DEVICE_EVENT_SOF: case DWC3_DEVICE_EVENT_ERRATIC_ERROR: