diff options
author | Nagarjuna Kristam <nkristam@nvidia.com> | 2012-07-11 16:49:24 +0530 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-07-13 05:49:30 -0700 |
commit | 9d9cd69f3129ad2643bf8cd30015266d020347cb (patch) | |
tree | ef2899fbd9a9339e01944b03bce01474e858676f /drivers/bluetooth | |
parent | c9ce3ff77d029d99ddae5577b8358258feff08a0 (diff) |
bluesleep: stop/start based on HCI_DEV_REG/HCI_DEV_UNREG events
when BT is turned off HCI_DEV_DOWN event is received and bluesleep
protocol is stopped. On bluesleep stop, EXT_WAKE gpio will be set to
default high level. This condition does not allow BT chip to enter
low power mode. So, start and stop bluesleep based on HCI_DEV_REG
and HCI_DEV_UNREG events instead of HCI_DEV_UP and HCI_DEV_DOWN.
Also, enable and disable host wake functionality based on HCI_DEV_UP and
HCI_DEV_DOWN events, as these events indicate BT turn ON and OFF
Bug 1014590
Change-Id: I3929c1328ac024eb080359283107dabf3712e9ea
Signed-off-by: Nagarjuna Kristam <nkristam@nvidia.com>
Reviewed-on: http://git-master/r/114984
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Rakesh Kumar <krakesh@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r-- | drivers/bluetooth/bluesleep.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/bluetooth/bluesleep.c b/drivers/bluetooth/bluesleep.c index fae677189fa9..910e510e0b7e 100644 --- a/drivers/bluetooth/bluesleep.c +++ b/drivers/bluetooth/bluesleep.c @@ -274,7 +274,7 @@ static int bluesleep_hci_event(struct notifier_block *this, return NOTIFY_DONE; switch (event) { - case HCI_DEV_UP: + case HCI_DEV_REG: if (!bluesleep_hdev) { bluesleep_hdev = hdev; if (bsi->has_ext_wake == 1) { @@ -287,7 +287,19 @@ static int bluesleep_hci_event(struct notifier_block *this, bluesleep_start(); } break; + case HCI_DEV_UP: +#if BT_ENABLE_IRQ_WAKE + if (enable_irq_wake(bsi->host_wake_irq)) + BT_ERR("Couldn't enable BT_HOST_WAKE as wakeup interrupt"); +#endif + break; case HCI_DEV_DOWN: +#if BT_ENABLE_IRQ_WAKE + if (disable_irq_wake(bsi->host_wake_irq)) + BT_ERR("Couldn't disable hostwake IRQ wakeup mode\n"); +#endif + break; + case HCI_DEV_UNREG: bluesleep_stop(); bluesleep_hdev = NULL; bsi->uport = NULL; @@ -353,7 +365,6 @@ static irqreturn_t bluesleep_hostwake_isr(int irq, void *dev_id) */ static int bluesleep_start(void) { - int retval; unsigned long irq_flags; spin_lock_irqsave(&rw_lock, irq_flags); @@ -377,13 +388,6 @@ static int bluesleep_start(void) set_bit(BT_EXT_WAKE, &flags); } -#if BT_ENABLE_IRQ_WAKE - retval = enable_irq_wake(bsi->host_wake_irq); - if (retval < 0) { - BT_ERR("Couldn't enable BT_HOST_WAKE as wakeup interrupt"); - goto fail; - } -#endif set_bit(BT_PROTO, &flags); return 0; fail: @@ -391,7 +395,7 @@ fail: del_timer(&tx_timer); atomic_inc(&open_count); - return retval; + return 0; } /** @@ -421,11 +425,6 @@ static void bluesleep_stop(void) atomic_inc(&open_count); spin_unlock_irqrestore(&rw_lock, irq_flags); - -#if BT_ENABLE_IRQ_WAKE - if (disable_irq_wake(bsi->host_wake_irq)) - BT_ERR("Couldn't disable hostwake IRQ wakeup mode\n"); -#endif } /** * Read the <code>BT_WAKE</code> GPIO pin value via the proc interface. |