1 |
commit: ce9ce2f6facb4a93def81aaf8f2dec5ef8ec5b2f |
2 |
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Aug 30 17:23:05 2021 +0000 |
4 |
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Aug 30 17:23:05 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=ce9ce2f6 |
7 |
|
8 |
Bluetooth: btusb: check conditions before enabling USB ALT 3 for WBS |
9 |
|
10 |
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org> |
11 |
|
12 |
0000_README | 4 ++ |
13 |
2700_Bluetooth-usb-alt-3-for-WBS.patch | 84 ++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 88 insertions(+) |
15 |
|
16 |
diff --git a/0000_README b/0000_README |
17 |
index 2619131..99766a3 100644 |
18 |
--- a/0000_README |
19 |
+++ b/0000_README |
20 |
@@ -55,6 +55,10 @@ Patch: 2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch |
21 |
From: https://lore.kernel.org/linux-bluetooth/20190522070540.48895-1-marcel@××××××××.org/raw |
22 |
Desc: Bluetooth: Check key sizes only when Secure Simple Pairing is enabled. See bug #686758 |
23 |
|
24 |
+Patch: 2700_Bluetooth-usb-alt-3-for-WBS.patch |
25 |
+From: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/commit/?id=55981d3541812234e687062926ff199c83f79a39 |
26 |
+Desc: Bluetooth: btusb: check conditions before enabling USB ALT 3 for WBS |
27 |
+ |
28 |
Patch: 2900_tmp513-Fix-build-issue-by-selecting-CONFIG_REG.patch |
29 |
From: https://bugs.gentoo.org/710790 |
30 |
Desc: tmp513 requies REGMAP_I2C to build. Select it by default in Kconfig. See bug #710790. Thanks to Phil Stracchino |
31 |
|
32 |
diff --git a/2700_Bluetooth-usb-alt-3-for-WBS.patch b/2700_Bluetooth-usb-alt-3-for-WBS.patch |
33 |
new file mode 100644 |
34 |
index 0000000..e0a67ea |
35 |
--- /dev/null |
36 |
+++ b/2700_Bluetooth-usb-alt-3-for-WBS.patch |
37 |
@@ -0,0 +1,84 @@ |
38 |
+From 55981d3541812234e687062926ff199c83f79a39 Mon Sep 17 00:00:00 2001 |
39 |
+From: Pauli Virtanen <pav@×××.fi> |
40 |
+Date: Mon, 26 Jul 2021 21:02:06 +0300 |
41 |
+Subject: Bluetooth: btusb: check conditions before enabling USB ALT 3 for WBS |
42 |
+MIME-Version: 1.0 |
43 |
+Content-Type: text/plain; charset=UTF-8 |
44 |
+Content-Transfer-Encoding: 8bit |
45 |
+ |
46 |
+Some USB BT adapters don't satisfy the MTU requirement mentioned in |
47 |
+commit e848dbd364ac ("Bluetooth: btusb: Add support USB ALT 3 for WBS") |
48 |
+and have ALT 3 setting that produces no/garbled audio. Some adapters |
49 |
+with larger MTU were also reported to have problems with ALT 3. |
50 |
+ |
51 |
+Add a flag and check it and MTU before selecting ALT 3, falling back to |
52 |
+ALT 1. Enable the flag for Realtek, restoring the previous behavior for |
53 |
+non-Realtek devices. |
54 |
+ |
55 |
+Tested with USB adapters (mtu<72, no/garbled sound with ALT3, ALT1 |
56 |
+works) BCM20702A1 0b05:17cb, CSR8510A10 0a12:0001, and (mtu>=72, ALT3 |
57 |
+works) RTL8761BU 0bda:8771, Intel AX200 8087:0029 (after disabling |
58 |
+ALT6). Also got reports for (mtu>=72, ALT 3 reported to produce bad |
59 |
+audio) Intel 8087:0a2b. |
60 |
+ |
61 |
+Signed-off-by: Pauli Virtanen <pav@×××.fi> |
62 |
+Fixes: e848dbd364ac ("Bluetooth: btusb: Add support USB ALT 3 for WBS") |
63 |
+Tested-by: Michał Kępień <kernel@×××××××.pl> |
64 |
+Tested-by: Jonathan Lampérth <jon@×××.dev> |
65 |
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@×××××.com> |
66 |
+--- |
67 |
+ drivers/bluetooth/btusb.c | 22 ++++++++++++++-------- |
68 |
+ 1 file changed, 14 insertions(+), 8 deletions(-) |
69 |
+ |
70 |
+diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c |
71 |
+index 488f110e17e27..2336f731dbc7e 100644 |
72 |
+--- a/drivers/bluetooth/btusb.c |
73 |
++++ b/drivers/bluetooth/btusb.c |
74 |
+@@ -528,6 +528,7 @@ static const struct dmi_system_id btusb_needs_reset_resume_table[] = { |
75 |
+ #define BTUSB_HW_RESET_ACTIVE 12 |
76 |
+ #define BTUSB_TX_WAIT_VND_EVT 13 |
77 |
+ #define BTUSB_WAKEUP_DISABLE 14 |
78 |
++#define BTUSB_USE_ALT3_FOR_WBS 15 |
79 |
+ |
80 |
+ struct btusb_data { |
81 |
+ struct hci_dev *hdev; |
82 |
+@@ -1761,16 +1762,20 @@ static void btusb_work(struct work_struct *work) |
83 |
+ /* Bluetooth USB spec recommends alt 6 (63 bytes), but |
84 |
+ * many adapters do not support it. Alt 1 appears to |
85 |
+ * work for all adapters that do not have alt 6, and |
86 |
+- * which work with WBS at all. |
87 |
++ * which work with WBS at all. Some devices prefer |
88 |
++ * alt 3 (HCI payload >= 60 Bytes let air packet |
89 |
++ * data satisfy 60 bytes), requiring |
90 |
++ * MTU >= 3 (packets) * 25 (size) - 3 (headers) = 72 |
91 |
++ * see also Core spec 5, vol 4, B 2.1.1 & Table 2.1. |
92 |
+ */ |
93 |
+- new_alts = btusb_find_altsetting(data, 6) ? 6 : 1; |
94 |
+- /* Because mSBC frames do not need to be aligned to the |
95 |
+- * SCO packet boundary. If support the Alt 3, use the |
96 |
+- * Alt 3 for HCI payload >= 60 Bytes let air packet |
97 |
+- * data satisfy 60 bytes. |
98 |
+- */ |
99 |
+- if (new_alts == 1 && btusb_find_altsetting(data, 3)) |
100 |
++ if (btusb_find_altsetting(data, 6)) |
101 |
++ new_alts = 6; |
102 |
++ else if (btusb_find_altsetting(data, 3) && |
103 |
++ hdev->sco_mtu >= 72 && |
104 |
++ test_bit(BTUSB_USE_ALT3_FOR_WBS, &data->flags)) |
105 |
+ new_alts = 3; |
106 |
++ else |
107 |
++ new_alts = 1; |
108 |
+ } |
109 |
+ |
110 |
+ if (btusb_switch_alt_setting(hdev, new_alts) < 0) |
111 |
+@@ -3882,6 +3887,7 @@ static int btusb_probe(struct usb_interface *intf, |
112 |
+ * (DEVICE_REMOTE_WAKEUP) |
113 |
+ */ |
114 |
+ set_bit(BTUSB_WAKEUP_DISABLE, &data->flags); |
115 |
++ set_bit(BTUSB_USE_ALT3_FOR_WBS, &data->flags); |
116 |
+ } |
117 |
+ |
118 |
+ if (!reset) |
119 |
+-- |
120 |
+cgit 1.2.3-1.el7 |
121 |
+ |