From patchwork Fri Apr 16 10:01:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sandeep Maheswaram X-Patchwork-Id: 423681 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=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 D4DB4C43462 for ; Fri, 16 Apr 2021 10:02:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A986D610FB for ; Fri, 16 Apr 2021 10:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242382AbhDPKDE (ORCPT ); Fri, 16 Apr 2021 06:03:04 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:11657 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242325AbhDPKDB (ORCPT ); Fri, 16 Apr 2021 06:03:01 -0400 Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 16 Apr 2021 03:02:37 -0700 X-QCInternal: smtphost Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/AES256-SHA; 16 Apr 2021 03:02:35 -0700 X-QCInternal: smtphost Received: from c-sanm-linux.qualcomm.com ([10.206.25.31]) by ironmsg01-blr.qualcomm.com with ESMTP; 16 Apr 2021 15:32:08 +0530 Received: by c-sanm-linux.qualcomm.com (Postfix, from userid 2343233) id EAB8438A5; Fri, 16 Apr 2021 15:32:06 +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 v6 5/5] usb: dwc3: qcom: Set genpd active wakeup flag for usb gdsc Date: Fri, 16 Apr 2021 15:31:53 +0530 Message-Id: <1618567313-25373-6-git-send-email-sanm@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1618567313-25373-1-git-send-email-sanm@codeaurora.org> References: <1618567313-25373-1-git-send-email-sanm@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Set genpd active wakeup flag for usb gdsc if wakeup capable devices are connected so that wake up happens without reenumeration. Signed-off-by: Sandeep Maheswaram --- drivers/usb/dwc3/dwc3-qcom.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index b1e9061..b61dc0b 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -17,9 +17,11 @@ #include #include #include +#include #include #include #include +#include #include "core.h" @@ -354,10 +356,19 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom) { u32 val; int i, ret; + struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3); + struct usb_hcd *hcd; + struct generic_pm_domain *genpd = pd_to_genpd(qcom->dev->pm_domain); if (qcom->is_suspended) return 0; + if (dwc->xhci) { + hcd = platform_get_drvdata(dwc->xhci); + if (usb_wakeup_enabled_descendants(hcd->self.root_hub)) + genpd->flags |= GENPD_FLAG_ACTIVE_WAKEUP; + } + val = readl(qcom->qscratch_base + PWR_EVNT_IRQ_STAT_REG); if (!(val & PWR_EVNT_LPM_IN_L2_MASK)) dev_err(qcom->dev, "HS-PHY not in L2\n"); @@ -382,9 +393,15 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom) int ret; int i; + struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3); + struct generic_pm_domain *genpd = pd_to_genpd(qcom->dev->pm_domain); + if (!qcom->is_suspended) return 0; + if (dwc->xhci) + genpd->flags &= ~GENPD_FLAG_ACTIVE_WAKEUP; + if (device_may_wakeup(qcom->dev)) dwc3_qcom_disable_interrupts(qcom);