Skip to content

Commit 457ad22

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 7ac3d11 commit 457ad22

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>
@@ -387,9 +388,8 @@ static const struct usb_device_id blacklist_table[] = {
387388
#define BTUSB_FIRMWARE_LOADED 7
388389
#define BTUSB_FIRMWARE_FAILED 8
389390
#define BTUSB_BOOTING 9
390-
#define BTUSB_RESET_RESUME 10
391-
#define BTUSB_DIAG_RUNNING 11
392-
#define BTUSB_OOB_WAKE_ENABLED 12
391+
#define BTUSB_DIAG_RUNNING 10
392+
#define BTUSB_OOB_WAKE_ENABLED 11
393393

394394
struct btusb_data {
395395
struct hci_dev *hdev;
@@ -3117,6 +3117,12 @@ static int btusb_probe(struct usb_interface *intf,
31173117
if (id->driver_info & BTUSB_QCA_ROME) {
31183118
data->setup_on_usb = btusb_setup_qca;
31193119
hdev->set_bdaddr = btusb_set_bdaddr_ath3012;
3120+
3121+
/* QCA Rome devices lose their updated firmware over suspend,
3122+
* but the USB hub doesn't notice any status change.
3123+
* explicitly request a device reset on resume.
3124+
*/
3125+
interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME;
31203126
}
31213127

31223128
#ifdef CONFIG_BT_HCIBTUSB_RTL
@@ -3127,7 +3133,7 @@ static int btusb_probe(struct usb_interface *intf,
31273133
* but the USB hub doesn't notice any status change.
31283134
* Explicitly request a device reset on resume.
31293135
*/
3130-
set_bit(BTUSB_RESET_RESUME, &data->flags);
3136+
interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME;
31313137
}
31323138
#endif
31333139

@@ -3293,14 +3299,6 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
32933299
enable_irq(data->oob_wake_irq);
32943300
}
32953301

3296-
/* Optionally request a device reset on resume, but only when
3297-
* wakeups are disabled. If wakeups are enabled we assume the
3298-
* device will stay powered up throughout suspend.
3299-
*/
3300-
if (test_bit(BTUSB_RESET_RESUME, &data->flags) &&
3301-
!device_may_wakeup(&data->udev->dev))
3302-
data->udev->reset_resume = 1;
3303-
33043302
return 0;
33053303
}
33063304

0 commit comments

Comments
 (0)