* [PATCH 0/2] Bluetooth: btmtksdio: Stop discarding the hardware device id
@ 2026-08-25 3:36 Chris Lu
2026-08-25 3:36 ` [PATCH 1/2] Bluetooth: btmtksdio: Remove redundant firmware filename override Chris Lu
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Chris Lu @ 2026-08-25 3:36 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg, Luiz Von Dentz
Cc: Sean Wang, Will Lee, SS Wu, linux-bluetooth, linux-kernel,
linux-mediatek, Chris Lu
btmtksdio_setup() reads the device id from register 0x70010200 and then
throws it away twice: an snprintf() overwrites the filename that
btmtk_fw_get_filename() derived from it, and mt79xx_setup() passes a
hardcoded 0 on to btmtk_setup_firmware_79xx().
Neither matters on supported hardware, since the device ids that would
make a difference - 0x6639, 0x7925 and a flavored 0x7961 - all belong to
parts with no SDIO interface. So this targets bluetooth-next with no
Fixes: tags. What it buys is that the two functions stop silently ignoring
their input, which is a trap for the next chip added to this driver.
Both patches come from a larger MT7928 series [1], where they were
described as fixing firmware load failures on MT6639, MT7925 and MT7928.
That does not hold for the SDIO driver and has been dropped.
Tested on a Chromebook with MT7921S, whose chip id register reports
0x7961: before and after, the driver requests
mediatek/BT_RAM_CODE_MT7961_1_2_hdr.bin, the firmware loads, and the
controller powers on and connects to an A2DP device.
[1] https://lore.kernel.org/linux-bluetooth/20260717072133.2858136-1-chris.lu@mediatek.com/
Chris Lu (2):
Bluetooth: btmtksdio: Remove redundant firmware filename override
Bluetooth: btmtksdio: Pass the hardware device id to mt79xx_setup()
drivers/bluetooth/btmtksdio.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
--
2.45.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] Bluetooth: btmtksdio: Remove redundant firmware filename override
2026-08-25 3:36 [PATCH 0/2] Bluetooth: btmtksdio: Stop discarding the hardware device id Chris Lu
@ 2026-08-25 3:36 ` Chris Lu
2026-08-25 4:10 ` Bluetooth: btmtksdio: Stop discarding the hardware device id bluez.test.bot
2026-08-25 3:36 ` [PATCH 2/2] Bluetooth: btmtksdio: Pass the hardware device id to mt79xx_setup() Chris Lu
2026-08-31 17:20 ` [PATCH 0/2] Bluetooth: btmtksdio: Stop discarding the hardware device id patchwork-bot+bluetooth
2 siblings, 1 reply; 5+ messages in thread
From: Chris Lu @ 2026-08-25 3:36 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg, Luiz Von Dentz
Cc: Sean Wang, Will Lee, SS Wu, linux-bluetooth, linux-kernel,
linux-mediatek, Chris Lu
btmtksdio_setup() derives the firmware filename with
btmtk_fw_get_filename() and then overwrites it with an snprintf() that
open-codes that helper's fallback format. Commit 7f935b21bee4 ("Bluetooth:
btmtk: apply the common btmtk_fw_get_filename") added the helper call
without removing the snprintf() it was meant to replace.
None of the device ids the helper special-cases can appear here: 0x6639,
0x7925 and the flavored 0x7961 belong to parts with no SDIO interface, and
btmtksdio_setup() passes a flavor of 0 accordingly. The helper always falls
through to the snprintf()'s own format, so both produce the same string and
removing it is a no-op.
Remove it anyway, since it silently defeats the helper for any device id
the helper special-cases.
Signed-off-by: Chris Lu <chris.lu@mediatek.com>
Assisted-by: Claude:claude-opus-5
---
drivers/bluetooth/btmtksdio.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index b7f0be7fc42a..a5709cecd4b5 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -1162,9 +1162,6 @@ static int btmtksdio_setup(struct hci_dev *hdev)
btmtk_fw_get_filename(fwname, sizeof(fwname), dev_id,
fw_version, 0);
- snprintf(fwname, sizeof(fwname),
- "mediatek/BT_RAM_CODE_MT%04x_1_%x_hdr.bin",
- dev_id & 0xffff, (fw_version & 0xff) + 1);
err = mt79xx_setup(hdev, fwname);
if (err < 0)
return err;
--
2.45.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] Bluetooth: btmtksdio: Pass the hardware device id to mt79xx_setup()
2026-08-25 3:36 [PATCH 0/2] Bluetooth: btmtksdio: Stop discarding the hardware device id Chris Lu
2026-08-25 3:36 ` [PATCH 1/2] Bluetooth: btmtksdio: Remove redundant firmware filename override Chris Lu
@ 2026-08-25 3:36 ` Chris Lu
2026-08-31 17:20 ` [PATCH 0/2] Bluetooth: btmtksdio: Stop discarding the hardware device id patchwork-bot+bluetooth
2 siblings, 0 replies; 5+ messages in thread
From: Chris Lu @ 2026-08-25 3:36 UTC (permalink / raw)
To: Marcel Holtmann, Johan Hedberg, Luiz Von Dentz
Cc: Sean Wang, Will Lee, SS Wu, linux-bluetooth, linux-kernel,
linux-mediatek, Chris Lu
mt79xx_setup() passes a hardcoded 0 to btmtk_setup_firmware_79xx(),
discarding the device id that btmtksdio_setup() has just read from register
0x70010200. That argument only gates the section filtering for MT6639,
which has no SDIO interface, so this is a no-op on supported hardware and
carries no Fixes: tag.
Pass the value that has already been read, matching the USB path. Declare
dev_id as u32 while at it, since that is what btmtksdio_mtk_reg_read()
writes through the pointer.
Signed-off-by: Chris Lu <chris.lu@mediatek.com>
Assisted-by: Claude:claude-opus-5
---
drivers/bluetooth/btmtksdio.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index a5709cecd4b5..fe4ca9395aa3 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -899,14 +899,14 @@ static int mt76xx_setup(struct hci_dev *hdev, const char *fwname)
return 0;
}
-static int mt79xx_setup(struct hci_dev *hdev, const char *fwname)
+static int mt79xx_setup(struct hci_dev *hdev, const char *fwname, u32 dev_id)
{
struct btmtksdio_dev *bdev = hci_get_drvdata(hdev);
struct btmtk_hci_wmt_params wmt_params;
u8 param = 0x1;
int err;
- err = btmtk_setup_firmware_79xx(hdev, fwname, mtk_hci_wmt_sync, 0);
+ err = btmtk_setup_firmware_79xx(hdev, fwname, mtk_hci_wmt_sync, dev_id);
if (err < 0) {
bt_dev_err(hdev, "Failed to setup 79xx firmware (%d)", err);
return err;
@@ -1119,8 +1119,8 @@ static int btmtksdio_setup(struct hci_dev *hdev)
ktime_t calltime, delta, rettime;
unsigned long long duration;
char fwname[64];
- int err, dev_id;
- u32 fw_version = 0, val;
+ int err;
+ u32 dev_id, fw_version = 0, val;
calltime = ktime_get();
set_bit(BTMTKSDIO_HW_TX_READY, &bdev->tx_state);
@@ -1162,7 +1162,7 @@ static int btmtksdio_setup(struct hci_dev *hdev)
btmtk_fw_get_filename(fwname, sizeof(fwname), dev_id,
fw_version, 0);
- err = mt79xx_setup(hdev, fwname);
+ err = mt79xx_setup(hdev, fwname, dev_id);
if (err < 0)
return err;
--
2.45.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: Bluetooth: btmtksdio: Stop discarding the hardware device id
2026-08-25 3:36 ` [PATCH 1/2] Bluetooth: btmtksdio: Remove redundant firmware filename override Chris Lu
@ 2026-08-25 4:10 ` bluez.test.bot
0 siblings, 0 replies; 5+ messages in thread
From: bluez.test.bot @ 2026-08-25 4:10 UTC (permalink / raw)
To: linux-bluetooth, chris.lu
[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1151231
---Test result---
Test Summary:
CheckPatch PASS 1.13 seconds
VerifyFixes PASS 0.11 seconds
VerifySignedoff PASS 0.10 seconds
GitLint PASS 0.51 seconds
SubjectPrefix PASS 0.20 seconds
BuildKernel PASS 23.49 seconds
CheckAllWarning PASS 25.63 seconds
CheckSparse PASS 23.78 seconds
BuildKernel32 PASS 24.52 seconds
CheckKernelLLVM SKIP 0.00 seconds
TestRunnerSetup PASS 401.40 seconds
IncrementalBuild PASS 24.67 seconds
Details
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis
Output:
Clang not found
https://github.com/bluez/bluetooth-next/pull/650
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] Bluetooth: btmtksdio: Stop discarding the hardware device id
2026-08-25 3:36 [PATCH 0/2] Bluetooth: btmtksdio: Stop discarding the hardware device id Chris Lu
2026-08-25 3:36 ` [PATCH 1/2] Bluetooth: btmtksdio: Remove redundant firmware filename override Chris Lu
2026-08-25 3:36 ` [PATCH 2/2] Bluetooth: btmtksdio: Pass the hardware device id to mt79xx_setup() Chris Lu
@ 2026-08-31 17:20 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+bluetooth @ 2026-08-31 17:20 UTC (permalink / raw)
To: Chris Lu
Cc: marcel, johan.hedberg, luiz.dentz, sean.wang, will-cy.Lee, ss.wu,
linux-bluetooth, linux-kernel, linux-mediatek
Hello:
This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Tue, 25 Aug 2026 11:36:32 +0800 you wrote:
> btmtksdio_setup() reads the device id from register 0x70010200 and then
> throws it away twice: an snprintf() overwrites the filename that
> btmtk_fw_get_filename() derived from it, and mt79xx_setup() passes a
> hardcoded 0 on to btmtk_setup_firmware_79xx().
>
> Neither matters on supported hardware, since the device ids that would
> make a difference - 0x6639, 0x7925 and a flavored 0x7961 - all belong to
> parts with no SDIO interface. So this targets bluetooth-next with no
> Fixes: tags. What it buys is that the two functions stop silently ignoring
> their input, which is a trap for the next chip added to this driver.
>
> [...]
Here is the summary with links:
- [1/2] Bluetooth: btmtksdio: Remove redundant firmware filename override
https://git.kernel.org/bluetooth/bluetooth-next/c/4988456a75ea
- [2/2] Bluetooth: btmtksdio: Pass the hardware device id to mt79xx_setup()
https://git.kernel.org/bluetooth/bluetooth-next/c/afe439f35546
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-31 17:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25 3:36 [PATCH 0/2] Bluetooth: btmtksdio: Stop discarding the hardware device id Chris Lu
2026-08-25 3:36 ` [PATCH 1/2] Bluetooth: btmtksdio: Remove redundant firmware filename override Chris Lu
2026-08-25 4:10 ` Bluetooth: btmtksdio: Stop discarding the hardware device id bluez.test.bot
2026-08-25 3:36 ` [PATCH 2/2] Bluetooth: btmtksdio: Pass the hardware device id to mt79xx_setup() Chris Lu
2026-08-31 17:20 ` [PATCH 0/2] Bluetooth: btmtksdio: Stop discarding the hardware device id patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox