Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp6778866ioo; Thu, 2 Jun 2022 13:34:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCWV1XeGmpNvtyz1z4uPO1uM/KLLsgFhOrpyRZEpQbg6r8Ei8i4WWMTGzxuqU6GaoA5OWK X-Received: by 2002:a63:e604:0:b0:3fc:46ba:5dbb with SMTP id g4-20020a63e604000000b003fc46ba5dbbmr5824437pgh.277.1654202067408; Thu, 02 Jun 2022 13:34:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654202067; cv=none; d=google.com; s=arc-20160816; b=vUJYNv7lFAL+96n0o939xo6gxsgl4jJt7ALOQbKjtyimZ5w3tQG4BWX7Tr9jyRL/RB 2+HXl0u2J2bddUTKM75XIZVCS+lsYi+ZAb1Hd4h8cgmTE5IJhJz5PMs5y8DwO54IwuMs FKuZ0CVIiQXpJfpfdgCfHPbFbep+NsXDBO8TwhNHNrEvn/cV/o9ubsAkcwe764IajPts ZoSpz4VMEfWlW613Il80q8PTiaSuNnpieol7bRKzi9g7xxxZ7Z5it0arWbb/cT1RrAXw re617V2GUjf1P+cXxZKL8TpiHbrv5VsuWJU60HQ6FNO5Fhh7fDGdtb/LCOddKuDylecP M/Kg== 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=Uclr9TNqmmdXvvT/NbtqpYkZ+jeCIKQ2HEPc798ulwA=; b=NuiwyK+xZJ1jH6JdKRcoTfbYYBITtK+wV+x/sGxyplSXG9iyo9WtR+7DHal3Tt47tE k/wshfF7S4qHbPNjiYVQ9hV/JL9piMp70uJfnQ2jG1s9SNyezVnthJ2lUhHphIN3UUAP mS1I0xIM5dKBJBw1RVFWuc8ZpuEB0WxrzY2i7/6IVgJvKURDk85ZoG48j4t8rGWh21vz xHr8G7Zn2jjvNs4j2QwEcTT75+QVoGqs29NK+4Zt6FRop8sBaGwq+6x0FdbYSqyGWJGh 5SK4+KMKaCVPSUhMu0lym41bV7Bh+CbH8O4sYoS7z02vMzlWTHoAcqM6Iq7FXaGlOPbq iPcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=kdVmN3En; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z186-20020a6365c3000000b003c6a370aa3fsi7176892pgb.439.2022.06.02.13.34.05; Thu, 02 Jun 2022 13:34:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=kdVmN3En; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232258AbiFBIZW (ORCPT + 99 others); Thu, 2 Jun 2022 04:25:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231558AbiFBIZT (ORCPT ); Thu, 2 Jun 2022 04:25:19 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74E4616581; Thu, 2 Jun 2022 01:25:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1654158317; x=1685694317; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=Uclr9TNqmmdXvvT/NbtqpYkZ+jeCIKQ2HEPc798ulwA=; b=kdVmN3EnlNaz9Bujc8DHYRdvf7iInL3KSuk8AILjQam1TvDe7Jty9509 b+ITb9v1mwsoq9uCWmogX+wlZ1u0cm6WYMf+9o7ro0xJ65/SVhx3kw7Zw eCc2AcU3yV9qJJgTHkoKtF388XrGw/He8kch3tlMRNnFTNeXbTRskgusD k=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-02.qualcomm.com with ESMTP; 02 Jun 2022 01:25:17 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg04-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2022 01:25:16 -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.986.22; Thu, 2 Jun 2022 01:25:16 -0700 Received: from hu-kriskura-hyd.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.986.22; Thu, 2 Jun 2022 01:25:09 -0700 From: Krishna Kurapati To: Krzysztof Kozlowski , Rob Herring , Andy Gross , Bjorn Andersson , Greg Kroah-Hartman , Felipe Balbi , Stephen Boyd , Doug Anderson , "Matthias Kaehlcke" , Mathias Nyman CC: , , , , , , , , Sandeep Maheswaram , Krishna Kurapati Subject: [PATCH v20 2/5] usb: dwc3: core: Host wake up support from system suspend Date: Thu, 2 Jun 2022 13:54:34 +0530 Message-ID: <1654158277-12921-3-git-send-email-quic_kriskura@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1654158277-12921-1-git-send-email-quic_kriskura@quicinc.com> References: <1654158277-12921-1-git-send-email-quic_kriskura@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) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sandeep Maheswaram Check wakeup-source property for dwc3 core node to set the wakeup capability. Drop the device_init_wakeup call from runtime suspend and resume. If the dwc3 is wakeup capable, don't power down the USB PHY(s). The glue drivers are expected to take care of configuring the additional wakeup settings if needed based on the dwc3 wakeup capability status. In some SOC designs, powering off the PHY is resulting in higher leakage, so this patch save power on such boards. Signed-off-by: Sandeep Maheswaram Signed-off-by: Krishna Kurapati Reviewed-by: Pavankumar Kondeti --- drivers/usb/dwc3/core.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index e027c04..b99d3c2 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1787,6 +1787,7 @@ static int dwc3_probe(struct platform_device *pdev) platform_set_drvdata(pdev, dwc); dwc3_cache_hwparams(dwc); + device_init_wakeup(&pdev->dev, of_property_read_bool(dev->of_node, "wakeup-source")); spin_lock_init(&dwc->lock); mutex_init(&dwc->mutex); @@ -1948,7 +1949,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) && !device_can_wakeup(dwc->dev)) { dwc3_core_exit(dwc); break; } @@ -2009,7 +2010,7 @@ 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) && !device_can_wakeup(dwc->dev)) { ret = dwc3_core_init_for_resume(dwc); if (ret) return ret; @@ -2086,8 +2087,6 @@ static int dwc3_runtime_suspend(struct device *dev) if (ret) return ret; - device_init_wakeup(dev, true); - return 0; } @@ -2096,8 +2095,6 @@ static int dwc3_runtime_resume(struct device *dev) struct dwc3 *dwc = dev_get_drvdata(dev); int ret; - device_init_wakeup(dev, false); - ret = dwc3_resume_common(dwc, PMSG_AUTO_RESUME); if (ret) return ret; -- 2.7.4