public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: keep PHYs disabled during suspend
@ 2022-08-23 12:40 Johan Hovold
  2022-08-23 18:33 ` Matthias Kaehlcke
  0 siblings, 1 reply; 5+ messages in thread
From: Johan Hovold @ 2022-08-23 12:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi
  Cc: Matthias Kaehlcke, Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Krishna Kurapati, Pavankumar Kondeti, linux-arm-msm, linux-usb,
	linux-kernel, Johan Hovold

Commit 649f5c842ba3 ("usb: dwc3: core: Host wake up support from system
suspend") started leaving the PHYs enabled during suspend for
wakeup-capable controllers even though it turns out this had nothing to
do with wakeup.

Rather, the wakeup capability flag was (ab-)used as a proxy to configure
the suspend behaviour in an attempt to reduce power leakage on some
platforms.

Stop abusing the wakeup configuration and restore the 5.19 behaviour of
keeping the PHYs powered off during suspend. If needed, a dedicated
mechanism for configuring the PHY power state during suspend can be
added later.

Fixes: 649f5c842ba3 ("usb: dwc3: core: Host wake up support from system suspend")
Link: https://lore.kernel.org/r/Yuv7AM/5jtO/pgcm@google.com
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
 drivers/usb/dwc3/core.c      | 4 ++--
 drivers/usb/dwc3/dwc3-qcom.c | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 8c8e32651473..0cdb6be720e1 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1983,7 +1983,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) && !device_may_wakeup(dwc->dev)) {
+		if (!PMSG_IS_AUTO(msg)) {
 			dwc3_core_exit(dwc);
 			break;
 		}
@@ -2044,7 +2044,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) && !device_may_wakeup(dwc->dev)) {
+		if (!PMSG_IS_AUTO(msg)) {
 			ret = dwc3_core_init_for_resume(dwc);
 			if (ret)
 				return ret;
diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index 9a94b1ab8f7a..9995395baa12 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -904,7 +904,6 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
 
 	wakeup_source = of_property_read_bool(dev->of_node, "wakeup-source");
 	device_init_wakeup(&pdev->dev, wakeup_source);
-	device_init_wakeup(&qcom->dwc3->dev, wakeup_source);
 
 	qcom->is_suspended = false;
 	pm_runtime_set_active(dev);
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-25 13:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-23 12:40 [PATCH] usb: dwc3: keep PHYs disabled during suspend Johan Hovold
2022-08-23 18:33 ` Matthias Kaehlcke
2022-08-24  8:27   ` Johan Hovold
2022-08-24 16:41     ` Matthias Kaehlcke
2022-08-25 13:12       ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox