Revert "usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1"

Certain USB-C devices are failing to enumerate if the bus
transitions from active to suspend between connection and enumeration.

When a USB-C accessory is inserted in a phone and is detected by the
CC lines, the controller driver is loaded and the only devices present
on the bus are the root hubs, until the device enumerations.
As a result, a suspend transition between device connection and
enumeration is very likely.

This change leaves the hub autosuspend set to the usbcore.autosuspend
value so a value can be set high enough to prevent this race.

This reverts:
commit bdd405d2a5 ("usb: hub: Prevent hub autosuspend if usbcore.autosuspend is -1")

  If user specifies that USB autosuspend must be disabled by module
  parameter "usbcore.autosuspend=-1" then we must prevent
  autosuspend of USB hub devices as well.

  commit 596d789a21 introduced in v3.8 changed the original behaivour
  and stopped respecting the usbcore.autosuspend parameter for hubs.

Bug: 71936484
Change-Id: Ie20471b9e8d44f92f9eff97ed12ccd903c98c272
Signed-off-by: Thierry Strudel <tstrudel@google.com>
Signed-off-by: Andrew Chant <achant@google.com>
This commit is contained in:
Thierry Strudel 2018-05-09 11:36:40 -07:00 committed by Timi
parent daa6b3cc4a
commit 782f48975e

View file

@ -1724,14 +1724,8 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
* - Change autosuspend delay of hub can avoid unnecessary auto
* suspend timer for hub, also may decrease power consumption
* of USB bus.
*
* - If user has indicated to prevent autosuspend by passing
* usbcore.autosuspend = -1 then keep autosuspend disabled.
*/
#ifdef CONFIG_PM
if (hdev->dev.power.autosuspend_delay >= 0)
pm_runtime_set_autosuspend_delay(&hdev->dev, 0);
#endif
pm_runtime_set_autosuspend_delay(&hdev->dev, 0);
/*
* Hubs have proper suspend/resume support, except for root hubs