• Mathias Nyman's avatar
    usb: Avoid extra usb SET_SEL requests when enabling link power management · e146caf3
    Mathias Nyman authored
    The host needs to tell the device the exit latencies using the SET_SEL
    request before device initiated link powermanagement can be enabled.
    
    The exit latency values do not change after enumeration, it's enough
    to set them once. So do like Windows 10 and issue the SET_SEL request
    once just before setting the configuration.
    
    This is also the sequence described in USB 3.2 specs "9.1.2 Bus
    enumeration". SET_SEL is issued once before the Set Configuration
    request, and won't be cleared by the Set Configuration,
    Set Interface or ClearFeature (STALL) requests.
    
    Only warm reset, hot reset, set Address 0 clears the exit latencies.
    See USB 3.2 section 9.4.14 Table 9-10 Device parameters and events
    
    Add udev->lpm_devinit_allow, and set it if SET_SEL was successful.
    If not set, then don't try to enable device initiated LPM
    
    We used to issue a SET_SEL request every time lpm is enabled for either
    U1 or U2 link states, meaning a SET_SEL was issued twice after every
    Set Configuration and Set Interface requests, easily accumulating to
    over 15 SET_SEL requets during a USB3 webcam enumeration.
    Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20220506161807.3369439-1-mathias.nyman@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    e146caf3
hub.c 178 KB