* Bluetooth: btusb: check conditions before enabling USB ALT 3 for WBS
@ 2021-08-18 23:04 Mike
2021-08-19 5:44 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Mike @ 2021-08-18 23:04 UTC (permalink / raw)
To: stable; +Cc: pav
From: Pauli Virtanen <pav@iki.fi>
Kernel Version 5.13
commit 55981d3541812234e687062926ff199c83f79a39 upstream.
Some USB BT adapters don't satisfy the MTU requirement mentioned in
commit e848dbd364ac ("Bluetooth: btusb: Add support USB ALT 3 for WBS")
and have ALT 3 setting that produces no/garbled audio. Some adapters
with larger MTU were also reported to have problems with ALT 3.
Add a flag and check it and MTU before selecting ALT 3, falling back to
ALT 1. Enable the flag for Realtek, restoring the previous behavior for
non-Realtek devices.
Tested with USB adapters (mtu<72, no/garbled sound with ALT3, ALT1
works) BCM20702A1 0b05:17cb, CSR8510A10 0a12:0001, and (mtu>=72, ALT3
works) RTL8761BU 0bda:8771, Intel AX200 8087:0029 (after disabling
ALT6). Also got reports for (mtu>=72, ALT 3 reported to produce bad
audio) Intel 8087:0a2b.
Signed-off-by: Pauli Virtanen <pav@iki.fi>
Fixes: e848dbd364ac ("Bluetooth: btusb: Add support USB ALT 3 for WBS")
Tested-by: Michał Kępień <kernel@kempniu.pl>
Tested-by: Jonathan Lampérth <jon@h4n.dev>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
drivers/bluetooth/btusb.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 488f110e17e27..2336f731dbc7e 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -528,6 +528,7 @@ static const struct dmi_system_id btusb_needs_reset_resume_table[] = {
#define BTUSB_HW_RESET_ACTIVE 12
#define BTUSB_TX_WAIT_VND_EVT 13
#define BTUSB_WAKEUP_DISABLE 14
+#define BTUSB_USE_ALT3_FOR_WBS 15
struct btusb_data {
struct hci_dev *hdev;
@@ -1761,16 +1762,20 @@ static void btusb_work(struct work_struct *work)
/* Bluetooth USB spec recommends alt 6 (63 bytes), but
* many adapters do not support it. Alt 1 appears to
* work for all adapters that do not have alt 6, and
- * which work with WBS at all.
+ * which work with WBS at all. Some devices prefer
+ * alt 3 (HCI payload >= 60 Bytes let air packet
+ * data satisfy 60 bytes), requiring
+ * MTU >= 3 (packets) * 25 (size) - 3 (headers) = 72
+ * see also Core spec 5, vol 4, B 2.1.1 & Table 2.1.
*/
- 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))
+ if (btusb_find_altsetting(data, 6))
+ new_alts = 6;
+ else if (btusb_find_altsetting(data, 3) &&
+ hdev->sco_mtu >= 72 &&
+ test_bit(BTUSB_USE_ALT3_FOR_WBS, &data->flags))
new_alts = 3;
+ else
+ new_alts = 1;
}
if (btusb_switch_alt_setting(hdev, new_alts) < 0)
@@ -3882,6 +3887,7 @@ static int btusb_probe(struct usb_interface *intf,
* (DEVICE_REMOTE_WAKEUP)
*/
set_bit(BTUSB_WAKEUP_DISABLE, &data->flags);
+ set_bit(BTUSB_USE_ALT3_FOR_WBS, &data->flags);
}
if (!reset)
--
cgit 1.2.3-1.el7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: Bluetooth: btusb: check conditions before enabling USB ALT 3 for WBS
2021-08-18 23:04 Bluetooth: btusb: check conditions before enabling USB ALT 3 for WBS Mike
@ 2021-08-19 5:44 ` Greg KH
2021-08-19 11:24 ` Mike Pagano
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2021-08-19 5:44 UTC (permalink / raw)
To: Mike; +Cc: stable, pav
On Wed, Aug 18, 2021 at 07:04:47PM -0400, Mike wrote:
> From: Pauli Virtanen <pav@iki.fi>
> Kernel Version 5.13
>
> commit 55981d3541812234e687062926ff199c83f79a39 upstream.
There is no such commit in Linus's tree :(
> - 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))
> + if (btusb_find_altsetting(data, 6))
> + new_alts = 6;
> + else if (btusb_find_altsetting(data, 3) &&
> + hdev->sco_mtu >= 72 &&
> + test_bit(BTUSB_USE_ALT3_FOR_WBS, &data->flags))
> new_alts = 3;
Your patch is also corrupted and could not be applied :(
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Bluetooth: btusb: check conditions before enabling USB ALT 3 for WBS
2021-08-19 5:44 ` Greg KH
@ 2021-08-19 11:24 ` Mike Pagano
0 siblings, 0 replies; 3+ messages in thread
From: Mike Pagano @ 2021-08-19 11:24 UTC (permalink / raw)
To: Greg KH; +Cc: stable, pav
On 8/19/21 1:44 AM, Greg KH wrote:
> On Wed, Aug 18, 2021 at 07:04:47PM -0400, Mike wrote:
>> From: Pauli Virtanen <pav@iki.fi>
>> Kernel Version 5.13
>>
>> commit 55981d3541812234e687062926ff199c83f79a39 upstream.
>
> There is no such commit in Linus's tree :(
>
>
>> - 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))
>> + if (btusb_find_altsetting(data, 6))
>> + new_alts = 6;
>> + else if (btusb_find_altsetting(data, 3) &&
>> + hdev->sco_mtu >= 72 &&
>> + test_bit(BTUSB_USE_ALT3_FOR_WBS, &data->flags))
>> new_alts = 3;
>
>
> Your patch is also corrupted and could not be applied :(
>
You're totally right, Greg. My apologies. Never work when you're tired.
I'll resubmit when it makes Linus' tree unless the author does.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-19 11:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 23:04 Bluetooth: btusb: check conditions before enabling USB ALT 3 for WBS Mike
2021-08-19 5:44 ` Greg KH
2021-08-19 11:24 ` Mike Pagano
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.