linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: qcom: Honor wakeup enabled/disabled state
@ 2020-09-15 19:31 Matthias Kaehlcke
  2020-09-15 23:50 ` Bjorn Andersson
  0 siblings, 1 reply; 4+ messages in thread
From: Matthias Kaehlcke @ 2020-09-15 19:31 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Felipe Balbi, Greg Kroah-Hartman
  Cc: Douglas Anderson, Manu Gautam, linux-usb, linux-arm-msm,
	Lee Jones, linux-kernel, Matthias Kaehlcke

The dwc3-qcom currently enables wakeup interrupts unconditionally
when suspending, however this should not be done when wakeup is
disabled (e.g. through the sysfs attribute power/wakeup). Only
enable wakeup interrupts when device_may_wakeup() returns true.

Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver")
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
---

 drivers/usb/dwc3/dwc3-qcom.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c
index e1e78e9824b1..56d14c09506d 100644
--- a/drivers/usb/dwc3/dwc3-qcom.c
+++ b/drivers/usb/dwc3/dwc3-qcom.c
@@ -251,8 +251,10 @@ static int dwc3_qcom_suspend(struct dwc3_qcom *qcom)
 	for (i = qcom->num_clocks - 1; i >= 0; i--)
 		clk_disable_unprepare(qcom->clks[i]);
 
+	if (device_may_wakeup(qcom->dev))
+		dwc3_qcom_enable_interrupts(qcom);
+
 	qcom->is_suspended = true;
-	dwc3_qcom_enable_interrupts(qcom);
 
 	return 0;
 }
@@ -265,7 +267,8 @@ static int dwc3_qcom_resume(struct dwc3_qcom *qcom)
 	if (!qcom->is_suspended)
 		return 0;
 
-	dwc3_qcom_disable_interrupts(qcom);
+	if (device_may_wakeup(qcom->dev))
+		dwc3_qcom_disable_interrupts(qcom);
 
 	for (i = 0; i < qcom->num_clocks; i++) {
 		ret = clk_prepare_enable(qcom->clks[i]);
-- 
2.28.0.618.gf4bc123cb7-goog


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

end of thread, other threads:[~2021-03-02  8:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-15 19:31 [PATCH] usb: dwc3: qcom: Honor wakeup enabled/disabled state Matthias Kaehlcke
2020-09-15 23:50 ` Bjorn Andersson
2021-02-23 17:22   ` Matthias Kaehlcke
2021-03-02  7:06     ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).