linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] USB: Don't enable LPM if it's already enabled
@ 2018-10-30  5:54 Kai-Heng Feng
  2018-10-30  6:16 ` kbuild test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kai-Heng Feng @ 2018-10-30  5:54 UTC (permalink / raw)
  To: gregkh; +Cc: linux-usb, linux-kernel, Kai-Heng Feng

USB Bluetooth controller QCA ROME (0cf3:e007) sometimes stops working
after S3:
[ 165.110742] Bluetooth: hci0: using NVM file: qca/nvm_usb_00000302.bin
[ 168.432065] Bluetooth: hci0: Failed to send body at 4 of 1953 (-110)

After some experiments, I found that disabling LPM can workaround the
issue.

On some platforms, the USB power is cut during S3, so the driver uses
reset-resume to resume the device. During port resume, LPM gets enabled
twice, by usb_reset_and_verify_device() and usb_port_resume().

So let's enable LPM for just once, as this solves the issue for the
device in question.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
---
 drivers/usb/core/driver.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 53564386ed57..e11d2eac76b6 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -1901,7 +1901,8 @@ int usb_set_usb2_hardware_lpm(struct usb_device *udev, int enable)
 	struct usb_hcd *hcd = bus_to_hcd(udev->bus);
 	int ret = -EPERM;
 
-	if (enable && !udev->usb2_hw_lpm_allowed)
+	if (enable && !udev->usb2_hw_lpm_allowed ||
+	    udev->usb2_hw_lpm_enabled == enable)
 		return 0;
 
 	if (hcd->driver->set_usb2_hw_lpm) {
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-10-30 15:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-30  5:54 [PATCH] USB: Don't enable LPM if it's already enabled Kai-Heng Feng
2018-10-30  6:16 ` kbuild test robot
2018-10-30  6:30 ` kbuild test robot
2018-10-30 14:24 ` Mathias Nyman
2018-10-30 15:00   ` Alan Stern
2018-10-30 15:07     ` Kai Heng Feng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).