Skip to content

Commit 61f5ace

Browse files
jwrdegoedeholtmann
authored andcommitted
Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version
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: [email protected] 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]>
1 parent 948c7ca commit 61f5ace

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>
@@ -390,9 +391,8 @@ static const struct usb_device_id blacklist_table[] = {
390391
#define BTUSB_FIRMWARE_LOADED 7
391392
#define BTUSB_FIRMWARE_FAILED 8
392393
#define BTUSB_BOOTING 9
393-
#define BTUSB_RESET_RESUME 10
394-
#define BTUSB_DIAG_RUNNING 11
395-
#define BTUSB_OOB_WAKE_ENABLED 12
394+
#define BTUSB_DIAG_RUNNING 10
395+
#define BTUSB_OOB_WAKE_ENABLED 11
396396

397397
struct btusb_data {
398398
struct hci_dev *hdev;
@@ -3120,6 +3120,12 @@ static int btusb_probe(struct usb_interface *intf,
31203120
if (id->driver_info & BTUSB_QCA_ROME) {
31213121
data->setup_on_usb = btusb_setup_qca;
31223122
hdev->set_bdaddr = btusb_set_bdaddr_ath3012;
3123+
3124+
/* QCA Rome devices lose their updated firmware over suspend,
3125+
* but the USB hub doesn't notice any status change.
3126+
* explicitly request a device reset on resume.
3127+
*/
3128+
interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME;
31233129
}
31243130

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

@@ -3299,14 +3305,6 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
32993305
enable_irq(data->oob_wake_irq);
33003306
}
33013307

3302-
/* Optionally request a device reset on resume, but only when
3303-
* wakeups are disabled. If wakeups are enabled we assume the
3304-
* device will stay powered up throughout suspend.
3305-
*/
3306-
if (test_bit(BTUSB_RESET_RESUME, &data->flags) &&
3307-
!device_may_wakeup(&data->udev->dev))
3308-
data->udev->reset_resume = 1;
3309-
33103308
return 0;
33113309
}
33123310

0 commit comments

Comments
 (0)