From patchwork Fri Mar 26 10:25:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artur Petrosyan X-Patchwork-Id: 410103 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 396CBC433C1 for ; Fri, 26 Mar 2021 10:25:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D207361A4D for ; Fri, 26 Mar 2021 10:25:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229738AbhCZKZV (ORCPT ); Fri, 26 Mar 2021 06:25:21 -0400 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]:37612 "EHLO smtprelay-out1.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbhCZKZP (ORCPT ); Fri, 26 Mar 2021 06:25:15 -0400 Received: from mailhost.synopsys.com (mdc-mailhost2.synopsys.com [10.225.0.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 9D4D3C0269; Fri, 26 Mar 2021 10:25:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1616754315; bh=NmjoFpDwk9C6KhUVpjbaLtkpA+otz+Gqy0pYXDXxPZw=; h=Date:From:Subject:To:Cc:From; b=keLXx+IGR4/FPwlEBRD3YBySdiVEKnIOde6b+ObDPGHwsdLztcyPmGH62Ysn7YIm2 hI7rUBf2okr3BjJb70d/CWhcfZHJqs7b+6t2SmT+XzzADG3p7KjNX69P11bdv+tneF gbNmGBBbzg0T98/4YE/+Ns6+bgGgx8Q+nVT9NgVj4CVkiBwAii8U9vHcUKPNGSMJg1 0VY+TovCjWE52RzHRLrrBeJeq6ajuZ11tKbo8e2sl+2mQsoUruYUUnY2z5Pr/9X/P6 bHA87m2q25+xOe6QLRGtB2E/QOyT8ccgGxm9DCwG6yUqlzca8G4Jh3/NCqlB2r+ffC tzb5JZa33hayw== Received: from razpc-HP (razpc-hp.internal.synopsys.com [10.116.126.207]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mailhost.synopsys.com (Postfix) with ESMTPSA id BDEDEA005D; Fri, 26 Mar 2021 10:25:10 +0000 (UTC) Received: by razpc-HP (sSMTP sendmail emulation); Fri, 26 Mar 2021 14:25:09 +0400 Date: Fri, 26 Mar 2021 14:25:09 +0400 X-SNPS-Relay: synopsys.com From: Artur Petrosyan Subject: [PATCH 3/3] usb: dwc2: Prevent core suspend when port connection flag is 0 To: Felipe Balbi , Greg Kroah-Hartman , Minas Harutyunyan , linux-usb@vger.kernel.org, Douglas Anderson Cc: John Youn , Artur Petrosyan , Paul Zimmerman , , #@synopsys.com, 5.2@synopsys.com, Felipe Balbi , Kever Yang Message-Id: <20210326102510.BDEDEA005D@mailhost.synopsys.com> Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org In host mode port connection status flag is "0" when loading the driver. After loading the driver system asserts suspend which is handled by "_dwc2_hcd_suspend()" function. Before the system suspend the port connection status is "0". As result need to check the "port_connect_status" if it is "0", then skipping entering to suspend. Cc: # 5.2 Fixes: 6f6d70597c15 ("usb: dwc2: bus suspend/resume for hosts with DWC2_POWER_DOWN_PARAM_NONE") Signed-off-by: Artur Petrosyan --- drivers/usb/dwc2/hcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index 40e5655921bf..1a9789ec5847 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -4322,7 +4322,8 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd) if (hsotg->op_state == OTG_STATE_B_PERIPHERAL) goto unlock; - if (hsotg->params.power_down > DWC2_POWER_DOWN_PARAM_PARTIAL) + if (hsotg->params.power_down != DWC2_POWER_DOWN_PARAM_PARTIAL || + hsotg->flags.b.port_connect_status == 0) goto skip_power_saving; /*