Bug 218757

Summary: Direct firmware load for mediatek/BT_RAM_CODE_MT7961_1a_2_hdr.bin failed with error -2
Product: Drivers Reporter: sander44 (ionut_n2001)
Component: network-wirelessAssignee: drivers_network-wireless (drivers_network-wireless)
Status: RESOLVED ANSWERED    
Severity: normal CC: arek.rusi, jaroslaw, jeremy.rutman, mezin.alexander, tibor.kovacs30
Priority: P3    
Hardware: All   
OS: Linux   
Kernel Version: 6.9.0-rc4 Subsystem:
Regression: No Bisected commit-id:
Attachments: BT_RAM_CODE_MT7961_1a_2_hdr.bin version 20210821171156

Description sander44 2024-04-21 13:06:04 UTC
Hello Kernel Team,

I notice this today:
mediatek/BT_RAM_CODE_MT7961_1a_2_hdr.bin failed with error -2

sudo dmesg | grep -E "Blue|bluetooth"
[    7.191878] Bluetooth: Core ver 2.22
[    7.191918] Bluetooth: HCI device and connection manager initialized
[    7.191923] Bluetooth: HCI socket layer initialized
[    7.191927] Bluetooth: L2CAP socket layer initialized
[    7.191933] Bluetooth: SCO socket layer initialized
[    7.199757] bluetooth hci0: Direct firmware load for mediatek/BT_RAM_CODE_MT7961_1a_2_hdr.bin failed with error -2
[    7.199761] Bluetooth: hci0: Failed to load firmware file (-2)
[    7.199765] Bluetooth: hci0: Failed to set up firmware (-2)
[    7.199767] Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection command is advertised, but not supported.
[    7.237575] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    7.237579] Bluetooth: BNEP filters: protocol multicast
[    7.237585] Bluetooth: BNEP socket layer initialized


This file is a new firmware for MT7961 bluetooth zone?

Kernel: 6.9.0-rc4-1
Comment 1 Artem S. Tashkinov 2024-04-22 05:03:35 UTC
Created attachment 306191 [details]
BT_RAM_CODE_MT7961_1a_2_hdr.bin version 20210821171156

Please unpack this file into /lib/firmware/mediatek and check if it works
Comment 2 sander44 2024-04-22 18:22:30 UTC
Hi Artem,

I installed today this firmware file:


[    5.389697] Bluetooth: Core ver 2.22
[    5.389731] Bluetooth: HCI device and connection manager initialized
[    5.389736] Bluetooth: HCI socket layer initialized
[    5.389738] Bluetooth: L2CAP socket layer initialized
[    5.389742] Bluetooth: SCO socket layer initialized
[    5.402826] Bluetooth: hci0: HW/SW Version: 0x008a008a, Build Time: 20210821171156
[    5.543369] Bluetooth: hci0: Device setup in 139917 usecs
[    5.543373] Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection command is advertised, but not supported.
[    5.608290] Bluetooth: hci0: AOSP extensions version v1.00
[    5.608293] Bluetooth: hci0: AOSP quality report is supported
[    6.203590] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    6.203595] Bluetooth: BNEP filters: protocol multicast
[    6.203600] Bluetooth: BNEP socket layer initialized
[    6.205109] Bluetooth: MGMT ver 1.22
[   23.648674] Bluetooth: RFCOMM TTY layer initialized
[   23.648703] Bluetooth: RFCOMM socket layer initialized
[   23.648711] Bluetooth: RFCOMM ver 1.11

And is working.
Comment 3 Artem S. Tashkinov 2024-04-23 10:19:21 UTC
Hopefully this firmware will be pushed upstream soon enough.
Comment 4 Tibor Kovacs 2024-05-15 09:12:15 UTC
Unfortunately the new firmware loads fine, but there are still errors (at least on my machine) kernel: final 6.9

