Skip to contentSkip to conversation

Bluetooth: btmtksdio: fix the reset takes too long

PATCH Applied [email protected] 4 participants 5 messages May 12, 2022 – May 13, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Bluetooth: btmtksdio: fix the reset takes too long

From: Sean Wang <[email protected]>

Sending WMT command during the reset in progress is invalid and would get no response from firmware until the reset is complete, so we ignore the WMT command here to resolve the issue which causes the whole reset process taking too long.

Fixes 8fafe702253d ("Bluetooth: mt7921s: support bluetooth reset mechanism")
---
 drivers/bluetooth/btmtksdio.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/bluetooth/btmtksdio.c +5 -0
index 4ae6631a7c29..26e27fd79a21 100644
@@ -1189,6 +1189,10 @@ static int btmtksdio_shutdown(struct hci_dev *hdev)
 	 */
 	pm_runtime_get_sync(bdev->dev);
 
+	/* wmt command only works until the reset is complete */
+	if (test_bit(BTMTKSDIO_HW_RESET_ACTIVE, &bdev->tx_state))
+		goto ignore_wmt_cmd;
+
 	/* Disable the device */
 	wmt_params.op = BTMTK_WMT_FUNC_CTRL;
 	wmt_params.flag = 0;
@@ -1202,6 +1206,7 @@ static int btmtksdio_shutdown(struct hci_dev *hdev)
 		return err;
 	}
 
+ignore_wmt_cmd:
 	pm_runtime_put_noidle(bdev->dev);
 	pm_runtime_disable(bdev->dev);
 
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 Bluetooth: btmtksdio: fix possible FW initialization failure

From: Sean Wang <[email protected]>

According to FW advised sequence, mt7921s need to re-acquire privilege immediately after the firmware download is complete before normal running. Otherwise, it is still possible the bus may be stuck in an abnormal status that causes FW initialization failure in the current driver.

Fixes 752aea58489f ("Bluetooth: mt7921s: fix bus hang with wrong privilege")
---
 drivers/bluetooth/btmtksdio.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/bluetooth/btmtksdio.c +8 -8
index 26e27fd79a21..d6700efcfe8c 100644
@@ -864,6 +864,14 @@ static int mt79xx_setup(struct hci_dev *hdev, const char *fwname)
 		return err;
 	}
 
+	err = btmtksdio_fw_pmctrl(bdev);
+	if (err < 0)
+		return err;
+
+	err = btmtksdio_drv_pmctrl(bdev);
+	if (err < 0)
+		return err;
+
 	/* Enable Bluetooth protocol */
 	wmt_params.op = BTMTK_WMT_FUNC_CTRL;
 	wmt_params.flag = 0;
@@ -1109,14 +1117,6 @@ static int btmtksdio_setup(struct hci_dev *hdev)
 		if (err < 0)
 			return err;
 
-		err = btmtksdio_fw_pmctrl(bdev);
-		if (err < 0)
-			return err;
-
-		err = btmtksdio_drv_pmctrl(bdev);
-		if (err < 0)
-			return err;
-
 		/* Enable SCO over I2S/PCM */
 		err = btmtksdio_sco_setting(hdev);
 		if (err < 0) {
Signature · 1 line
2.25.1
#2 lore raw
In reply to [email protected]

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=641161

---Test result---

Test Summary:

CheckPatch                    PASS      3.34 seconds
GitLint                       PASS      2.14 seconds
SubjectPrefix                 PASS      1.72 seconds
BuildKernel                   PASS      30.44 seconds
BuildKernel32                 PASS      30.25 seconds
Incremental Build with patchesPASS      45.84 seconds
TestRunner: Setup             PASS      493.42 seconds
TestRunner: l2cap-tester      PASS      17.46 seconds
TestRunner: bnep-tester       PASS      6.12 seconds
TestRunner: mgmt-tester       PASS      106.15 seconds
TestRunner: rfcomm-tester     PASS      9.66 seconds
TestRunner: sco-tester        PASS      9.65 seconds
TestRunner: smp-tester        PASS      10.44 seconds
TestRunner: userchan-tester   PASS      7.15 seconds

---
Regards,
Linux Bluetooth

#3 lore raw
In reply to [email protected]
This series was applied to bluetooth/bluetooth-next.git (master) by Marcel Holtmann <[email protected]>:

Hello:

This series was applied to bluetooth/bluetooth-next.git (master) by Marcel Holtmann <[email protected]>:

Quoted 8 lines · On Fri, 13 May 2022 05:38:11 +0800 you wrote:

From: Sean Wang <[email protected]>

Sending WMT command during the reset in progress is invalid and would get no response from firmware until the reset is complete, so we ignore the WMT command here to resolve the issue which causes the whole reset process taking too long.

[...]

Here is the summary with links:
- [1/2] Bluetooth: btmtksdio: fix the reset takes too long
https://git.kernel.org/bluetooth/bluetooth-next/c/baabb7f530e8
- [2/2] Bluetooth: btmtksdio: fix possible FW initialization failure

    https://git.kernel.org/bluetooth/bluetooth-next/c/7469720563e0

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
maintainer Tested-by on v1 1/2
#4 lore raw
In reply to [email protected]

Il 12/05/22 23:38, [email protected] ha scritto:

Quoted 11 lines

From: Sean Wang <[email protected]>

Sending WMT command during the reset in progress is invalid and would get no response from firmware until the reset is complete, so we ignore the WMT command here to resolve the issue which causes the whole reset process taking too long.

Fixes 8fafe702253d ("Bluetooth: mt7921s: support bluetooth reset mechanism")

It may be too late but, in any case, for the entire series:

_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek