Skip to content

Commit fed016a

Browse files
jwrdegoedegregkh
authored andcommitted
Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version
commit 61f5ace upstream. Commit 7d06d58 ("Revert "Bluetooth: btusb: fix QCA...suspend/resume"") removed the setting of the BTUSB_RESET_RESUME quirk for QCA Rome devices, instead favoring adding USB_QUIRK_RESET_RESUME quirks in usb/core/quirks.c. This was done because the DIY BTUSB_RESET_RESUME reset-resume handling has several issues (see the original commit message). An added advantage of moving over to the USB-core reset-resume handling is that it also disables autosuspend for these devices, which is similarly broken on these. But there are 2 issues with this approach: 1) It leaves the broken DIY BTUSB_RESET_RESUME code in place for Realtek devices. 2) Sofar only 2 of the 10 QCA devices known to the btusb code have been added to usb/core/quirks.c and if we fix the Realtek case the same way we need to add an additional 14 entries. So in essence we need to duplicate a large part of the usb_device_id table in btusb.c in usb/core/quirks.c and manually keep them in sync. This commit instead restores setting a reset-resume quirk for QCA devices in the btusb.c code, avoiding the duplicate usb_device_id table problem. This commit avoids the problems with the original DIY BTUSB_RESET_RESUME code by simply setting the USB_QUIRK_RESET_RESUME quirk directly on the usb_device. This commit also moves the BTUSB_REALTEK case over to directly setting the USB_QUIRK_RESET_RESUME on the usb_device and removes the now unused BTUSB_RESET_RESUME code. BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1514836 Fixes: 7d06d58 ("Revert "Bluetooth: btusb: fix QCA...suspend/resume"") Cc: Leif Liddy <[email protected]> Cc: Matthias Kaehlcke <[email protected]> Cc: Brian Norris <[email protected]> Cc: Daniel Drake <[email protected]> Cc: Kai-Heng Feng <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 2a2ee0c commit fed016a

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

drivers/bluetooth/btusb.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
#include <linux/module.h>
2525
#include <linux/usb.h>
26+
#include <linux/usb/quirks.h>
2627
#include <linux/firmware.h>
2728
#include <linux/of_device.h>
2829
#include <linux/of_irq.h>
@@ -392,9 +393,8 @@ static const struct usb_device_id blacklist_table[] = {
392393
#define BTUSB_FIRMWARE_LOADED 7
393394
#define BTUSB_FIRMWARE_FAILED 8
394395
#define BTUSB_BOOTING 9
395-
#define BTUSB_RESET_RESUME 10
396-
#define BTUSB_DIAG_RUNNING 11
397-
#define BTUSB_OOB_WAKE_ENABLED 12
396+
#define BTUSB_DIAG_RUNNING 10
397+
#define BTUSB_OOB_WAKE_ENABLED 11
398398

399399
struct btusb_data {
400400
struct hci_dev *hdev;
@@ -3099,6 +3099,12 @@ static int btusb_probe(struct usb_interface *intf,
30993099
if (id->driver_info & BTUSB_QCA_ROME) {
31003100
data->setup_on_usb = btusb_setup_qca;
31013101
hdev->set_bdaddr = btusb_set_bdaddr_ath3012;
3102+
3103+
/* QCA Rome devices lose their updated firmware over suspend,
3104+
* but the USB hub doesn't notice any status change.
3105+
* explicitly request a device reset on resume.
3106+
*/
3107+
interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME;
31023108
}
31033109

31043110
#ifdef CONFIG_BT_HCIBTUSB_RTL
@@ -3109,7 +3115,7 @@ static int btusb_probe(struct usb_interface *intf,
31093115
* but the USB hub doesn't notice any status change.
31103116
* Explicitly request a device reset on resume.
31113117
*/
3112-
set_bit(BTUSB_RESET_RESUME, &data->flags);
3118+
interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME;
31133119
}
31143120
#endif
31153121

@@ -3274,14 +3280,6 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
32743280
enable_irq(data->oob_wake_irq);
32753281
}
32763282

3277-
/* Optionally request a device reset on resume, but only when
3278-
* wakeups are disabled. If wakeups are enabled we assume the
3279-
* device will stay powered up throughout suspend.
3280-
*/
3281-
if (test_bit(BTUSB_RESET_RESUME, &data->flags) &&
3282-
!device_may_wakeup(&data->udev->dev))
3283-
data->udev->reset_resume = 1;
3284-
32853283
return 0;
32863284
}
32873285

0 commit comments

Comments
 (0)