Skip to content

RFC usb: dwc3: qcom: Keep wakeup option default off

Peter Chen linux-arm-msm linux-usb lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest1 patch 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1usb: dwc3: qcom: Keep wakeup option default offdrivers/usb/dwc3/dwc3-qcom.c+2 -31 reply

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] usb: dwc3: qcom: Keep wakeup option default off

This RFC proposes changing the default USB system wakeup policy of the Qualcomm DWC3 glue driver, and asks for feedback on whether the change of default is acceptable.

Current policy
--------------
When the controller node has the "wakeup-source" property, dwc3-qcom calls device_init_wakeup(dev, true). USB is then a system wakeup source by default. Users who do NOT want the system woken up by USB have to disable it:

echo disabled > /sys/devices/.../<dwc3 device>/power/wakeup

Proposed policy
---------------
"wakeup-source" only describes that the controller is capable of waking up the system (see Documentation/devicetree/bindings/power/wakeup-source.txt), so with this patch the driver only marks the device as wakeup capable, and power/wakeup starts out "disabled". Users who NEED USB as a wakeup source have to enable it:

echo enabled > /sys/devices/.../<dwc3 device>/power/wakeup

The motivation is:

- Users do not expect USB activity (connect/disconnect or USB line status changes) to wake up the system unless they asked for it.

- Power consumption. With wakeup enabled, host mode system suspend keeps the controller and PHYs powered (dwc3_core_exit() is skipped and the genpd is not powered off) so that the wakeup interrupts can fire. Today this extra power is spent by default, even on systems where USB is never used as a wakeup source and the controller could be fully powered off during suspend.

Comparison
----------

                       Current (default on)       Proposed (default off)
                       --------------------       ----------------------
Initial power/wakeup   enabled                    disabled
User action            write "disabled" if USB    write "enabled" if USB
                       wakeup is NOT wanted       wakeup IS wanted
Unexpected wakeups     possible (connect,         none unless the user
                       disconnect, noise)         opted in
Host mode suspend      controller/PHYs powered,   dwc3_core_exit() and
                       wakeup IRQs armed, genpd   genpd powered off
                       kept on
Suspend power          higher, even if USB        lower, USB fully powered
                       wakeup is never used       off
Attached devices on    stay suspended, resume     reset-resumed or
resume                 quickly                    re-enumerated

Possible regression
-------------------
This is a user-visible change for existing platforms. Many Qualcomm arm64 DTs set "wakeup-source" on the USB controller, with this patch:

- USB wakeup stops working until userspace (or a udev rule) writes "enabled" to the controller's power/wakeup.

- In host mode, because device_may_wakeup() is now false by default, system suspend takes the full power down path in dwc3_suspend_common() (dwc3_core_exit()) and dwc3_qcom_suspend() powers off the genpd. The controller resume may fail if power down path has not tested.

Comments on which policy is preferred for USB controllers, and whether the regression above is acceptable, are welcome.

Peter Chen (1):
usb: dwc3: qcom: Keep wakeup option default off

 drivers/usb/dwc3/dwc3-qcom.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0