linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/1] hibernate and roothub port power
@ 2022-06-07 13:58 Mathias Nyman
  2022-06-07 13:58 ` [RFC PATCH 1/1] xhci: pci: power off roothub ports in hibernate poweroff_late stage Mathias Nyman
  2022-06-08  8:19 ` [RFC PATCH 0/1] hibernate and roothub port power Oliver Neukum
  0 siblings, 2 replies; 13+ messages in thread
From: Mathias Nyman @ 2022-06-07 13:58 UTC (permalink / raw)
  To: linux-usb, stern; +Cc: evgreen, shobhit.srivastava, Mathias Nyman

Hi

Looking for comments on an issue where a self-powered usb device can
survive in suspended U3 state even if the host system is restarted.

This causes additional boot delay as boot firmware is not designed
to handle usb devices in U3.
Boot firmware waits for a usb state change in vain until it times out.

In shutdown (S5), with xHCI as host, this can be solved fairly easily
by turning off roothub port power in the .shutdown path.

This is discussed in xhci spec 4.19.4 for driver unload:
"Before the xHC driver is unloaded, the driver should clear the
Port Power (PP) flag of all Root Hub ports to place them into
the Disabled state and reduce port power consumption."

But for S4 hibernate things get more complicated.
We can't just turn off port power, especially if the usb device can
generate remote wake, and host should resume the system from S4.

But I can't come up with a better solution, so this RFC patch
does exactly that. It turns off port power for xHC roothub ports
in the hibernate poweroff_late stage, but only if the host isn't set
to wake up the system from S4.

This RFC workaround is specific to PCI xHC hosts, but if this solution
makes sense at all, shuold it be turned into a more generic solution?
Maybe calling hc_driver hcd->port_power(hcd, i, false) for each roothub
port in dev_pm_ops usb_hcd_pci_pm_ops .poweroff or .poweroff_late
callbacks?

Mathias Nyman (1):
  xhci: pci: power off roothub ports in hibernate poweroff_late stage

 drivers/usb/host/xhci-hub.c |  4 ++--
 drivers/usb/host/xhci-pci.c | 32 +++++++++++++++++++++++++++++++-
 drivers/usb/host/xhci.h     |  2 ++
 3 files changed, 35 insertions(+), 3 deletions(-)

-- 
2.25.1


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

end of thread, other threads:[~2022-08-15 20:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-07 13:58 [RFC PATCH 0/1] hibernate and roothub port power Mathias Nyman
2022-06-07 13:58 ` [RFC PATCH 1/1] xhci: pci: power off roothub ports in hibernate poweroff_late stage Mathias Nyman
2022-06-08  8:19 ` [RFC PATCH 0/1] hibernate and roothub port power Oliver Neukum
2022-06-08 11:47   ` Mathias Nyman
2022-06-08 13:43     ` Alan Stern
2022-06-09  7:59       ` Mathias Nyman
2022-06-09 13:48         ` Alan Stern
2022-06-10 10:30           ` Mathias Nyman
2022-06-09 15:08         ` Evan Green
2022-06-14 10:07           ` Mathias Nyman
2022-07-20 21:53             ` Evan Green
2022-08-09 13:49               ` Mathias Nyman
2022-08-15 19:01                 ` Evan Green

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