[    7.638059] Bluetooth: Core ver 2.22
[    7.638407] Bluetooth: HCI device and connection manager initialized
[    7.638427] Bluetooth: HCI socket layer initialized
[    7.638464] Bluetooth: L2CAP socket layer initialized
[    7.638485] Bluetooth: SCO socket layer initialized
[    7.726735] Bluetooth: hci0: HW/SW Version: 0x008a008a, Build Time: 20210821171156
[   10.200787] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   10.200794] Bluetooth: BNEP filters: protocol multicast
[   10.200800] Bluetooth: BNEP socket layer initialized
[   20.594362] Bluetooth: hci0: Execution of wmt command timed out
[   20.594372] Bluetooth: hci0: Failed to send wmt func ctrl (-110)
[   20.594380] Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection command is advertised, but not supported.
[   25.713464] Bluetooth: hci0: Failed to write uhw reg(-110)
[   30.833790] Bluetooth: hci0: Failed to read uhw reg(-110)
[   35.953835] Bluetooth: hci0: Failed to write uhw reg(-110)
[   41.073713] Bluetooth: hci0: Failed to write uhw reg(-110)
[   46.193748] Bluetooth: hci0: Failed to read uhw reg(-110)
[   51.313795] Bluetooth: hci0: Failed to write uhw reg(-110)
[   56.433754] Bluetooth: hci0: Failed to read uhw reg(-110)
[   61.553734] Bluetooth: hci0: Failed to write uhw reg(-110)
[   66.673733] Bluetooth: hci0: Failed to read uhw reg(-110)
[   71.793748] Bluetooth: hci0: Failed to read uhw reg(-110)
[   76.913632] Bluetooth: hci0: Failed to read uhw reg(-110)
[   76.913646] Bluetooth: hci0: Reset timeout
[   82.033916] Bluetooth: hci0: Can't get device id, subsys reset fail.
Comment 5 Tibor Kovacs 2024-05-16 07:32:45 UTC
(In reply to Tibor Kovacs from comment #4)
> Unfortunately the new firmware loads fine, but there are still errors (at
> least on my machine) kernel: final 6.9
> 
> [    7.638059] Bluetooth: Core ver 2.22
> [    7.638407] Bluetooth: HCI device and connection manager initialized
> [    7.638427] Bluetooth: HCI socket layer initialized
> [    7.638464] Bluetooth: L2CAP socket layer initialized
> [    7.638485] Bluetooth: SCO socket layer initialized
> [    7.726735] Bluetooth: hci0: HW/SW Version: 0x008a008a, Build Time:
> 20210821171156
> [   10.200787] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
> [   10.200794] Bluetooth: BNEP filters: protocol multicast
> [   10.200800] Bluetooth: BNEP socket layer initialized
> [   20.594362] Bluetooth: hci0: Execution of wmt command timed out
> [   20.594372] Bluetooth: hci0: Failed to send wmt func ctrl (-110)
> [   20.594380] Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection
> command is advertised, but not supported.
> [   25.713464] Bluetooth: hci0: Failed to write uhw reg(-110)
> [   30.833790] Bluetooth: hci0: Failed to read uhw reg(-110)
> [   35.953835] Bluetooth: hci0: Failed to write uhw reg(-110)
> [   41.073713] Bluetooth: hci0: Failed to write uhw reg(-110)
> [   46.193748] Bluetooth: hci0: Failed to read uhw reg(-110)
> [   51.313795] Bluetooth: hci0: Failed to write uhw reg(-110)
> [   56.433754] Bluetooth: hci0: Failed to read uhw reg(-110)
> [   61.553734] Bluetooth: hci0: Failed to write uhw reg(-110)
> [   66.673733] Bluetooth: hci0: Failed to read uhw reg(-110)
> [   71.793748] Bluetooth: hci0: Failed to read uhw reg(-110)
> [   76.913632] Bluetooth: hci0: Failed to read uhw reg(-110)
> [   76.913646] Bluetooth: hci0: Reset timeout
> [   82.033916] Bluetooth: hci0: Can't get device id, subsys reset fail.

Hmm, funny. 
Seems the unsuccessful start with the missing kernel file has put my BT controller to an unreachable state. 
After switching back to 6.8 kernel it didn't work. I did an rmmod/modprobe cycle it started to work again. 
Finally I booted again with kernel 6.9 and it works.
Problem solved :) 
Thank you guys!
Comment 6 jeremy rutman 2024-05-16 20:59:38 UTC
My (kernel 6.9.0 on lenovo legion 7) bt doesn't see any devices ever although I don't see any errors in dmesg: 

