The USB resume code in the kernel currently uses a set of hard coded delay values that are defined in the USB 2.0 spec. Specifically these three have the most effect on resume time:
- tdrsmdn: resume signal time (20ms - infinity) usb 2.0 spec 7.1.7.7 - trsmrcy: resume recovery time (10ms) usb 2.0 spec 7.1.7.7 - trstrcy: reset recovery time (0ms - infinity) usb 2.0 spec 7.1.7.5 These values have been padded considerably in order to accomodate non-compliant devices. - tdrsmdn: resume signal time = 40ms - trsmrcy: resume recovery time = 10ms - trstrcy: reset recovery time = 50ms I propose that we remove the padding and use the spec minumums instead. The following patches do this by creating a struct which contains these three values, and allowing a module parameter to select between the current defaults and the spec minimums. The patch could be simplified to just use 3 defines, but I'm wary of making changes to core USB code without providing a backup and alot of community testing. The first part is the core functionality. The second part provides a debug interface through sysfs to tweak the values directly at runtime. I've created a blog entry on 01.org with some analyze_suspend test cases illustrating the benefits: - https://01.org/suspendresume/blogs/tebrandt/2016/usb-resume-optimization-using-spec-minimum-delays Todd Brandt (2): USB: turn off padding of resume time delays USB: resume timing debug Documentation/kernel-parameters.txt | 3 + drivers/usb/core/hub.c | 127 ++++++++++++++++++++++++++++++++++-- drivers/usb/dwc2/hcd.c | 2 +- drivers/usb/host/ehci-hcd.c | 4 +- drivers/usb/host/ehci-hub.c | 6 +- drivers/usb/host/fotg210-hcd.c | 2 +- drivers/usb/host/isp116x-hcd.c | 2 +- drivers/usb/host/oxu210hp-hcd.c | 4 +- drivers/usb/host/r8a66597-hcd.c | 2 +- drivers/usb/host/sl811-hcd.c | 2 +- drivers/usb/host/uhci-hub.c | 4 +- drivers/usb/host/xhci-hub.c | 6 +- drivers/usb/host/xhci-ring.c | 2 +- drivers/usb/isp1760/isp1760-hcd.c | 2 +- drivers/usb/musb/musb_core.c | 6 +- drivers/usb/musb/musb_virthub.c | 2 +- include/linux/usb.h | 24 ++++++- 17 files changed, 171 insertions(+), 29 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html