* [PATCH] Bluetooth: btusb: Add HCI reset command on BT shutdown
@ 2018-08-01 6:23 Amit K Bag
2018-08-01 7:16 ` Marcel Holtmann
0 siblings, 1 reply; 2+ messages in thread
From: Amit K Bag @ 2018-08-01 6:23 UTC (permalink / raw)
To: linux-bluetooth; +Cc: ravishankar.srivatsa, Amit K Bag
In case of BT turn off from UI it is safe to add HCI reset command
which will maintain the controller state.
Signed-off-by: Amit K Bag <amit.k.bag@intel.com>
---
drivers/bluetooth/btusb.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 572fd75fbcf6..599ec9b12d3f 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2369,6 +2369,18 @@ static int btusb_shutdown_intel(struct hci_dev *hdev)
struct sk_buff *skb;
long ret;
+ /* In case of BT off from UI it is safe to do HCI reset.
+ * This will maintain the controller state.
+ */
+ skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
+ if (IS_ERR(skb)) {
+ ret = PTR_ERR(skb);
+ BT_ERR("%s: BT controller HCI reset failed (%ld)",
+ hdev->name, ret);
+ return ret;
+ }
+ kfree_skb(skb);
+
/* Some platforms have an issue with BT LED when the interface is
* down or BT radio is turned off, which takes 5 seconds to BT LED
* goes off. This command turns off the BT LED immediately.
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: btusb: Add HCI reset command on BT shutdown
2018-08-01 6:23 [PATCH] Bluetooth: btusb: Add HCI reset command on BT shutdown Amit K Bag
@ 2018-08-01 7:16 ` Marcel Holtmann
0 siblings, 0 replies; 2+ messages in thread
From: Marcel Holtmann @ 2018-08-01 7:16 UTC (permalink / raw)
To: Amit K Bag; +Cc: linux-bluetooth, ravishankar.srivatsa
Hi Amit,
> In case of BT turn off from UI it is safe to add HCI reset command
> which will maintain the controller state.
this needs to be a bit more details since hdev->shutdown handling is really only for the older Intel controllers.
Also I am failing to see why HCI Reset helps or what it does here. It is going to be called again on hdev->open the next time the controller is activated.
>
> Signed-off-by: Amit K Bag <amit.k.bag@intel.com>
> ---
> drivers/bluetooth/btusb.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 572fd75fbcf6..599ec9b12d3f 100644
> --- a/drivers/bluetooth/btusb.c
> +++ b/drivers/bluetooth/btusb.c
> @@ -2369,6 +2369,18 @@ static int btusb_shutdown_intel(struct hci_dev *hdev)
> struct sk_buff *skb;
> long ret;
>
> + /* In case of BT off from UI it is safe to do HCI reset.
> + * This will maintain the controller state.
> + */
I do not care what the UI does here. This is power down operation and so it needs to be explained properly. And with a lot more details since I am failing to understand what state is maintained on HCI Reset. As per specification it will reset all Bluetooth states back to the defaults.
> + skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
> + if (IS_ERR(skb)) {
> + ret = PTR_ERR(skb);
> + BT_ERR("%s: BT controller HCI reset failed (%ld)",
> + hdev->name, ret);
> + return ret;
> + }
> + kfree_skb(skb);
> +
There is whitespace damage here. And if this hasn’t been done yet, please first start using bt_dev_err instead of BT_ERR for the Intel parts.
> /* Some platforms have an issue with BT LED when the interface is
> * down or BT radio is turned off, which takes 5 seconds to BT LED
> * goes off. This command turns off the BT LED immediately.
Regards
Marcel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-01 7:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-01 6:23 [PATCH] Bluetooth: btusb: Add HCI reset command on BT shutdown Amit K Bag
2018-08-01 7:16 ` Marcel Holtmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.