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 provide a kernel parameter that sets the USB timing
values to their spec minimums. The following patches do this by creating
a global struct which contains these values. By default the values remain
as they are now, but if usbcore.timing_minimum=1 is added to the kernel cmd
line they're set to their minimums. This struct can be expanded over time
to include other hardcoded values that have padding we can remove.

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: add switch to turn off padding of resume time delays
  USB: usb resume time delay debug

 Documentation/admin-guide/kernel-parameters.txt |  7 +++
 drivers/usb/core/hub.c                          | 12 ++---
 drivers/usb/core/usb.c                          | 71 +++++++++++++++++++++++++
 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/isp1362-hcd.c                  |  2 +-
 drivers/usb/host/ohci-hub.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                     |  6 +--
 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                             | 23 +++++++-
 20 files changed, 132 insertions(+), 33 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

Reply via email to