aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHumberto Borba <humberos@gmail.com>2017-03-31 13:19:55 -0300
committerDrgravy <drg113001@gmail.com>2017-04-10 16:05:29 -0500
commit91333a5541348687569c0dd3dc664b7e279c81ca (patch)
treebf767cd5befa3f77b335e70510e24bc481b9fad3
parent637097d93b81a2a7784c67f9f58091b163682d3a (diff)
drivers: bluetooth: tone: Fix bluesleep wakelockHEADn7.1
Current driver is causing wakelock on tone devices which will not able to going to sleep properly. So, this patch uses the same logic developed for ldisc targets (tx timer) and now tone devices should be able to sleep as expected. Signed-off-by: Humberto Borba <humberos@gmail.com> Change-Id: Ia619bd8d83e049cabb082b2a668101bd6d856799
-rw-r--r--drivers/bluetooth/bluesleep.c30
-rw-r--r--drivers/tty/serial/msm_serial_hs.c2
2 files changed, 1 insertions, 31 deletions
diff --git a/drivers/bluetooth/bluesleep.c b/drivers/bluetooth/bluesleep.c
index eb046f64995..9febf75b054 100644
--- a/drivers/bluetooth/bluesleep.c
+++ b/drivers/bluetooth/bluesleep.c
@@ -153,11 +153,9 @@ static unsigned long flags;
/** Tasklet to respond to change in hostwake line */
static struct tasklet_struct hostwake_task;
-#if defined(CONFIG_LINE_DISCIPLINE_DRIVER)
/** Transmission timer */
static void bluesleep_tx_timer_expire(unsigned long data);
static DEFINE_TIMER(tx_timer, bluesleep_tx_timer_expire, 0, 0);
-#endif
/** Lock for state transitions */
static spinlock_t rw_lock;
@@ -309,10 +307,8 @@ void bluesleep_outgoing_data(void)
spin_lock_irqsave(&rw_lock, irq_flags);
-#if defined(CONFIG_LINE_DISCIPLINE_DRIVER)
mod_timer(&tx_timer, jiffies + (TX_TIMER_INTERVAL * HZ));
set_bit(BT_TXDATA, &flags);
-#endif
/* if the tx side is sleeping... */
if (test_bit(BT_EXT_WAKE, &flags)) {
@@ -355,22 +351,13 @@ void bluesleep_tx_allow_sleep(void)
spin_lock_irqsave(&rw_lock, irq_flags);
-#ifdef CONFIG_LINE_DISCIPLINE_DRIVER
mod_timer(&tx_timer, jiffies + (TX_TIMER_INTERVAL*HZ));
clear_bit(BT_TXDATA, &flags);
-#else
- if (bsi->has_ext_wake == 1)
- gpio_set_value(bsi->ext_wake, 0);
- set_bit(BT_EXT_WAKE, &flags);
-
- bluesleep_tx_idle();
-#endif
spin_unlock_irqrestore(&rw_lock, irq_flags);
}
EXPORT_SYMBOL(bluesleep_tx_allow_sleep);
-#if defined(CONFIG_LINE_DISCIPLINE_DRIVER)
/**
* Handles reception timer expiration.
* @param data Not used.
@@ -403,7 +390,6 @@ static void bluesleep_tx_timer_expire(unsigned long data)
spin_unlock_irqrestore(&rw_lock, irq_flags);
}
-#endif
/**
* Schedules a tasklet to run when receiving an interrupt on the
@@ -446,10 +432,7 @@ int bluesleep_start(bool is_clock_enabled)
gpio_set_value(bsi->ext_wake, 1);
clear_bit(BT_EXT_WAKE, &flags);
-#if defined(CONFIG_LINE_DISCIPLINE_DRIVER)
clear_bit(BT_TXDATA, &flags);
-#endif
-
clear_bit(BT_ASLEEP, &flags);
spin_unlock_irqrestore(&rw_lock, irq_flags);
@@ -491,9 +474,7 @@ void bluesleep_stop(void)
set_bit(BT_EXT_WAKE, &flags);
clear_bit(BT_PROTO, &flags);
-#if defined(CONFIG_LINE_DISCIPLINE_DRIVER)
del_timer(&tx_timer);
-#endif
if (!test_bit(BT_ASLEEP, &flags)) {
set_bit(BT_ASLEEP, &flags);
@@ -503,10 +484,7 @@ void bluesleep_stop(void)
spin_unlock_irqrestore(&rw_lock, irq_flags);
}
-#if defined(CONFIG_LINE_DISCIPLINE_DRIVER)
atomic_set(&uart_is_on, 0);
-#endif
-
atomic_dec(&open_count);
enable_wakeup_irq(0);
@@ -668,12 +646,8 @@ static int bluesleep_probe(struct platform_device *pdev)
goto free_bt_ext_wake;
}
-#if defined(CONFIG_LINE_DISCIPLINE_DRIVER)
bsi->uport = msm_hs_get_uart_port(BT_PORT_ID);
atomic_set(&bsi->wakeup_irq_disabled, 1);
-#else
- enable_wakeup_irq(0);
-#endif
return 0;
@@ -877,13 +851,11 @@ static int __init bluesleep_init(void)
/* Initialize spinlock. */
spin_lock_init(&rw_lock);
-#if defined(CONFIG_LINE_DISCIPLINE_DRIVER)
/* Initialize timer */
init_timer(&tx_timer);
tx_timer.function = bluesleep_tx_timer_expire;
tx_timer.data = 0;
clear_bit(BT_TXDATA, &flags);
-#endif
/* initialize host wake tasklet */
tasklet_init(&hostwake_task, bluesleep_hostwake_task, 0);
@@ -909,9 +881,7 @@ static void __exit bluesleep_exit(void)
if (disable_irq_wake(bsi->host_wake_irq))
pr_err("Couldn't disable hostwake IRQ wakeup mode");
free_irq(bsi->host_wake_irq, NULL);
-#if defined(CONFIG_LINE_DISCIPLINE_DRIVER)
del_timer(&tx_timer);
-#endif
if (!test_bit(BT_ASLEEP, &flags))
hsuart_power(HS_UART_OFF);
}
diff --git a/drivers/tty/serial/msm_serial_hs.c b/drivers/tty/serial/msm_serial_hs.c
index e0716bc5f2d..46dd3b093cd 100644
--- a/drivers/tty/serial/msm_serial_hs.c
+++ b/drivers/tty/serial/msm_serial_hs.c
@@ -2729,7 +2729,7 @@ static int msm_hs_startup(struct uart_port *uport)
spin_lock_irqsave(&uport->lock, flags);
-#ifndef CONFIG_LINE_DISCIPLINE_DRIVER
+#ifdef CONFIG_BT_MSM_SLEEP
atomic_set(&msm_uport->client_count, 0);
atomic_set(&msm_uport->client_req_state, 0);
#endif