]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/bluetooth/btusb.c
Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version
[mirror_ubuntu-artful-kernel.git] / drivers / bluetooth / btusb.c
index 3cd448354ecbd40e8d0140f8feacca0d15d5444a..03ca42d78899d334072fc232738351265ad87c80 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <linux/module.h>
 #include <linux/usb.h>
+#include <linux/usb/quirks.h>
 #include <linux/firmware.h>
 #include <linux/of_device.h>
 #include <linux/of_irq.h>
@@ -385,9 +386,8 @@ static const struct usb_device_id blacklist_table[] = {
 #define BTUSB_FIRMWARE_LOADED  7
 #define BTUSB_FIRMWARE_FAILED  8
 #define BTUSB_BOOTING          9
-#define BTUSB_RESET_RESUME     10
-#define BTUSB_DIAG_RUNNING     11
-#define BTUSB_OOB_WAKE_ENABLED 12
+#define BTUSB_DIAG_RUNNING     10
+#define BTUSB_OOB_WAKE_ENABLED 11
 
 struct btusb_data {
        struct hci_dev       *hdev;
@@ -3074,6 +3074,12 @@ static int btusb_probe(struct usb_interface *intf,
        if (id->driver_info & BTUSB_QCA_ROME) {
                data->setup_on_usb = btusb_setup_qca;
                hdev->set_bdaddr = btusb_set_bdaddr_ath3012;
+
+               /* QCA Rome devices lose their updated firmware over suspend,
+                * but the USB hub doesn't notice any status change.
+                * explicitly request a device reset on resume.
+                */
+               interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME;
        }
 
 #ifdef CONFIG_BT_HCIBTUSB_RTL
@@ -3084,7 +3090,7 @@ static int btusb_probe(struct usb_interface *intf,
                 * but the USB hub doesn't notice any status change.
                 * Explicitly request a device reset on resume.
                 */
-               set_bit(BTUSB_RESET_RESUME, &data->flags);
+               interface_to_usbdev(intf)->quirks |= USB_QUIRK_RESET_RESUME;
        }
 #endif
 
@@ -3249,14 +3255,6 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)
                enable_irq(data->oob_wake_irq);
        }
 
-       /* Optionally request a device reset on resume, but only when
-        * wakeups are disabled. If wakeups are enabled we assume the
-        * device will stay powered up throughout suspend.
-        */
-       if (test_bit(BTUSB_RESET_RESUME, &data->flags) &&
-           !device_may_wakeup(&data->udev->dev))
-               data->udev->reset_resume = 1;
-
        return 0;
 }