Skip to content

RFC hibernate and roothub port power

Mathias Nyman linux-usb 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest1 patch 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1xhci: pci: power off roothub ports in hibernate poweroff_late stagedrivers/usb/host/xhci-hub.c drivers/usb/host/xhci-pci.c drivers/usb/host/xhci.h+35 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/1] hibernate and roothub port power

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(-)
Signature · 1 line
2.25.1