linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: host: xhci: avoid calling two contineous times for xhci_suspend
@ 2020-07-03  6:25 Peter Chen
  2020-07-03  6:25 ` [PATCH 2/2] usb: host: xhci-plat: add wakeup entry at /sys Peter Chen
  0 siblings, 1 reply; 17+ messages in thread
From: Peter Chen @ 2020-07-03  6:25 UTC (permalink / raw)
  To: mathias.nyman; +Cc: linux-usb, gregkh, linux-imx, Peter Chen

If the xhci-plat.c is the platform driver, after the runtime pm is
enabled, the xhci_suspend is called if nothing is connected on
the port. When the system goes to suspend, it will call xhci_suspend again
if USB wakeup is enabled.

Since the runtime suspend wakeup setting is not always the same with
system suspend wakeup setting, eg, at runtime suspend, we always need
wakeup if the controller is in low power mode; but at suspend system,
we may not need wakeup. So, we move the judgement after changing
wakeup setting.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
---
 drivers/usb/host/xhci.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index ed468eed299c..66c894626be6 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -982,12 +982,15 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)
 			xhci->shared_hcd->state != HC_STATE_SUSPENDED)
 		return -EINVAL;
 
-	xhci_dbc_suspend(xhci);
-
 	/* Clear root port wake on bits if wakeup not allowed. */
 	if (!do_wakeup)
 		xhci_disable_port_wake_on_bits(xhci);
 
+	if (!HCD_HW_ACCESSIBLE(hcd))
+		return 0;
+
+	xhci_dbc_suspend(xhci);
+
 	/* Don't poll the roothubs on bus suspend. */
 	xhci_dbg(xhci, "%s: stopping port polling.\n", __func__);
 	clear_bit(HCD_FLAG_POLL_RH, &hcd->flags);
-- 
2.17.1


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

end of thread, other threads:[~2020-07-21 14:10 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-03  6:25 [PATCH 1/2] usb: host: xhci: avoid calling two contineous times for xhci_suspend Peter Chen
2020-07-03  6:25 ` [PATCH 2/2] usb: host: xhci-plat: add wakeup entry at /sys Peter Chen
2020-07-03 14:19   ` Alan Stern
2020-07-04  9:22     ` Peter Chen
2020-07-04 14:48       ` Alan Stern
2020-07-05  2:12         ` Peter Chen
2020-07-05 14:31           ` Alan Stern
2020-07-06  4:03             ` Peter Chen
2020-07-06 16:22               ` Alan Stern
2020-07-07  2:01                 ` Peter Chen
2020-07-07 16:11                   ` Alan Stern
2020-07-08  6:47                     ` Peter Chen
2020-07-08 15:02                       ` Alan Stern
2020-07-09  5:15                         ` Peter Chen
2020-07-09 14:50                           ` Alan Stern
2020-07-21 11:03                             ` Peter Chen
2020-07-21 14:10                               ` Alan Stern

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).