[PATCH 2/2] Bluetooth: btmtksdio: retry enabling the function on MT7663/MT7668
From: Ryan Brue
Date: Mon Oct 26 2026 - 15:03:10 EST
Right after the Wi-Fi function of an MT7663 combo chip starts its
firmware, the WMT function-enable request is refused (the reply's flag
byte is 2). btmtksdio ignored the reply, so the following low power
setup command then timed out and setup failed:
Bluetooth: hci0: command 0xfc7a tx timeout
Bluetooth: hci0: Failed to apply low power setting (-110)
Check the result and retry every 500 ms, up to ten times, as MediaTek's
own driver retries its power-on command. With mt7663s probing first, the
function now starts on the second attempt and setup completes.
Fixes: 9aebfd4a2200 ("Bluetooth: mediatek: add support for MediaTek MT7663S and MT7668S SDIO devices")
Signed-off-by: Ryan Brue <ryanbrue.dev@xxxxxxxxx>
---
drivers/bluetooth/btmtksdio.c | 28 ++++++++++++++++++++++------
1 file changed, 22 insertions(+), 6 deletions(-)
diff --git a/drivers/bluetooth/btmtksdio.c b/drivers/bluetooth/btmtksdio.c
index bb311986271f..239393a15e46 100644
--- a/drivers/bluetooth/btmtksdio.c
+++ b/drivers/bluetooth/btmtksdio.c
@@ -909,17 +909,33 @@ static int mt76xx_setup(struct hci_dev *hdev, const char *fwname)
goto ignore_func_on;
}
- /* Enable Bluetooth protocol */
+ /*
+ * Enable Bluetooth protocol. While the Wi-Fi function of a combo
+ * chip is still starting its firmware, the request is refused, so
+ * retry it.
+ */
wmt_params.op = BTMTK_WMT_FUNC_CTRL;
wmt_params.flag = 0;
wmt_params.dlen = sizeof(param);
wmt_params.data = ¶m;
- wmt_params.status = NULL;
+ wmt_params.status = &status;
- err = mtk_hci_wmt_sync(hdev, &wmt_params);
- if (err < 0) {
- bt_dev_err(hdev, "Failed to send wmt func ctrl (%d)", err);
- return err;
+ for (i = 0; i < 10; i++) {
+ err = mtk_hci_wmt_sync(hdev, &wmt_params);
+ if (err < 0) {
+ bt_dev_err(hdev, "Failed to send wmt func ctrl (%d)",
+ err);
+ return err;
+ }
+
+ if (status == BTMTK_WMT_ON_DONE)
+ break;
+ msleep(500);
+ }
+
+ if (status != BTMTK_WMT_ON_DONE) {
+ bt_dev_err(hdev, "Bluetooth function refused to start");
+ return -EIO;
}
set_bit(BTMTKSDIO_PATCH_ENABLED, &bdev->tx_state);
--
2.55.0