linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2] Bluetooth: btusb: Fix Intel controller hang after shutdown
@ 2015-05-21 14:35 Loic Poulain
  2015-05-21 19:56 ` Marcel Holtmann
  0 siblings, 1 reply; 8+ messages in thread
From: Loic Poulain @ 2015-05-21 14:35 UTC (permalink / raw)
  To: marcel, tedd.an; +Cc: linux-bluetooth, Loic Poulain

The vendor command (0xfc3f) in btusb_shutdown_intel causes an internal
reset with old firmware. After that, upcoming HCI command will hang due
to a controller bug with the first HCI command sent to it.
The workaround is to send HCI Reset command first which will reset the
number of completed commands.

Signed-off-by: Loic Poulain <loic.poulain@intel.com>
---
 v2: Send HCI reset from shutdown instead of using HCI_QUIRK_RESET_ON_CLOSE
 drivers/bluetooth/btusb.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index d21f3b4..589f30c 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2705,6 +2705,19 @@ static int btusb_shutdown_intel(struct hci_dev *hdev)
 	}
 	kfree_skb(skb);
 
+	/* The 0xfc3f command causes an internal reset with old firmware.
+	 * In order to avoid the Bug with the first HCI command, we have
+	 * to send a HCI reset which will reset the number of completed
+	 * command.
+	 */
+	skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
+	if (IS_ERR(skb)) {
+		BT_ERR("%s: Shutdown HCI reset command failed (%ld)",
+			hdev->name, PTR_ERR(skb));
+		return PTR_ERR(skb);
+	}
+	kfree_skb(skb);
+
 	return 0;
 }
 
-- 
1.9.1

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

end of thread, other threads:[~2015-06-08 18:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-21 14:35 [PATCHv2] Bluetooth: btusb: Fix Intel controller hang after shutdown Loic Poulain
2015-05-21 19:56 ` Marcel Holtmann
2015-06-04 11:59   ` Loic Poulain
2015-06-04 19:55     ` An, Tedd
2015-06-08  7:42       ` Ge, Ethan
2015-06-08  7:48         ` Ge, Ethan
2015-06-08  8:45           ` Loic Poulain
2015-06-08 18:18       ` Tedd Ho-Jeong An

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).