From: Greg Kroah-Hartman Date: Wed, 1 Sep 2021 08:44:38 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v4.4.283~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=799a4abc6ff515eff31304aff19583bd81868579;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: bluetooth-btusb-check-conditions-before-enabling-usb-alt-3-for-wbs.patch vt_kdsetmode-extend-console-locking.patch --- diff --git a/queue-5.10/bluetooth-btusb-check-conditions-before-enabling-usb-alt-3-for-wbs.patch b/queue-5.10/bluetooth-btusb-check-conditions-before-enabling-usb-alt-3-for-wbs.patch new file mode 100644 index 00000000000..74d7c81d580 --- /dev/null +++ b/queue-5.10/bluetooth-btusb-check-conditions-before-enabling-usb-alt-3-for-wbs.patch @@ -0,0 +1,84 @@ +From 55981d3541812234e687062926ff199c83f79a39 Mon Sep 17 00:00:00 2001 +From: Pauli Virtanen +Date: Mon, 26 Jul 2021 21:02:06 +0300 +Subject: Bluetooth: btusb: check conditions before enabling USB ALT 3 for WBS +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pauli Virtanen + +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 +Fixes: e848dbd364ac ("Bluetooth: btusb: Add support USB ALT 3 for WBS") +Tested-by: Michał Kępień +Tested-by: Jonathan Lampérth +Signed-off-by: Luiz Augusto von Dentz +Signed-off-by: Greg Kroah-Hartman +--- + drivers/bluetooth/btusb.c | 22 ++++++++++++++-------- + 1 file changed, 14 insertions(+), 8 deletions(-) + +--- a/drivers/bluetooth/btusb.c ++++ b/drivers/bluetooth/btusb.c +@@ -486,6 +486,7 @@ static const struct dmi_system_id btusb_ + #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; +@@ -1718,16 +1719,20 @@ static void btusb_work(struct work_struc + /* 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) +@@ -4170,6 +4175,7 @@ static int btusb_probe(struct usb_interf + * (DEVICE_REMOTE_WAKEUP) + */ + set_bit(BTUSB_WAKEUP_DISABLE, &data->flags); ++ set_bit(BTUSB_USE_ALT3_FOR_WBS, &data->flags); + } + + if (!reset) diff --git a/queue-5.10/series b/queue-5.10/series index 50eb20bdb2e..e47d0bb7802 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -73,3 +73,5 @@ pipe-avoid-unnecessary-epollet-wakeups-under-normal-loads.patch pipe-do-fasync-notifications-for-every-pipe-io-not-just-state-changes.patch mtd-spinand-fix-incorrect-parameters-for-on-die-ecc.patch tipc-call-tipc_wait_for_connect-only-when-dlen-is-not-0.patch +vt_kdsetmode-extend-console-locking.patch +bluetooth-btusb-check-conditions-before-enabling-usb-alt-3-for-wbs.patch diff --git a/queue-5.10/vt_kdsetmode-extend-console-locking.patch b/queue-5.10/vt_kdsetmode-extend-console-locking.patch new file mode 100644 index 00000000000..6933476ad05 --- /dev/null +++ b/queue-5.10/vt_kdsetmode-extend-console-locking.patch @@ -0,0 +1,64 @@ +From 2287a51ba822384834dafc1c798453375d1107c7 Mon Sep 17 00:00:00 2001 +From: Linus Torvalds +Date: Mon, 30 Aug 2021 08:55:18 -0700 +Subject: vt_kdsetmode: extend console locking + +From: Linus Torvalds + +commit 2287a51ba822384834dafc1c798453375d1107c7 upstream. + +As per the long-suffering comment. + +Reported-by: Minh Yuan +Cc: Greg Kroah-Hartman +Cc: Jiri Slaby +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/vt/vt_ioctl.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +--- a/drivers/tty/vt/vt_ioctl.c ++++ b/drivers/tty/vt/vt_ioctl.c +@@ -246,6 +246,8 @@ int vt_waitactive(int n) + * + * XXX It should at least call into the driver, fbdev's definitely need to + * restore their engine state. --BenH ++ * ++ * Called with the console lock held. + */ + static int vt_kdsetmode(struct vc_data *vc, unsigned long mode) + { +@@ -262,7 +264,6 @@ static int vt_kdsetmode(struct vc_data * + return -EINVAL; + } + +- /* FIXME: this needs the console lock extending */ + if (vc->vc_mode == mode) + return 0; + +@@ -271,12 +272,10 @@ static int vt_kdsetmode(struct vc_data * + return 0; + + /* explicitly blank/unblank the screen if switching modes */ +- console_lock(); + if (mode == KD_TEXT) + do_unblank_screen(1); + else + do_blank_screen(1); +- console_unlock(); + + return 0; + } +@@ -378,7 +377,10 @@ static int vt_k_ioctl(struct tty_struct + if (!perm) + return -EPERM; + +- return vt_kdsetmode(vc, arg); ++ console_lock(); ++ ret = vt_kdsetmode(vc, arg); ++ console_unlock(); ++ return ret; + + case KDGETMODE: + return put_user(vc->vc_mode, (int __user *)arg);