From ee79d6800b6c65dd3d3f440dbadc5a2f5c83cd08 Mon Sep 17 00:00:00 2001 From: William Wu Date: Tue, 21 Feb 2017 16:02:36 +0800 Subject: [PATCH] usb: core: hub: add quirk for hub with broken autosuspend function Some USB host controller seems to have problems with autosuspend. For example, Rockchip rk3328 SoC USB 3.0 wouldn't handle remote wakeup correctly with external hub after entered autosuspend, caused to resume SS port fail. This patch introduces a new quirk flag for hub that should remain disabled for autosuspend. Change-Id: I6d14222b2c5025583fea811a6afd6abd22f41cb9 Signed-off-by: William Wu Signed-off-by: Frank Wang --- drivers/usb/core/hub.c | 3 ++- include/linux/usb/quirks.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 2df38b487858..6f900660d29f 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -1820,7 +1820,8 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) * bus_resume methods. */ if (hdev->parent) { /* normal device */ - usb_enable_autosuspend(hdev); + if (!(hdev->parent->quirks & USB_QUIRK_AUTO_SUSPEND)) + usb_enable_autosuspend(hdev); } else { /* root hub */ const struct hc_driver *drv = bus_to_hcd(hdev->bus)->driver; diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h index 5e4c497f54d6..6567f7445c2d 100644 --- a/include/linux/usb/quirks.h +++ b/include/linux/usb/quirks.h @@ -72,4 +72,7 @@ /* device has endpoints that should be ignored */ #define USB_QUIRK_ENDPOINT_IGNORE BIT(15) +/* device can't support auto suspend function */ +#define USB_QUIRK_AUTO_SUSPEND BIT(16) + #endif /* __LINUX_USB_QUIRKS_H */