Merge tag 'nfs-for-5.14-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
[linux-block.git] / drivers / bluetooth / btusb.c
index 7f6ba2c975ed4e8e1c5e767cc2bb1dce7e594399..a9855a2dd5616d3ef9da27b8bc437bb1c732441d 100644 (file)
@@ -270,6 +270,8 @@ static const struct usb_device_id blacklist_table[] = {
                                                     BTUSB_WIDEBAND_SPEECH },
        { USB_DEVICE(0x0cf3, 0xe360), .driver_info = BTUSB_QCA_ROME |
                                                     BTUSB_WIDEBAND_SPEECH },
+       { USB_DEVICE(0x0cf3, 0xe500), .driver_info = BTUSB_QCA_ROME |
+                                                    BTUSB_WIDEBAND_SPEECH },
        { USB_DEVICE(0x0489, 0xe092), .driver_info = BTUSB_QCA_ROME |
                                                     BTUSB_WIDEBAND_SPEECH },
        { USB_DEVICE(0x0489, 0xe09f), .driver_info = BTUSB_QCA_ROME |
@@ -408,6 +410,11 @@ static const struct usb_device_id blacklist_table[] = {
        /* Additional MediaTek MT7615E Bluetooth devices */
        { USB_DEVICE(0x13d3, 0x3560), .driver_info = BTUSB_MEDIATEK},
 
+       /* Additional MediaTek MT7921 Bluetooth devices */
+       { USB_DEVICE(0x04ca, 0x3802), .driver_info = BTUSB_MEDIATEK |
+                                                    BTUSB_WIDEBAND_SPEECH |
+                                                    BTUSB_VALID_LE_STATES },
+
        /* Additional Realtek 8723AE Bluetooth devices */
        { USB_DEVICE(0x0930, 0x021d), .driver_info = BTUSB_REALTEK },
        { USB_DEVICE(0x13d3, 0x3394), .driver_info = BTUSB_REALTEK },
@@ -427,6 +434,10 @@ static const struct usb_device_id blacklist_table[] = {
        { USB_DEVICE(0x0bda, 0xb009), .driver_info = BTUSB_REALTEK },
        { USB_DEVICE(0x2ff8, 0xb011), .driver_info = BTUSB_REALTEK },
 
+       /* Additional Realtek 8761BU Bluetooth devices */
+       { USB_DEVICE(0x0b05, 0x190e), .driver_info = BTUSB_REALTEK |
+                                                    BTUSB_WIDEBAND_SPEECH },
+
        /* Additional Realtek 8821AE Bluetooth devices */
        { USB_DEVICE(0x0b05, 0x17dc), .driver_info = BTUSB_REALTEK },
        { USB_DEVICE(0x13d3, 0x3414), .driver_info = BTUSB_REALTEK },
@@ -1749,6 +1760,13 @@ static void btusb_work(struct work_struct *work)
                         * which work with WBS at all.
                         */
                        new_alts = btusb_find_altsetting(data, 6) ? 6 : 1;
+                       /* Because mSBC frames do not need to be aligned to the
+                        * SCO packet boundary. If support the Alt 3, use the
+                        * Alt 3 for HCI payload >= 60 Bytes let air packet
+                        * data satisfy 60 bytes.
+                        */
+                       if (new_alts == 1 && btusb_find_altsetting(data, 3))
+                               new_alts = 3;
                }
 
                if (btusb_switch_alt_setting(hdev, new_alts) < 0)
@@ -3312,11 +3330,6 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev,
        struct btmtk_wmt_hdr *hdr;
        int err;
 
-       /* Submit control IN URB on demand to process the WMT event */
-       err = btusb_mtk_submit_wmt_recv_urb(hdev);
-       if (err < 0)
-               return err;
-
        /* Send the WMT command and wait until the WMT event returns */
        hlen = sizeof(*hdr) + wmt_params->dlen;
        if (hlen > 255)
@@ -3342,6 +3355,11 @@ static int btusb_mtk_hci_wmt_sync(struct hci_dev *hdev,
                goto err_free_wc;
        }
 
+       /* Submit control IN URB on demand to process the WMT event */
+       err = btusb_mtk_submit_wmt_recv_urb(hdev);
+       if (err < 0)
+               goto err_free_wc;
+
        /* The vendor specific WMT commands are all answered by a vendor
         * specific event and will have the Command Status or Command
         * Complete as with usual HCI command flow control.
@@ -4062,6 +4080,11 @@ static int btusb_setup_qca_download_fw(struct hci_dev *hdev,
        sent += size;
        count -= size;
 
+       /* ep2 need time to switch from function acl to function dfu,
+        * so we add 20ms delay here.
+        */
+       msleep(20);
+
        while (count) {
                size = min_t(size_t, count, QCA_DFU_PACKET_LEN);
 
@@ -4154,9 +4177,15 @@ static int btusb_setup_qca_load_nvm(struct hci_dev *hdev,
        int err;
 
        if (((ver->flag >> 8) & 0xff) == QCA_FLAG_MULTI_NVM) {
-               snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x_%04x.bin",
-                        le32_to_cpu(ver->rom_version),
-                        le16_to_cpu(ver->board_id));
+               /* if boardid equal 0, use default nvm without surfix */
+               if (le16_to_cpu(ver->board_id) == 0x0) {
+                       snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x.bin",
+                                le32_to_cpu(ver->rom_version));
+               } else {
+                       snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x_%04x.bin",
+                               le32_to_cpu(ver->rom_version),
+                               le16_to_cpu(ver->board_id));
+               }
        } else {
                snprintf(fwname, sizeof(fwname), "qca/nvm_usb_%08x.bin",
                         le32_to_cpu(ver->rom_version));