diff mbox series

[v1] Bluetooth: btusb: add shutdown function for wcn6855

Message ID 1608286331-15760-1-git-send-email-zijuhu@codeaurora.org (mailing list archive)
State Accepted
Commit 3b0d5250be30e76727284bb9e4c26b662ede7378
Headers show
Series [v1] Bluetooth: btusb: add shutdown function for wcn6855 | expand

Commit Message

Zijun Hu Dec. 18, 2020, 10:12 a.m. UTC
From: Tim Jiang <tjiang@codeaurora.org>

we should send hci reset command before bt turn off, which can reset bt
firmware status.

Signed-off-by: Tim Jiang <tjiang@codeaurora.org>
---
 drivers/bluetooth/btusb.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Marcel Holtmann Dec. 18, 2020, 9:30 p.m. UTC | #1
Hi Zijun,

> we should send hci reset command before bt turn off, which can reset bt
> firmware status.
> 
> Signed-off-by: Tim Jiang <tjiang@codeaurora.org>
> ---
> drivers/bluetooth/btusb.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel
patchwork-bot+linux-arm-msm@kernel.org March 1, 2021, 7:59 p.m. UTC | #2
Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

On Fri, 18 Dec 2020 18:12:11 +0800 you wrote:
> From: Tim Jiang <tjiang@codeaurora.org>
> 
> we should send hci reset command before bt turn off, which can reset bt
> firmware status.
> 
> Signed-off-by: Tim Jiang <tjiang@codeaurora.org>
> 
> [...]

Here is the summary with links:
  - [v1] Bluetooth: btusb: add shutdown function for wcn6855
    https://git.kernel.org/qcom/c/3b0d5250be30

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 03b83aa91277..139132463a87 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -4264,6 +4264,20 @@  static bool btusb_prevent_wake(struct hci_dev *hdev)
 	return !device_may_wakeup(&data->udev->dev);
 }
 
+static int btusb_shutdown_qca(struct hci_dev *hdev)
+{
+	struct sk_buff *skb;
+
+	skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
+	if (IS_ERR(skb)) {
+		bt_dev_err(hdev, "HCI reset during shutdown failed");
+		return PTR_ERR(skb);
+	}
+	kfree_skb(skb);
+
+	return 0;
+}
+
 static int btusb_probe(struct usb_interface *intf,
 		       const struct usb_device_id *id)
 {
@@ -4523,6 +4537,7 @@  static int btusb_probe(struct usb_interface *intf,
 
 	if (id->driver_info & BTUSB_QCA_WCN6855) {
 		data->setup_on_usb = btusb_setup_qca;
+		hdev->shutdown = btusb_shutdown_qca;
 		hdev->set_bdaddr = btusb_set_bdaddr_wcn6855;
 		hdev->cmd_timeout = btusb_qca_cmd_timeout;
 		set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks);