Skip to content

Commit 461f95f

Browse files
hildawurholtmann
authored andcommitted
Bluetooth: btusb: USB alternate setting 1 for WBS
RTL8822CE supports transparent WBS to apply USB alternate setting 1. Add a flag to the device match data to apply alternate setting 1 which meet the transfer speed for WBS support. Signed-off-by: Hilda Wu <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent d4edda0 commit 461f95f

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

drivers/bluetooth/btusb.c

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ static const struct dmi_system_id btusb_needs_reset_resume_table[] = {
453453
#define BTUSB_HW_RESET_ACTIVE 12
454454
#define BTUSB_TX_WAIT_VND_EVT 13
455455
#define BTUSB_WAKEUP_DISABLE 14
456+
#define BTUSB_USE_ALT1_FOR_WBS 15
456457

457458
struct btusb_data {
458459
struct hci_dev *hdev;
@@ -1682,14 +1683,15 @@ static void btusb_work(struct work_struct *work)
16821683
new_alts = data->sco_num;
16831684
}
16841685
} else if (data->air_mode == HCI_NOTIFY_ENABLE_SCO_TRANSP) {
1685-
1686-
data->usb_alt6_packet_flow = true;
1687-
16881686
/* Check if Alt 6 is supported for Transparent audio */
1689-
if (btusb_find_altsetting(data, 6))
1687+
if (btusb_find_altsetting(data, 6)) {
1688+
data->usb_alt6_packet_flow = true;
16901689
new_alts = 6;
1691-
else
1690+
} else if (test_bit(BTUSB_USE_ALT1_FOR_WBS, &data->flags)) {
1691+
new_alts = 1;
1692+
} else {
16921693
bt_dev_err(hdev, "Device does not support ALT setting 6");
1694+
}
16931695
}
16941696

16951697
if (btusb_switch_alt_setting(hdev, new_alts) < 0)
@@ -4004,6 +4006,15 @@ static int btusb_probe(struct usb_interface *intf,
40044006
btusb_check_needs_reset_resume(intf);
40054007
}
40064008

4009+
if (id->driver_info & BTUSB_AMP) {
4010+
/* AMP controllers do not support SCO packets */
4011+
data->isoc = NULL;
4012+
} else {
4013+
/* Interface orders are hardcoded in the specification */
4014+
data->isoc = usb_ifnum_to_if(data->udev, ifnum_base + 1);
4015+
data->isoc_ifnum = ifnum_base + 1;
4016+
}
4017+
40074018
if (IS_ENABLED(CONFIG_BT_HCIBTUSB_RTL) &&
40084019
(id->driver_info & BTUSB_REALTEK)) {
40094020
hdev->setup = btrtl_setup_realtek;
@@ -4015,21 +4026,16 @@ static int btusb_probe(struct usb_interface *intf,
40154026
* (DEVICE_REMOTE_WAKEUP)
40164027
*/
40174028
set_bit(BTUSB_WAKEUP_DISABLE, &data->flags);
4029+
if (btusb_find_altsetting(data, 1))
4030+
set_bit(BTUSB_USE_ALT1_FOR_WBS, &data->flags);
4031+
else
4032+
bt_dev_err(hdev, "Device does not support ALT setting 1");
40184033

40194034
err = usb_autopm_get_interface(intf);
40204035
if (err < 0)
40214036
goto out_free_dev;
40224037
}
40234038

4024-
if (id->driver_info & BTUSB_AMP) {
4025-
/* AMP controllers do not support SCO packets */
4026-
data->isoc = NULL;
4027-
} else {
4028-
/* Interface orders are hardcoded in the specification */
4029-
data->isoc = usb_ifnum_to_if(data->udev, ifnum_base + 1);
4030-
data->isoc_ifnum = ifnum_base + 1;
4031-
}
4032-
40334039
if (!reset)
40344040
set_bit(HCI_QUIRK_RESET_ON_CLOSE, &hdev->quirks);
40354041

0 commit comments

Comments
 (0)