public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails
@ 2025-04-03 15:02 Neeraj Sanjay Kale
  2025-04-03 15:02 ` [PATCH v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown Neeraj Sanjay Kale
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Neeraj Sanjay Kale @ 2025-04-03 15:02 UTC (permalink / raw)
  To: marcel, luiz.dentz
  Cc: linux-bluetooth, linux-kernel, amitkumar.karwar,
	neeraj.sanjaykale, sherry.sun

This prints an error message if the FW Dump trigger command fails. This
scenario is mainly observed in legacy chipsets 8987 and 8997 and also
IW416, where this feature is unavailable due to memory constraints.

Fixes: 998e447f443f ("Bluetooth: btnxpuart: Add support for HCI coredump feature")
Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
---
v2: Create this as a separate patch. (Neeraj)
---
 drivers/bluetooth/btnxpuart.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
index 5091dea762a0..96dd098cee98 100644
--- a/drivers/bluetooth/btnxpuart.c
+++ b/drivers/bluetooth/btnxpuart.c
@@ -1286,7 +1286,9 @@ static void nxp_coredump(struct hci_dev *hdev)
 	u8 pcmd = 2;
 
 	skb = nxp_drv_send_cmd(hdev, HCI_NXP_TRIGGER_DUMP, 1, &pcmd);
-	if (!IS_ERR(skb))
+	if (IS_ERR(skb))
+		bt_dev_err(hdev, "Failed to trigger FW Dump. (%ld)", PTR_ERR(skb));
+	else
 		kfree_skb(skb);
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown
  2025-04-03 15:02 [PATCH v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails Neeraj Sanjay Kale
@ 2025-04-03 15:02 ` Neeraj Sanjay Kale
  2025-04-03 19:03   ` [v1] " bluez.test.bot
  2025-04-03 20:20   ` [PATCH v1] " patchwork-bot+bluetooth
  2025-04-03 19:03 ` [v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails bluez.test.bot
  2025-04-03 20:20 ` [PATCH v2] " patchwork-bot+bluetooth
  2 siblings, 2 replies; 6+ messages in thread
From: Neeraj Sanjay Kale @ 2025-04-03 15:02 UTC (permalink / raw)
  To: marcel, luiz.dentz
  Cc: linux-bluetooth, linux-kernel, amitkumar.karwar,
	neeraj.sanjaykale, sherry.sun

This reverts the change baudrate logic in nxp_shutdown.

Earlier, when the driver was removed, it restored the controller
baudrate to fw_init_baudrate, so that on re-loading the driver, things
work fine.

However, if the driver was removed while hci0 interface is down, the
change baudrate vendor command could not be sent by the driver. When the
driver was re-loaded, host and controller baudrate would be mismatched
and hci initialization would fail. The only way to recover would be to
reboot the system.

This issue was fixed by moving the restore baudrate logic from
nxp_serdev_remove() to nxp_shutdown().

This fix however caused another issue with the command "hciconfig hci0
reset", which makes hci0 DOWN and UP immediately.

Running "bluetoothctl power off" and "bluetoothctl power on" in a tight
loop works fine.

To maintain support for "hciconfig reset" command, the above mentioned fix
is reverted.

Fixes: 6fca6781d19d ("Bluetooth: btnxpuart: Move vendor specific initialization to .post_init")
Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
---
 drivers/bluetooth/btnxpuart.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
index 96dd098cee98..604ab2bba231 100644
--- a/drivers/bluetooth/btnxpuart.c
+++ b/drivers/bluetooth/btnxpuart.c
@@ -1447,9 +1447,6 @@ static int nxp_shutdown(struct hci_dev *hdev)
 		/* HCI_NXP_IND_RESET command may not returns any response */
 		if (!IS_ERR(skb))
 			kfree_skb(skb);
-	} else if (nxpdev->current_baudrate != nxpdev->fw_init_baudrate) {
-		nxpdev->new_baudrate = nxpdev->fw_init_baudrate;
-		nxp_set_baudrate_cmd(hdev, NULL);
 	}
 
 	return 0;
