Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3461715pxv; Mon, 28 Jun 2021 05:11:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhlAENeAOf+V07/PB357tNpJUsog9VcpSW+p0SJb3WwUq5XcRw+WkXr/8MPA/m9dvzDr3d X-Received: by 2002:aa7:dad2:: with SMTP id x18mr21564174eds.319.1624882277228; Mon, 28 Jun 2021 05:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624882277; cv=none; d=google.com; s=arc-20160816; b=cCaM64ldrJytmzvJTkAVIYt4EHteM6KqRe9pbELEPc/+heJpZgHfjDRtAsRJ9oZBWy 5sGO3caOjlKCVWgGQM7BswGV6rt1bojTdExJpw6Xjzs4xzAR3cbxmq4PODGLqV5DURcT L2puqo9ivQ3lFt6FkItEvJgjV9tV8Bmpc6cqyI/ScNqJ4QP3z2r0j7yuB0jWlhLavFqy /SchFGc7H0eUxjlBFP2p9582CNayVxLtPq0i5ojmr9iA9HhLEDSmdAV+wxTG4I7pWVg+ sBOtz+SqZPoPlPpLwYhTw/C0jbe0vKvzhq6DYL9l4J+RhwRtXodeFCbLpAV0AzNtZ2/y huUA== 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=bZvVIPYNol1KIFE34E5tBfDqfzDdNRHvmoZhsd1ZLp4=; b=CZG+58eLzqZe0+WtI2Ro/e0D2QuFVdQM9DZQ/cPfi5Rbq02x65zAZH0OAsiRtRyL2W rITq0MkhtJLPZ7hcLiuyDrWbc8Wqp3sAqo4UEQFD6RllLpKE20wfAVeO5UgsH0n+ku4z TevRghRo6DbcUXBFmtgCdsSJjU0CRJ0B3pDNohk6iewNgyPk8jFmQo8/kRda5ge+1hbN v/XGS8FhUhwNRAPYzKRKkKkn3LO9yvt9G/dyesWQsjc/isTKgrD7uMv8KwJroBZFrgrC sHbwv1iSplu1Uozg/IYLEyVCoV05qUeLej2Bu12g73msLXMG5r/AmHEi9fNqowY7HAm+ HbQw== 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 ga41si7042876ejc.571.2021.06.28.05.10.52; Mon, 28 Jun 2021 05:11:17 -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 S232987AbhF1MLn (ORCPT + 99 others); Mon, 28 Jun 2021 08:11:43 -0400 Received: from alexa-out.qualcomm.com ([129.46.98.28]:6161 "EHLO alexa-out.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232946AbhF1ML0 (ORCPT ); Mon, 28 Jun 2021 08:11:26 -0400 Received: from ironmsg07-lv.qualcomm.com ([10.47.202.151]) by alexa-out.qualcomm.com with ESMTP; 28 Jun 2021 05:09:01 -0700 X-QCInternal: smtphost Received: from ironmsg02-blr.qualcomm.com ([10.86.208.131]) by ironmsg07-lv.qualcomm.com with ESMTP/TLS/AES256-SHA; 28 Jun 2021 05:08:59 -0700 X-QCInternal: smtphost Received: from c-sanm-linux.qualcomm.com ([10.206.25.31]) by ironmsg02-blr.qualcomm.com with ESMTP; 28 Jun 2021 17:38:32 +0530 Received: by c-sanm-linux.qualcomm.com (Postfix, from userid 2343233) id 7B60F3A48; Mon, 28 Jun 2021 17:38:31 +0530 (IST) From: Sandeep Maheswaram To: Andy Gross , Bjorn Andersson , Greg Kroah-Hartman , Felipe Balbi , Stephen Boyd , Doug Anderson , Matthias Kaehlcke , Mathias Nyman Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Pratham Pratap , Sandeep Maheswaram Subject: [PATCH v8 6/6] usb: dwc3: qcom: Keep power domain on to support wakeup Date: Mon, 28 Jun 2021 17:38:17 +0530 Message-Id: <1624882097-23265-7-git-send-email-sanm@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1624882097-23265-1-git-send-email-sanm@codeaurora.org> References: <1624882097-23265-1-git-send-email-sanm@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If wakeup capable devices are connected to the controller (directly or through hubs) at suspend time keep the power domain on in order to support wakeup from these devices. Signed-off-by: Sandeep Maheswaram --- Checking phy_power_off flag instead of usb_wakeup_enabled_descendants to keep gdsc active. drivers/usb/dwc3/dwc3-qcom.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index 82125bc..ba31aa3 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -355,9 +356,15 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom) u32 val; int i, ret; + 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->phy_power_off && dwc->xhci) + 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 +389,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); -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation