]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.12-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 Dec 2024 12:34:54 +0000 (13:34 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 Dec 2024 12:34:54 +0000 (13:34 +0100)
added patches:
bluetooth-btusb-mediatek-add-callback-function-in-btusb_disconnect.patch
bluetooth-btusb-mediatek-add-intf-release-flow-when-usb-disconnect.patch
bluetooth-btusb-mediatek-change-the-conditions-for-iso-interface.patch
bluetooth-btusb-mediatek-move-bluetooth-power-off-command-position.patch

queue-6.12/bluetooth-btusb-mediatek-add-callback-function-in-btusb_disconnect.patch [new file with mode: 0644]
queue-6.12/bluetooth-btusb-mediatek-add-intf-release-flow-when-usb-disconnect.patch [new file with mode: 0644]
queue-6.12/bluetooth-btusb-mediatek-change-the-conditions-for-iso-interface.patch [new file with mode: 0644]
queue-6.12/bluetooth-btusb-mediatek-move-bluetooth-power-off-command-position.patch [new file with mode: 0644]
queue-6.12/series

diff --git a/queue-6.12/bluetooth-btusb-mediatek-add-callback-function-in-btusb_disconnect.patch b/queue-6.12/bluetooth-btusb-mediatek-add-callback-function-in-btusb_disconnect.patch
new file mode 100644 (file)
index 0000000..6339daa
--- /dev/null
@@ -0,0 +1,40 @@
+From cea1805f165cdd783dd21f26df957118cb8641b4 Mon Sep 17 00:00:00 2001
+From: Chris Lu <chris.lu@mediatek.com>
+Date: Mon, 23 Sep 2024 16:47:03 +0800
+Subject: Bluetooth: btusb: mediatek: add callback function in btusb_disconnect
+
+From: Chris Lu <chris.lu@mediatek.com>
+
+commit cea1805f165cdd783dd21f26df957118cb8641b4 upstream.
+
+Add disconnect callback function in btusb_disconnect which is reserved
+for vendor specific usage before deregister hci in btusb_disconnect.
+
+Signed-off-by: Chris Lu <chris.lu@mediatek.com>
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Cc: Fedor Pchelkin <boddah8794@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/bluetooth/btusb.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/bluetooth/btusb.c
++++ b/drivers/bluetooth/btusb.c
+@@ -870,6 +870,7 @@ struct btusb_data {
+       int (*suspend)(struct hci_dev *hdev);
+       int (*resume)(struct hci_dev *hdev);
++      int (*disconnect)(struct hci_dev *hdev);
+       int oob_wake_irq;   /* irq for out-of-band wake-on-bt */
+       unsigned cmd_timeout_cnt;
+@@ -4043,6 +4044,9 @@ static void btusb_disconnect(struct usb_
+       if (data->diag)
+               usb_set_intfdata(data->diag, NULL);
++      if (data->disconnect)
++              data->disconnect(hdev);
++
+       hci_unregister_dev(hdev);
+       if (intf == data->intf) {
diff --git a/queue-6.12/bluetooth-btusb-mediatek-add-intf-release-flow-when-usb-disconnect.patch b/queue-6.12/bluetooth-btusb-mediatek-add-intf-release-flow-when-usb-disconnect.patch
new file mode 100644 (file)
index 0000000..92971e1
--- /dev/null
@@ -0,0 +1,86 @@
+From 489304e67087abddc2666c5af0159cb95afdcf59 Mon Sep 17 00:00:00 2001
+From: Chris Lu <chris.lu@mediatek.com>
+Date: Mon, 23 Sep 2024 16:47:04 +0800
+Subject: Bluetooth: btusb: mediatek: add intf release flow when usb disconnect
+
+From: Chris Lu <chris.lu@mediatek.com>
+
+commit 489304e67087abddc2666c5af0159cb95afdcf59 upstream.
+
+MediaTek claim an special usb intr interface for ISO data transmission.
+The interface need to be released before unregistering hci device when
+usb disconnect. Removing BT usb dongle without properly releasing the
+interface may cause Kernel panic while unregister hci device.
+
+Signed-off-by: Chris Lu <chris.lu@mediatek.com>
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Cc: Fedor Pchelkin <boddah8794@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/bluetooth/btusb.c |   20 +++++++++++++++-----
+ 1 file changed, 15 insertions(+), 5 deletions(-)
+
+--- a/drivers/bluetooth/btusb.c
++++ b/drivers/bluetooth/btusb.c
+@@ -2644,9 +2644,9 @@ static void btusb_mtk_claim_iso_intf(str
+       init_usb_anchor(&btmtk_data->isopkt_anchor);
+ }
+-static void btusb_mtk_release_iso_intf(struct btusb_data *data)
++static void btusb_mtk_release_iso_intf(struct hci_dev *hdev)
+ {
+-      struct btmtk_data *btmtk_data = hci_get_priv(data->hdev);
++      struct btmtk_data *btmtk_data = hci_get_priv(hdev);
+       if (btmtk_data->isopkt_intf) {
+               usb_kill_anchored_urbs(&btmtk_data->isopkt_anchor);
+@@ -2662,6 +2662,16 @@ static void btusb_mtk_release_iso_intf(s
+       clear_bit(BTMTK_ISOPKT_OVER_INTR, &btmtk_data->flags);
+ }
++static int btusb_mtk_disconnect(struct hci_dev *hdev)
++{
++      /* This function describes the specific additional steps taken by MediaTek
++       * when Bluetooth usb driver's resume function is called.
++       */
++      btusb_mtk_release_iso_intf(hdev);
++
++      return 0;
++}
++
+ static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data)
+ {
+       struct btusb_data *data = hci_get_drvdata(hdev);
+@@ -2679,7 +2689,7 @@ static int btusb_mtk_reset(struct hci_de
+               return err;
+       if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags))
+-              btusb_mtk_release_iso_intf(data);
++              btusb_mtk_release_iso_intf(hdev);
+       btusb_stop_traffic(data);
+       usb_kill_anchored_urbs(&data->tx_anchor);
+@@ -2733,14 +2743,13 @@ static int btusb_mtk_setup(struct hci_de
+ static int btusb_mtk_shutdown(struct hci_dev *hdev)
+ {
+-      struct btusb_data *data = hci_get_drvdata(hdev);
+       struct btmtk_data *btmtk_data = hci_get_priv(hdev);
+       int ret;
+       ret = btmtk_usb_shutdown(hdev);
+       if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags))
+-              btusb_mtk_release_iso_intf(data);
++              btusb_mtk_release_iso_intf(hdev);
+       return ret;
+ }
+@@ -3854,6 +3863,7 @@ static int btusb_probe(struct usb_interf
+               data->recv_acl = btmtk_usb_recv_acl;
+               data->suspend = btmtk_usb_suspend;
+               data->resume = btmtk_usb_resume;
++              data->disconnect = btusb_mtk_disconnect;
+       }
+       if (id->driver_info & BTUSB_SWAVE) {
diff --git a/queue-6.12/bluetooth-btusb-mediatek-change-the-conditions-for-iso-interface.patch b/queue-6.12/bluetooth-btusb-mediatek-change-the-conditions-for-iso-interface.patch
new file mode 100644 (file)
index 0000000..b6dd765
--- /dev/null
@@ -0,0 +1,70 @@
+From defc33b5541e0a7e45cc2d99d72fbe80a597afc5 Mon Sep 17 00:00:00 2001
+From: Chris Lu <chris.lu@mediatek.com>
+Date: Mon, 23 Sep 2024 16:47:05 +0800
+Subject: Bluetooth: btusb: mediatek: change the conditions for ISO interface
+
+From: Chris Lu <chris.lu@mediatek.com>
+
+commit defc33b5541e0a7e45cc2d99d72fbe80a597afc5 upstream.
+
+Change conditions for Bluetooth driver claiming and releasing usb
+ISO interface for MediaTek ISO data transmission.
+
+Signed-off-by: Chris Lu <chris.lu@mediatek.com>
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Cc: Fedor Pchelkin <boddah8794@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/bluetooth/btusb.c |   16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+--- a/drivers/bluetooth/btusb.c
++++ b/drivers/bluetooth/btusb.c
+@@ -2648,7 +2648,7 @@ static void btusb_mtk_release_iso_intf(s
+ {
+       struct btmtk_data *btmtk_data = hci_get_priv(hdev);
+-      if (btmtk_data->isopkt_intf) {
++      if (test_bit(BTMTK_ISOPKT_OVER_INTR, &btmtk_data->flags)) {
+               usb_kill_anchored_urbs(&btmtk_data->isopkt_anchor);
+               clear_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags);
+@@ -2688,8 +2688,8 @@ static int btusb_mtk_reset(struct hci_de
+       if (err < 0)
+               return err;
+-      if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags))
+-              btusb_mtk_release_iso_intf(hdev);
++      /* Release MediaTek ISO data interface */
++      btusb_mtk_release_iso_intf(hdev);
+       btusb_stop_traffic(data);
+       usb_kill_anchored_urbs(&data->tx_anchor);
+@@ -2734,22 +2734,22 @@ static int btusb_mtk_setup(struct hci_de
+       btmtk_data->reset_sync = btusb_mtk_reset;
+       /* Claim ISO data interface and endpoint */
+-      btmtk_data->isopkt_intf = usb_ifnum_to_if(data->udev, MTK_ISO_IFNUM);
+-      if (btmtk_data->isopkt_intf)
++      if (!test_bit(BTMTK_ISOPKT_OVER_INTR, &btmtk_data->flags)) {
++              btmtk_data->isopkt_intf = usb_ifnum_to_if(data->udev, MTK_ISO_IFNUM);
+               btusb_mtk_claim_iso_intf(data);
++      }
+       return btmtk_usb_setup(hdev);
+ }
+ static int btusb_mtk_shutdown(struct hci_dev *hdev)
+ {
+-      struct btmtk_data *btmtk_data = hci_get_priv(hdev);
+       int ret;
+       ret = btmtk_usb_shutdown(hdev);
+-      if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags))
+-              btusb_mtk_release_iso_intf(hdev);
++      /* Release MediaTek iso interface after shutdown */
++      btusb_mtk_release_iso_intf(hdev);
+       return ret;
+ }
diff --git a/queue-6.12/bluetooth-btusb-mediatek-move-bluetooth-power-off-command-position.patch b/queue-6.12/bluetooth-btusb-mediatek-move-bluetooth-power-off-command-position.patch
new file mode 100644 (file)
index 0000000..1711321
--- /dev/null
@@ -0,0 +1,38 @@
+From ad0c6f603bb0b07846fda484c59a176a8cd02838 Mon Sep 17 00:00:00 2001
+From: Chris Lu <chris.lu@mediatek.com>
+Date: Mon, 23 Sep 2024 16:47:02 +0800
+Subject: Bluetooth: btusb: mediatek: move Bluetooth power off command position
+
+From: Chris Lu <chris.lu@mediatek.com>
+
+commit ad0c6f603bb0b07846fda484c59a176a8cd02838 upstream.
+
+Move MediaTek Bluetooth power off command before releasing
+usb ISO interface.
+
+Signed-off-by: Chris Lu <chris.lu@mediatek.com>
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Cc: Fedor Pchelkin <boddah8794@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/bluetooth/btusb.c |    5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/bluetooth/btusb.c
++++ b/drivers/bluetooth/btusb.c
+@@ -2734,11 +2734,14 @@ static int btusb_mtk_shutdown(struct hci
+ {
+       struct btusb_data *data = hci_get_drvdata(hdev);
+       struct btmtk_data *btmtk_data = hci_get_priv(hdev);
++      int ret;
++
++      ret = btmtk_usb_shutdown(hdev);
+       if (test_bit(BTMTK_ISOPKT_RUNNING, &btmtk_data->flags))
+               btusb_mtk_release_iso_intf(data);
+-      return btmtk_usb_shutdown(hdev);
++      return ret;
+ }
+ #ifdef CONFIG_PM
index a1122f7b3586893902217e74a62db6b97fbf5dd8..4d043db5dad480367968c0d59cfae120c2dfb32b 100644 (file)
@@ -107,3 +107,7 @@ btrfs-sysfs-fix-direct-super-block-member-reads.patch
 btrfs-fix-use-after-free-when-cowing-tree-bock-and-tracing-is-enabled.patch
 btrfs-check-folio-mapping-after-unlock-in-put_file_data.patch
 btrfs-check-folio-mapping-after-unlock-in-relocate_one_folio.patch
+bluetooth-btusb-mediatek-move-bluetooth-power-off-command-position.patch
+bluetooth-btusb-mediatek-add-callback-function-in-btusb_disconnect.patch
+bluetooth-btusb-mediatek-add-intf-release-flow-when-usb-disconnect.patch
+bluetooth-btusb-mediatek-change-the-conditions-for-iso-interface.patch