@@ -1801,13 +1798,15 @@ static void nxp_serdev_remove(struct serdev_device *serdev)
 		clear_bit(BTNXPUART_FW_DOWNLOADING, &nxpdev->tx_state);
 		wake_up_interruptible(&nxpdev->check_boot_sign_wait_q);
 		wake_up_interruptible(&nxpdev->fw_dnld_done_wait_q);
-	}
-
-	if (test_bit(HCI_RUNNING, &hdev->flags)) {
-		/* Ensure shutdown callback is executed before unregistering, so
-		 * that baudrate is reset to initial value.
+	} else {
+		/* Restore FW baudrate to fw_init_baudrate if changed.
+		 * This will ensure FW baudrate is in sync with
+		 * driver baudrate in case this driver is re-inserted.
 		 */
-		nxp_shutdown(hdev);
+		if (nxpdev->current_baudrate != nxpdev->fw_init_baudrate) {
+			nxpdev->new_baudrate = nxpdev->fw_init_baudrate;
+			nxp_set_baudrate_cmd(hdev, NULL);
+		}
 	}
 
 	ps_cleanup(nxpdev);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails
  2025-04-03 15:02 [PATCH v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails Neeraj Sanjay Kale
  2025-04-03 15:02 ` [PATCH v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown Neeraj Sanjay Kale
@ 2025-04-03 19:03 ` bluez.test.bot
  2025-04-03 20:20 ` [PATCH v2] " patchwork-bot+bluetooth
  2 siblings, 0 replies; 6+ messages in thread
From: bluez.test.bot @ 2025-04-03 19:03 UTC (permalink / raw)
  To: linux-bluetooth, neeraj.sanjaykale

[-- Attachment #1: Type: text/plain, Size: 1681 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=949648

---Test result---

Test Summary:
CheckPatch                    PENDING   0.37 seconds
GitLint                       PENDING   0.31 seconds
SubjectPrefix                 PASS      0.28 seconds
BuildKernel                   PASS      24.10 seconds
CheckAllWarning               PASS      26.56 seconds
CheckSparse                   PASS      30.02 seconds
BuildKernel32                 PASS      23.80 seconds
TestRunnerSetup               PASS      426.29 seconds
TestRunner_l2cap-tester       PASS      20.77 seconds
TestRunner_iso-tester         PASS      33.05 seconds
TestRunner_bnep-tester        PASS      4.60 seconds
TestRunner_mgmt-tester        PASS      121.22 seconds
TestRunner_rfcomm-tester      PASS      7.78 seconds
TestRunner_sco-tester         PASS      12.35 seconds
TestRunner_ioctl-tester       PASS      8.16 seconds
TestRunner_mesh-tester        PASS      5.88 seconds
TestRunner_smp-tester         PASS      7.12 seconds
TestRunner_userchan-tester    PASS      4.88 seconds
IncrementalBuild              PENDING   0.90 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown
  2025-04-03 15:02 ` [PATCH v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown Neeraj Sanjay Kale
@ 2025-04-03 19:03   ` bluez.test.bot
  2025-04-03 20:20   ` [PATCH v1] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 6+ messages in thread
From: bluez.test.bot @ 2025-04-03 19:03 UTC (permalink / raw)
  To: linux-bluetooth, neeraj.sanjaykale

[-- Attachment #1: Type: text/plain, Size: 2189 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=949649

---Test result---

Test Summary:
CheckPatch                    PENDING   0.31 seconds
GitLint                       PENDING   0.20 seconds
SubjectPrefix                 PASS      0.09 seconds
BuildKernel                   PASS      24.15 seconds
CheckAllWarning               PASS      26.67 seconds
CheckSparse                   PASS      30.21 seconds
BuildKernel32                 PASS      24.38 seconds
TestRunnerSetup               PASS      436.55 seconds
TestRunner_l2cap-tester       PASS      21.31 seconds
TestRunner_iso-tester         PASS      32.67 seconds
TestRunner_bnep-tester        PASS      4.66 seconds
TestRunner_mgmt-tester        FAIL      117.89 seconds
TestRunner_rfcomm-tester      PASS      7.75 seconds
TestRunner_sco-tester         PASS      12.46 seconds
TestRunner_ioctl-tester       PASS      8.21 seconds
TestRunner_mesh-tester        PASS      5.97 seconds
TestRunner_smp-tester         PASS      7.16 seconds
TestRunner_userchan-tester    PASS      4.96 seconds
IncrementalBuild              PENDING   0.87 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 490, Passed: 482 (98.4%), Failed: 4, Not Run: 4

Failed Test Cases
LL Privacy - Add Device 3 (AL is full)               Failed       0.183 seconds
LL Privacy - Set Flags 2 (Enable RL)                 Failed       0.150 seconds
LL Privacy - Set Flags 3 (2 Devices to RL)           Failed       0.179 seconds
LL Privacy - Set Device Flag 1 (Device Privacy)      Failed       0.138 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails
  2025-04-03 15:02 [PATCH v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails Neeraj Sanjay Kale
  2025-04-03 15:02 ` [PATCH v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown Neeraj Sanjay Kale
  2025-04-03 19:03 ` [v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails bluez.test.bot
@ 2025-04-03 20:20 ` patchwork-bot+bluetooth
  2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+bluetooth @ 2025-04-03 20:20 UTC (permalink / raw)
  To: Neeraj Sanjay Kale
  Cc: marcel, luiz.dentz, linux-bluetooth, linux-kernel,
	amitkumar.karwar, sherry.sun

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu,  3 Apr 2025 20:32:22 +0530 you wrote:
> This prints an error message if the FW Dump trigger command fails. This
> scenario is mainly observed in legacy chipsets 8987 and 8997 and also
> IW416, where this feature is unavailable due to memory constraints.
> 
> Fixes: 998e447f443f ("Bluetooth: btnxpuart: Add support for HCI coredump feature")
> Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
> 
> [...]

Here is the summary with links:
  - [v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails
    https://git.kernel.org/bluetooth/bluetooth-next/c/061e4972c48c

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] 6+ messages in thread

* Re: [PATCH v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown
  2025-04-03 15:02 ` [PATCH v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown Neeraj Sanjay Kale
  2025-04-03 19:03   ` [v1] " bluez.test.bot
@ 2025-04-03 20:20   ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 6+ messages in thread
From: patchwork-bot+bluetooth @ 2025-04-03 20:20 UTC (permalink / raw)
  To: Neeraj Sanjay Kale
  Cc: marcel, luiz.dentz, linux-bluetooth, linux-kernel,
	amitkumar.karwar, sherry.sun

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Thu,  3 Apr 2025 20:32:23 +0530 you wrote:
> This reverts the change baudrate logic in nxp_shutdown.
> 
> Earlier, when the driver was removed, it restored the controller
> baudrate to fw_init_baudrate, so that on re-loading the driver, things
> work fine.
> 
> However, if the driver was removed while hci0 interface is down, the
> change baudrate vendor command could not be sent by the driver. When the
> driver was re-loaded, host and controller baudrate would be mismatched
> and hci initialization would fail. The only way to recover would be to
> reboot the system.
> 
> [...]

Here is the summary with links:
  - [v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown
    https://git.kernel.org/bluetooth/bluetooth-next/c/17931d1b6d0c

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] 6+ messages in thread

end of thread, other threads:[~2025-04-03 20:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-03 15:02 [PATCH v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails Neeraj Sanjay Kale
2025-04-03 15:02 ` [PATCH v1] Bluetooth: btnxpuart: Revert baudrate change in nxp_shutdown Neeraj Sanjay Kale
2025-04-03 19:03   ` [v1] " bluez.test.bot
2025-04-03 20:20   ` [PATCH v1] " patchwork-bot+bluetooth
2025-04-03 19:03 ` [v2] Bluetooth: btnxpuart: Add an error message if FW dump trigger fails bluez.test.bot
2025-04-03 20:20 ` [PATCH v2] " 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