Skip to content

RFC Bluetooth: btmtk: add USB autopm support to btmtk_usb_setup()

Alberto Garcia linux-bluetooth 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest1 patch 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1Bluetooth: btmtk: add USB autopm support to btmtk_usb_setup()drivers/bluetooth/btmtk.c+16 -12 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/1] Bluetooth: btmtk: add USB autopm support to btmtk_usb_setup()

Hello,

I've been having problems with the btmtk bluetooth driver for a long time. What happens is a failure during initialization and the loading of the firmware, with errors like these:

kernel: Bluetooth: hci0: Failed to get device id (-108)
kernel: Bluetooth: hci0: Failed to get fw version (-108)

The device is MediaTek MT7921 (0489:e0cd), there are more details in this bug report:

https://bugzilla.kernel.org/show_bug.cgi?id=217475

Passing btusb.enable_autosuspend=n seems to solve the problem for me. My computer's hard drive is encrypted so it can take a long time before the bluetooth firmware is loaded, so I interpret that this causes the device to autosuspend during boot and that's why initialization fails. Does that make sense?

I saw that commit 67dba2c28fe0 fixed similar errors during shutdown by using usb_autopm_get_interface() so I tried the same approach for the btusb_mtk_setup() function. I confirm that this solves the problem for me and with this patch the bluetooth adapter works reliably.

I was also suggested to try the simpler approach of using setup_on_usb instead:

        if (IS_ENABLED(CONFIG_BT_HCIBTUSB_MTK) &&
            (id->driver_info & BTUSB_MEDIATEK)) {
-               hdev->setup = btusb_mtk_setup;
+               data->setup_on_usb = btusb_mtk_setup;
                hdev->shutdown = btusb_mtk_shutdown;
                hdev->manufacturer = 70;

However this does not solve the problem:

kernel: usbcore: registered new interface driver btusb
kernel: Bluetooth: hci0: HW/SW Version: 0x008a008a, Build Time: 20241106151414
kernel: Bluetooth: hci0: Execution of wmt command timed out
kernel: Bluetooth: hci0: Failed to send wmt patch dwnld (-110)
kernel: Bluetooth: hci0: Failed to set up firmware (-110)

So I would like to know if a patch like the one I'm sending is a good approach or if I should try something else.

Regards,

Berto

Alberto Garcia (1):
Bluetooth: btmtk: add USB autopm support to btmtk_usb_setup()

 drivers/bluetooth/btmtk.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
Signature · 1 line
2.47.3