jr@jr-Legion-7-16IAX7:~$ sudo dmesg|grep -i blue
[sudo] password for jr: 
[    4.484433] Bluetooth: Core ver 2.22
[    4.484448] NET: Registered PF_BLUETOOTH protocol family
[    4.484449] Bluetooth: HCI device and connection manager initialized
[    4.484451] Bluetooth: HCI socket layer initialized
[    4.484452] Bluetooth: L2CAP socket layer initialized
[    4.484454] Bluetooth: SCO socket layer initialized
[    4.497873] Bluetooth: hci0: Device revision is 0
[    4.497878] Bluetooth: hci0: Secure boot is enabled
[    4.497879] Bluetooth: hci0: OTP lock is enabled
[    4.497879] Bluetooth: hci0: API lock is enabled
[    4.497880] Bluetooth: hci0: Debug lock is disabled
[    4.497881] Bluetooth: hci0: Minimum firmware build 1 week 10 2014
[    4.497882] Bluetooth: hci0: Bootloader timestamp 2019.40 buildtype 1 build 38
[    4.497930] Bluetooth: hci0: DSM reset method type: 0x00
[    4.500799] Bluetooth: hci0: Found device firmware: intel/ibt-1040-0041.sfi
[    4.500807] Bluetooth: hci0: Boot Address: 0x100800
[    4.500808] Bluetooth: hci0: Firmware Version: 60-48.23
[    5.928167] Bluetooth: hci0: Waiting for firmware download to complete
[    5.928181] Bluetooth: hci0: Firmware loaded in 1393926 usecs
[    5.928365] Bluetooth: hci0: Waiting for device to boot
[    5.944231] Bluetooth: hci0: Device booted in 15627 usecs
[    5.944271] Bluetooth: hci0: Malformed MSFT vendor event: 0x02
[    5.951827] Bluetooth: hci0: Found Intel DDC parameters: intel/ibt-1040-0041.ddc
[    5.954117] Bluetooth: hci0: Applying Intel DDC parameters completed
[    5.957150] Bluetooth: hci0: Firmware timestamp 2023.48 buildtype 1 build 75324
[    5.957164] Bluetooth: hci0: Firmware SHA1: 0x23bac558
[    5.961109] Bluetooth: hci0: Fseq status: Success (0x00)
[    5.961121] Bluetooth: hci0: Fseq executed: 00.00.02.41
[    5.961126] Bluetooth: hci0: Fseq BT Top: 00.00.02.41
[    8.113280] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    8.113283] Bluetooth: BNEP filters: protocol multicast
[    8.113287] Bluetooth: BNEP socket layer initialized
[    8.147084] Bluetooth: MGMT ver 1.22
[    9.837438] Bluetooth: RFCOMM TTY layer initialized
[    9.837451] Bluetooth: RFCOMM socket layer initialized
[    9.837458] Bluetooth: RFCOMM ver 1.11
Comment 7 Aleksandr Mezin 2024-05-17 09:43:27 UTC
The attached firmware doesn't work:

[   25.132556] Bluetooth: hci0: Execution of wmt command timed out
[   25.132583] Bluetooth: hci0: Failed to send wmt func ctrl (-110)
[   25.132591] Bluetooth: hci0: HCI Enhanced Setup Synchronous Connection command is advertised, but not supported.
[   30.252724] Bluetooth: hci0: Failed to write uhw reg(-110)

rmmod&modprobe, power off & power on doesn't help either.

And, as far as I can tell, BT_RAM_CODE_MT7961_1a_2_hdr.bin is still not in linux-firmware
Comment 8 Arek Ruśniak 2024-05-17 12:41:38 UTC
A(In reply to Artem S. Tashkinov from comment #1)
> Created attachment 306191 [details]
> BT_RAM_CODE_MT7961_1a_2_hdr.bin version 20210821171156
> 
> Please unpack this file into /lib/firmware/mediatek and check if it works

could you point out source of that file?

btw, IMO we don't need any fw update 
that should be enough: 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20240517&id=958cd6beab693f395ffe07814ef77d2b45e8b0fc
Comment 9 Aleksandr Mezin 2024-05-17 23:14:10 UTC
(In reply to Arek Ruśniak from comment #8)
> A(In reply to Artem S. Tashkinov from comment #1)
> > Created attachment 306191 [details]
> > BT_RAM_CODE_MT7961_1a_2_hdr.bin version 20210821171156
> > 
> > Please unpack this file into /lib/firmware/mediatek and check if it works
> 
> could you point out source of that file?
> 
> btw, IMO we don't need any fw update 
> that should be enough: 
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/
> ?h=next-20240517&id=958cd6beab693f395ffe07814ef77d2b45e8b0fc

Yes, this patch fixes the problem for me (I took it from stable-queue though).

Bus 003 Device 002: ID 0489:e0cd Foxconn / Hon Hai MediaTek Bluetooth Adapter
Comment 10 jaroslaw 2024-05-19 00:16:37 UTC
To avoid any downloads (I myself am not able to verify the file and its content) I created symbolic link with the missing name to old firmware file.
After reboot bluetooth is fully functional