Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2759160pxb; Mon, 1 Nov 2021 00:56:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu+dlQPEJvStFy1OIYiMHnipQGCdFzzeKaj0EINUw2HNW0y27ZeCFxMV+5unL8WXadFKaB X-Received: by 2002:a05:6638:418f:: with SMTP id az15mr476637jab.56.1635753399035; Mon, 01 Nov 2021 00:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635753399; cv=none; d=google.com; s=arc-20160816; b=tcxpTiuHQUzZYeigiG3j0M/5cWygZWENZwCxLEy4AMnh2nt9dxD0rS8DOsFb9ljJih QacF+OL7AxPDSOucM1M5MiXqjurHCnoUsThKp8lDRaR3wwmPeibjKEPRzn573upGyPqM iMp1yeVEEIXx6uFrE9iM2ZpW6/0YTjB4XfoeUovEVUM+mcB0czd7wBE1Of2Gm1F47RfO Yk29xuevpClcA0s86FoaYjPkDmJXUpObMFDtZmr9Ma4/6KqSEhOhBCbunuM5OQ68x6cV Wfqs1Dgyhbs9WFVW85EdJ4cbzG9+/RrwjUDb72kNkiGhyBq9W374dYWoxkxI7863qVti 7uWA== 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=WqegnewrNuQ3nBCJakumAYPktDzd/O0Hg//x5CeiZyI=; b=wdH7CP2GxicUuT8ixHc411469Nw08kBYn8KBfQz2W6lRn7tY3LOxk+56zoYHS32eBK e2FvYtU3Wbcnr9382Aj7ICQxPTRPeLZ5E/dGR1RuRopKf23VqqvHDB+2Kx4fIfXYlFnD Nb8+6P0gDIC0/eBCP7kFaI0G1Ye6ix6nhFGMO7n4qCHTg4p19dnJYiHz113gGRGpoBho 4kmIMGlpPh/4QQBW8mrvHClZ87LKGgbLrntOBEFCaf6vr9YzOC7AFZyqvljdYcbBH0AB a1W2mJx6OST+YIQLUXeysRUAj67Zgt9M46i5QjsdV8MXYGjtQbSua5B0M6tgVe1G6GjW TDPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=FEh31ZYD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d12si7386999iow.10.2021.11.01.00.56.27; Mon, 01 Nov 2021 00:56:39 -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; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=FEh31ZYD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231673AbhKAH47 (ORCPT + 99 others); Mon, 1 Nov 2021 03:56:59 -0400 Received: from alexa-out-sd-02.qualcomm.com ([199.106.114.39]:49623 "EHLO alexa-out-sd-02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231402AbhKAH4x (ORCPT ); Mon, 1 Nov 2021 03:56:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1635753261; x=1667289261; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=WqegnewrNuQ3nBCJakumAYPktDzd/O0Hg//x5CeiZyI=; b=FEh31ZYDPvdL8YPS7jzZ8Q7ZHUd5nrQE9INTAnt+3Dm0Wue8hQp7waSp FeNdsRWvoBmCEvIKHa0qJNCYtNbo410XEJGhD6E4XK9y1Wry5UKE8rP/d O6x7e9VF7WBR5dpPuAdNw4tM2Ta6Qdl+0jOK1eC5MJx/RUg8KkN7gtajI 4=; Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-02.qualcomm.com with ESMTP; 01 Nov 2021 00:54:21 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg-SD-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Nov 2021 00:54:20 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.922.7; Mon, 1 Nov 2021 00:54:20 -0700 Received: from c-sanm-linux.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.922.7; Mon, 1 Nov 2021 00:54:16 -0700 From: Sandeep Maheswaram To: Andy Gross , Bjorn Andersson , Greg Kroah-Hartman , Felipe Balbi , Stephen Boyd , Doug Anderson , "Matthias Kaehlcke" , Mathias Nyman CC: , , , , , Sandeep Maheswaram Subject: [PATCH v9 5/5] usb: dwc3: qcom: Keep power domain on to support wakeup Date: Mon, 1 Nov 2021 13:23:44 +0530 Message-ID: <1635753224-23975-6-git-send-email-quic_c_sanm@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1635753224-23975-1-git-send-email-quic_c_sanm@quicinc.com> References: <1635753224-23975-1-git-send-email-quic_c_sanm@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) 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 --- drivers/usb/dwc3/dwc3-qcom.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index 356f4f8..23bf2c1 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 @@ -340,10 +341,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 (device_may_wakeup(&dwc->xhci->dev) && 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"); @@ -367,10 +373,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); -- 2.7.4