summaryrefslogtreecommitdiff
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorNagarjuna Kristam <nkristam@nvidia.com>2012-07-11 16:49:24 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 12:13:43 -0700
commit5aeb49a47ca23d190b670798eefc83d2b849fc87 (patch)
treea3f3afd9203ae8c4767660016930ac463c382001 /drivers/bluetooth
parente942ac6892ccb20f2cdac21a188b05663bbe3f9e (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> Rebase-Id: Rf96a5abebd354ff94960580be2da304ef199f671
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/bluesleep.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/bluetooth/bluesleep.c b/drivers/bluetooth/bluesleep.c
index cd74e7c2388b..ac9caede9495 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.