diff mbox series

[Unstable/OEM-5.14,1/1] UBUNTU: SAUCE: xhci: Remove CONFIG_USB_DEFAULT_PERSIST to prevent xHCI from runtime suspending

Message ID 20211210053801.101559-2-kai.heng.feng@canonical.com
State New
Headers show
Series Fix runtime power management on USB controller with XHCI_RESET_ON_RESUME flag | expand

Commit Message

Kai-Heng Feng Dec. 10, 2021, 5:38 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1954369

When the xHCI is quirked with XHCI_RESET_ON_RESUME, runtime resume
routine also resets the controller.

This is bad for USB drivers without reset_resume callback, because
there's no subsequent call of usb_dev_complete() ->
usb_resume_complete() to force rebinding the driver to the device. For
instance, btusb device stops working after xHCI controller is runtime
resumed, if the controlled is quirked with XHCI_RESET_ON_RESUME.

So always take XHCI_RESET_ON_RESUME into account to solve the issue.

Link: https://lore.kernel.org/linux-usb/20211119092628.677935-1-kai.heng.feng@canonical.com/
[Maintainer said the code is in his repo but I can't find it. Probably
went to vacation]
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/usb/host/xhci.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Timo Aaltonen Dec. 14, 2021, 3:19 p.m. UTC | #1
On 10.12.2021 7.38, Kai-Heng Feng wrote:
> BugLink: https://bugs.launchpad.net/bugs/1954369
> 
> When the xHCI is quirked with XHCI_RESET_ON_RESUME, runtime resume
> routine also resets the controller.
> 
> This is bad for USB drivers without reset_resume callback, because
> there's no subsequent call of usb_dev_complete() ->
> usb_resume_complete() to force rebinding the driver to the device. For
> instance, btusb device stops working after xHCI controller is runtime
> resumed, if the controlled is quirked with XHCI_RESET_ON_RESUME.
> 
> So always take XHCI_RESET_ON_RESUME into account to solve the issue.
> 
> Link: https://lore.kernel.org/linux-usb/20211119092628.677935-1-kai.heng.feng@canonical.com/
> [Maintainer said the code is in his repo but I can't find it. Probably
> went to vacation]
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
> ---
>   drivers/usb/host/xhci.c | 4 ----
>   1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 541fe4dcc43a2..4732e3f99cc52 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -3935,7 +3935,6 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
>   	struct xhci_slot_ctx *slot_ctx;
>   	int i, ret;
>   
> -#ifndef CONFIG_USB_DEFAULT_PERSIST
>   	/*
>   	 * We called pm_runtime_get_noresume when the device was attached.
>   	 * Decrement the counter here to allow controller to runtime suspend
> @@ -3943,7 +3942,6 @@ static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
>   	 */
>   	if (xhci->quirks & XHCI_RESET_ON_RESUME)
>   		pm_runtime_put_noidle(hcd->self.controller);
> -#endif
>   
>   	ret = xhci_check_args(hcd, udev, NULL, 0, true, __func__);
>   	/* If the host is halted due to driver unload, we still need to free the
> @@ -4095,14 +4093,12 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
>   
>   	xhci_debugfs_create_slot(xhci, slot_id);
>   
> -#ifndef CONFIG_USB_DEFAULT_PERSIST
>   	/*
>   	 * If resetting upon resume, we can't put the controller into runtime
>   	 * suspend if there is a device attached.
>   	 */
>   	if (xhci->quirks & XHCI_RESET_ON_RESUME)
>   		pm_runtime_get_noresume(hcd->self.controller);
> -#endif
>   
>   	/* Is this a LS or FS device under a HS hub? */
>   	/* Hub or peripherial? */
> 

applied to oem-5.14, thanks
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 541fe4dcc43a2..4732e3f99cc52 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3935,7 +3935,6 @@  static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
 	struct xhci_slot_ctx *slot_ctx;
 	int i, ret;
 
-#ifndef CONFIG_USB_DEFAULT_PERSIST
 	/*
 	 * We called pm_runtime_get_noresume when the device was attached.
 	 * Decrement the counter here to allow controller to runtime suspend
@@ -3943,7 +3942,6 @@  static void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
 	 */
 	if (xhci->quirks & XHCI_RESET_ON_RESUME)
 		pm_runtime_put_noidle(hcd->self.controller);
-#endif
 
 	ret = xhci_check_args(hcd, udev, NULL, 0, true, __func__);
 	/* If the host is halted due to driver unload, we still need to free the
@@ -4095,14 +4093,12 @@  int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
 
 	xhci_debugfs_create_slot(xhci, slot_id);
 
-#ifndef CONFIG_USB_DEFAULT_PERSIST
 	/*
 	 * If resetting upon resume, we can't put the controller into runtime
 	 * suspend if there is a device attached.
 	 */
 	if (xhci->quirks & XHCI_RESET_ON_RESUME)
 		pm_runtime_get_noresume(hcd->self.controller);
-#endif
 
 	/* Is this a LS or FS device under a HS hub? */
 	/* Hub or peripherial? */