Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp40570pxy; Tue, 27 Apr 2021 22:14:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwI1F7KQKSfuUDEMses4NO4uV8sAHgykd22Ld0xIJAYL1B+sNLWbmB9FOFkZsZ4ymJrfwBe X-Received: by 2002:a62:75c3:0:b029:27c:d30f:66a6 with SMTP id q186-20020a6275c30000b029027cd30f66a6mr1943762pfc.0.1619586845897; Tue, 27 Apr 2021 22:14:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619586845; cv=none; d=google.com; s=arc-20160816; b=fLPomG7K0qwmi9K183ne14HcHusgPntvDm4ZrKpjNvqVVkODkdGKN+paXRisPXL3S7 AzMzfrzL0aJSi0x9csNoG/P8u2ipXfHmYczJucptPXDWMQ8z2bft4VksAZ+8ZaVVU+px mg3HLqNCjlVsxAvtls/m4zUpF5rys6Ox1VJ9b99DYtDmu2jlRbL40K8oKBh8lhr/Nl+O T6dRAwdOlC9KtALx7Cfq82ABCqCwVRt+HnLF9/o7T18okVantPjbbKajldvz8h51WGIg Uw18n3ei50T6Lrrfe7rgqBrZGNUbyzwMDcb2bhh0DdwoQxzQIIRDf5uNQD7f8tySW47/ XvpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=OtbLPf/sIlCOkwzpLTvXxO8fR4esGiDmFnCTHMx4PXA=; b=LlHnXmxswnHfGVO8QoPoW5OtljigyaZlER96HEF3WFjiHlITgzEsQ9MO3giKH7Buw7 QGTweOYQG4qAcR761eoWdDK31WAnFisH6cQ+/v4ClBeAPzvzXUv9MBAWdtBTGKj9+HAt V8KtMEUjqTpH80jjz7ljr80VPqC1RBLpNjCmAP1qw9N+8sBArbXLu9zxGyS82JilPtu4 77eh8kdbRCIrT/Xb8anal3CF71eFn3RaCAnE8o2SaqLJfuQPt7yu6LuzSiEb/+UK46Gk vnsidjTeG6vB5QMOXtgHJVg3SKMvQ0RebFjphuEOv9aFRuSDwVRJbEH698+GKq8RR2d7 I06A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i7si2293169pgs.487.2021.04.27.22.13.53; Tue, 27 Apr 2021 22:14:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235914AbhD1FN0 (ORCPT + 99 others); Wed, 28 Apr 2021 01:13:26 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:55043 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234587AbhD1FNQ (ORCPT ); Wed, 28 Apr 2021 01:13:16 -0400 Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 27 Apr 2021 22:12:32 -0700 X-QCInternal: smtphost Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/AES256-SHA; 27 Apr 2021 22:12:30 -0700 X-QCInternal: smtphost Received: from c-sanm-linux.qualcomm.com ([10.206.25.31]) by ironmsg01-blr.qualcomm.com with ESMTP; 28 Apr 2021 10:42:01 +0530 Received: by c-sanm-linux.qualcomm.com (Postfix, from userid 2343233) id 75FD4399E; Wed, 28 Apr 2021 10:42:00 +0530 (IST) From: Sandeep Maheswaram To: Andy Gross , Bjorn Andersson , Greg Kroah-Hartman , Felipe Balbi , Stephen Boyd , Doug Anderson , Matthias Kaehlcke Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Manu Gautam , Sandeep Maheswaram Subject: [PATCH v7 2/5] usb: dwc3: core: Host wake up support from system suspend Date: Wed, 28 Apr 2021 10:41:53 +0530 Message-Id: <1619586716-8687-3-git-send-email-sanm@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1619586716-8687-1-git-send-email-sanm@codeaurora.org> References: <1619586716-8687-1-git-send-email-sanm@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Avoiding phy powerdown when wakeup capable devices are connected by checking phy_power_off flag. Phy should be on to wake up the device from suspend using wakeup capable devices such as keyboard and mouse. Signed-off-by: Sandeep Maheswaram Reviewed-by: Matthias Kaehlcke --- drivers/usb/dwc3/core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index b6e53d8..bb414c3 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1738,7 +1738,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg) dwc3_core_exit(dwc); break; case DWC3_GCTL_PRTCAP_HOST: - if (!PMSG_IS_AUTO(msg)) { + if (!PMSG_IS_AUTO(msg) && dwc->phy_power_off) { dwc3_core_exit(dwc); break; } @@ -1799,13 +1799,16 @@ static int dwc3_resume_common(struct dwc3 *dwc, pm_message_t msg) spin_unlock_irqrestore(&dwc->lock, flags); break; case DWC3_GCTL_PRTCAP_HOST: - if (!PMSG_IS_AUTO(msg)) { + if (!PMSG_IS_AUTO(msg) && dwc->phy_power_off) { ret = dwc3_core_init_for_resume(dwc); if (ret) return ret; dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST); break; + } else { + dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_HOST); } + /* Restore GUSB2PHYCFG bits that were modified in suspend */ reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0)); if (dwc->dis_u2_susphy_quirk) -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation