From: Swapnil Shinde <shindeswapnil028@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>,
Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org,
Swapnil Shinde <shindeswapnil028@gmail.com>
Subject: [PATCH bluetooth-next v2] Bluetooth: btusb: Disable autosuspend and add shutdown reset for RTL8723DE
Date: Wed, 2 Dec 2026 13:13:00 +0530 [thread overview]
Message-ID: <20261202074300.8745-1-shindeswapnil028@gmail.com> (raw)
On Realtek RTL8723DE combo adapters (0bda:b009 / 10ec:d723), enabling
USB runtime autosuspend puts the USB Bluetooth interface into L2/D2
suspend while the PCIe Wi-Fi MAC remains active, wedging the shared
power rail across a warm reboot when Bluetooth is toggled off mid-session.
Additionally, btusb_driver omits a .shutdown callback, leaving Realtek
firmware active across kernel_restart() when Bluetooth remains active.
Disable USB autosuspend per-device for 0x0bda:0xb009 during probe (and
re-enable it on disconnect), set HCI_QUIRK_NON_PERSISTENT_SETUP so
turning Bluetooth off and back on mid-session reloads firmware cleanly,
and add a .shutdown callback to clear remote wakeup, reset active
controllers, and stop USB URBs cleanly on reboot.
---
Changes in v2:
- Use per-device usb_disable_autosuspend() in btusb_probe() paired with
usb_enable_autosuspend() in btusb_disconnect() instead of mutating
module-global enable_autosuspend.
- Set HCI_QUIRK_NON_PERSISTENT_SETUP for 0x0bda:0xb009 so firmware is
reloaded cleanly across userspace Bluetooth off -> on toggles.
- Guard hdev->shutdown() with if (!err) after usb_autopm_get_interface()
in btusb_shutdown().
- Confirmed across cold boots, consecutive warm reboots, and runtime
radio toggles on RTL8723DE with stock rtw88 (no rtw88 changes needed).
Signed-off-by: Swapnil Shinde <shindeswapnil028@gmail.com>
---
drivers/bluetooth/btusb_main.c | 44 ++++++++++++++++++++++++++++++++--
1 file changed, 42 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/btusb_main.c b/drivers/bluetooth/btusb_main.c
index 7d510c3..6be87d2 100644
--- a/drivers/bluetooth/btusb_main.c
+++ b/drivers/bluetooth/btusb_main.c
@@ -1018,6 +1018,7 @@ struct btqca_data {
#define BTUSB_HW_SSR_ACTIVE 17
#define BTUSB_WAKEUP_BROKEN 18
#define BTUSB_RESET 19
+#define BTUSB_NEEDS_SHUTDOWN_RESET 20
#define BTUSB_PROTO_LEGACY 0x00
#define BTUSB_PROTO_H4 0x01
@@ -2157,6 +2158,7 @@ static int btusb_open(struct hci_dev *hdev)
}
data->intf->needs_remote_wakeup = 1;
+ set_bit(BTUSB_NEEDS_SHUTDOWN_RESET, &data->flags);
if (data->proto == BTUSB_PROTO_LEGACY) {
if (test_and_set_bit(BTUSB_INTR_RUNNING, &data->flags))
@@ -4735,8 +4737,14 @@ static int btusb_probe(struct usb_interface *intf,
hdev->reset = btusb_rtl_reset;
hdev->hw_error = btusb_rtl_hw_error;
- /* Realtek devices need to set remote wakeup on auto-suspend */
- set_bit(BTUSB_WAKEUP_AUTOSUSPEND, &data->flags);
+ if (le16_to_cpu(data->udev->descriptor.idVendor) == 0x0bda &&
+ le16_to_cpu(data->udev->descriptor.idProduct) == 0xb009) {
+ usb_disable_autosuspend(data->udev);
+ hci_set_quirk(hdev, HCI_QUIRK_NON_PERSISTENT_SETUP);
+ } else {
+ /* Realtek devices need to set remote wakeup on auto-suspend */
+ set_bit(BTUSB_WAKEUP_AUTOSUSPEND, &data->flags);
+ }
set_bit(BTUSB_USE_ALT3_FOR_WBS, &data->flags);
}
@@ -4879,6 +4887,10 @@ static void btusb_disconnect(struct usb_interface *intf)
if (!data)
return;
+ if (le16_to_cpu(data->udev->descriptor.idVendor) == 0x0bda &&
+ le16_to_cpu(data->udev->descriptor.idProduct) == 0xb009)
+ usb_enable_autosuspend(data->udev);
+
debugfs_remove(data->force_poll_sync_dentry);
data->force_poll_sync_dentry = NULL;
@@ -5105,10 +5117,38 @@ static void btusb_coredump(struct device *dev)
}
#endif
+static void btusb_shutdown(struct usb_interface *intf)
+{
+ struct btusb_data *data = usb_get_intfdata(intf);
+ struct hci_dev *hdev;
+ int err = -1;
+
+ if (!data || intf != data->intf)
+ return;
+
+ hdev = data->hdev;
+ data->intf->needs_remote_wakeup = 0;
+ data->udev->do_remote_wakeup = 0;
+
+ if (test_and_clear_bit(BTUSB_NEEDS_SHUTDOWN_RESET, &data->flags) &&
+ hdev->shutdown) {
+ err = usb_autopm_get_interface(data->intf);
+ if (!err)
+ hdev->shutdown(hdev);
+ }
+
+ btusb_stop_traffic(data);
+ usb_kill_anchored_urbs(&data->tx_anchor);
+
+ if (!err)
+ usb_autopm_put_interface(data->intf);
+}
+
static struct usb_driver btusb_driver = {
.name = "btusb",
.probe = btusb_probe,
.disconnect = btusb_disconnect,
+ .shutdown = btusb_shutdown,
.suspend = pm_ptr(btusb_suspend),
.resume = pm_ptr(btusb_resume),
.id_table = btusb_table,
--
2.56.0
reply other threads:[~2026-12-02 7:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261202074300.8745-1-shindeswapnil028@gmail.com \
--to=shindeswapnil028@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®