New: Foxconn / Hon Hai Bluetooth adapter 0489:e0cd stops working on ThinkPad T14s AMD Gen1
https://bugzilla.kernel.org/show_bug.cgi?id=217475
Bug ID: 217475
Summary: Foxconn / Hon Hai Bluetooth adapter 0489:e0cd stops
working on ThinkPad T14s AMD Gen1
Product: Drivers
Version: 2.5
Hardware: All
OS: Linux
Status: NEW
Severity: normal
Priority: P3
Component: USB
Assignee: [email protected]
Reporter: [email protected]
Regression: No
Hi,
I'm running Linux on a ThinkPad T14s AMD Gen 1 and I'm having problems with its Bluetooth adapter.
The adapter is a Foxconn / Hon Hai, USB ID 0489:e0cd, and it uses the Mediatek MT7921 driver. Sometimes it just works but often if I suspend the laptop and come back it stops working. This also happens when I use the RF kill switch. The kernel errors vary a bit depending on the moment but it's usually a combination of these:
kernel: Bluetooth: hci0: Failed to get device id (-108)
kernel: Bluetooth: hci0: Failed to get fw version (-108)
kernel: bluetooth hci0: firmware: direct-loading firmware mediatek/BT_RAM_CODE_MT7961_1_2_hdr.bin
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)
kernel: Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection command is advertised, but not supported.
Interestingly I noticed that if I try to use it on a Linux VM (using USB passthrough) it generally works better, even when it's not working on the host and the guest and the host are running the same OS and kernel version. Still it fails sometimes, although the error messages tend to be a bit different:
kernel: usbcore: registered new interface driver btusb
kernel: Bluetooth: hci0: Device setup in 153593 usecs
kernel: Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection command is advertised, but not supported.
kernel: Bluetooth: hci0: Opcode 0x c03 failed: -110
kernel: Bluetooth: hci0: Failed to read MSFT supported features (-110)
kernel: Bluetooth: hci0: AOSP get vendor capabilities (-110)
(I also tried the adapter with a Windows VM, again using USB passthrough, but here it works perfectly fine)
Back to the host I found out that resetting the adapter using "usb_modeswitch -R -v 0489 -p e0cd" sometimes is enough to bring the adapter back to life and make it work. But this doesn't always succeed, and at some point I end up in a situation like this:
kernel: xhci_hcd 0000:06:00.4: xHCI host not responding to stop endpoint command
kernel: xhci_hcd 0000:06:00.4: xHCI host controller not responding, assume dead
kernel: xhci_hcd 0000:06:00.4: HC died; cleaning up
Sometimes I can get out of it with this:
$ echo 0000:06:00.4 > /sys/bus/pci/drivers/xhci_hcd/unbind $ echo 0000:06:00.4 > /sys/bus/pci/drivers/xhci_hcd/bind
All this has been happening since I got the laptop, but I'm testing it now with Linux 6.3.3 and the problem is still there.
The end result is that I basically cannot rely on the USB adapter so I have it almost always disabled.
A bit more information about the system:
$ lspci -nn | grep USB 02:00.4 USB controller [0c03]: Realtek Semiconductor Co., Ltd. RTL811x EHCI host controller [10ec:816d] (rev 0e) 05:00.0 USB controller [0c03]: Renesas Technology Corp. uPD720202 USB 3.0 Host Controller [1912:0015] (rev 02) 06:00.3 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1 [1022:1639] 06:00.4 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1 [1022:1639]
$ lsusb Bus 007 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 006 Device 003: ID 0489:e0cd Foxconn / Hon Hai Wireless_Device Bus 006 Device 002: ID 06cb:00bd Synaptics, Inc. Prometheus MIS Touch Fingerprint Reader Bus 006 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 005 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 002 Device 002: ID 04f2:b6cb Chicony Electronics Co., Ltd Integrated Camera Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 217475] Foxconn / Hon Hai Bluetooth adapter 0489:e0cd stops working on ThinkPad T14s AMD Gen1
https://bugzilla.kernel.org/show_bug.cgi?id=217475
Bagas Sanjaya ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #1 from Bagas Sanjaya ([email protected]) ---
What kernel version did you have this issue? If it is regression, what is last working version?
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 217475] Foxconn / Hon Hai Bluetooth adapter 0489:e0cd stops working on ThinkPad T14s AMD Gen1
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=217475
--- Comment #2 from Alberto Garcia ([email protected]) ---
I have always had this problem with this computer. Linux got support for this Bluetooth adapter in 5.14 if I'm not wrong (64832df2ac05) and I probably tried it for the first time with 5.15.3. I never saw it working fine, and I have tried lots of kernels and firmware versions since then. The most recent one was 6.3.3 as I mentioned in the bug report.
Since I can make it work with a Windows VM using USB passthrough I assume that there's some problem with the initialization of the adapter, the HCI or something like that, but that's all I can guess with my limited knowledge of USB.
To make it clear: when I talk about using a VM I'm talking about the scenario where
1) I cannot use Bluetooth in my Linux system because of one of the errors that I mentioned earlier ("hci0: Failed to get device id (-108)"). The device is not detected by the Bluetooth stack although it does appears in lsusb.
2) I launch a Windows VM using QEMU right away, without rebooting the computer or doing anything else. The BT adapter works in that VM always.
3) If I launch a Linux VM instead it tends to work, not always in this case but I have a higher success rate than if I remove and reload the btusb module on the host.
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 217475] Foxconn / Hon Hai Bluetooth adapter 0489:e0cd stops working on ThinkPad T14s AMD Gen1
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=217475
--- Comment #3 from Alberto Garcia ([email protected]) ---
One more thing: when it's working on Linux it seems to be reliable, at least I have never had the situation where I'm listening to music and it suddenly stops working.
In my experience the problem appears when the adapter is disabled and then re-enabled, either when the laptop is suspended or with the RF kill switch.
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 217475] Foxconn / Hon Hai Bluetooth adapter 0489:e0cd stops working on ThinkPad T14s AMD Gen1
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=217475
Leonardo Silveira ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #4 from Leonardo Silveira ([email protected]) --- i got similar issue on ThinkPad T14 Gen 2a
i turned it off, slapped the machine twice then it went back working. not completely sure if it's a software issue but it is happening.
when it stops working it keeps not working. until it come back.
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 217475] Foxconn / Hon Hai Bluetooth adapter 0489:e0cd stops working on ThinkPad T14s AMD Gen1
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=217475
--- Comment #5 from Alberto Garcia ([email protected]) --- Hi, I'm on Linux 6.12.73 now.
I found that btusb.enable_autosuspend=n seems to solve the problem.
Commit 67dba2c28fe0 ("btmtk: Fix failed to send func ctrl for MediaTek devices.") prevents the device from suspending during btmtk_usb_shutdown() to avoid timeout errors similar to the ones I'm experiencing:
btmtk_usb_hci_wmt_sync() hci0: Execution of wmt command timed out btmtk_usb_shutdown() hci0: Failed to send wmt func ctrl (-110)
So I wonder if the same thing is happening during btmtk_usb_setup().
There's a long gap until the bluetooth driver is loaded. This computer has an external USB-C dock that sometimes takes a long time to initialize, also the hard drive is encrypted with LUKS so the btusb driver (and its firmware) cannot be loaded until I enter the password and the rootfs is decrypted. All this can take easily 20 seconds.
So maybe the bluetooth adapter suspends before the driver is loaded and that's why the initialization fails, does that make sense?
I tried patching btmtk_usb_setup() with the same approach and so far I haven't been able to reproduce the issue anymore.
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 217475] Foxconn / Hon Hai Bluetooth adapter 0489:e0cd stops working on ThinkPad T14s AMD Gen1
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=217475
Alberto Garcia ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #6 from Alberto Garcia ([email protected]) --- Created attachment 309604
--> https://bugzilla.kernel.org/attachment.cgi?id=309604&action=edit
Proposed patch: add USB autopm support to btmtk_usb_setup()
Here's the patch that I'm using, I haven't been able to reproduce the bug after several reboots and suspend / resume cycles.
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 217475] Foxconn / Hon Hai Bluetooth adapter 0489:e0cd stops working on ThinkPad T14s AMD Gen1
In reply to [email protected]https://bugzilla.kernel.org/show_bug.cgi?id=217475
Michał Pecio ([email protected]) changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]
--- Comment #7 from Michał Pecio ([email protected]) ---
Does it mean that with this patch you no longer need to disable autosuspend and all those problems are gone?
It makes some sense, as it seems that btusb_probe() only stores a pointer to btusb_mtk_setup() and then enables autosuspend, so somebody else may later call that function on a suspendend device. Other BT drivers may be affected too.
If you got this far, please email your findings to bluetooth maintainers responsible for this driver (run ./scripts/get_maintainer on the buggy file). If they find your solution acceptable you may be asked to email the patch too.
Signature · 4 lines
You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.