diff --git a/drivers/bluetooth/bluesleep.c b/drivers/bluetooth/bluesleep.c index f8bdcf0a62e18b0a0bceecaa3ae511d176f79455..76244f83e44e5ab001fffb0c96133d2c897d084f 100644 --- a/drivers/bluetooth/bluesleep.c +++ b/drivers/bluetooth/bluesleep.c @@ -94,6 +94,7 @@ struct bluesleep_info { struct wake_lock wake_lock; int irq_polarity; int has_ext_wake; + int tx_timer_interval; }; /* work function */ @@ -186,7 +187,7 @@ void bluesleep_sleep_wakeup(void) wake_lock(&bsi->wake_lock); /* Start the timer */ - mod_timer(&tx_timer, jiffies + (TX_TIMER_INTERVAL * HZ)); + mod_timer(&tx_timer, jiffies + (bsi->tx_timer_interval * HZ)); if (debug_mask & DEBUG_BTWAKE) pr_info("BT WAKE: set to wake\n"); @@ -230,12 +231,14 @@ static void bluesleep_sleep_work(struct work_struct *work) */ wake_lock_timeout(&bsi->wake_lock, HZ / 8); } else { - mod_timer(&tx_timer, jiffies + (TX_TIMER_INTERVAL * HZ)); + mod_timer(&tx_timer, jiffies + + (bsi->tx_timer_interval * HZ)); return; } } else if (test_bit(BT_EXT_WAKE, &flags) && !test_bit(BT_ASLEEP, &flags)) { - mod_timer(&tx_timer, jiffies + (TX_TIMER_INTERVAL * HZ)); + mod_timer(&tx_timer, jiffies + + (bsi->tx_timer_interval * HZ)); if (debug_mask & DEBUG_BTWAKE) pr_info("BT WAKE: set to wake\n"); @@ -320,7 +323,8 @@ static void bluesleep_tx_timer_expire(unsigned long data) } else { if (debug_mask & DEBUG_SUSPEND) pr_info("Tx data during last period\n"); - mod_timer(&tx_timer, jiffies + (TX_TIMER_INTERVAL * HZ)); + mod_timer(&tx_timer, jiffies + + (bsi->tx_timer_interval * HZ)); } /* clear the incoming data flag */ @@ -367,7 +371,8 @@ static int bluesleep_start(void) } /* start the timer */ - mod_timer(&tx_timer, jiffies + (TX_TIMER_INTERVAL * HZ)); + mod_timer(&tx_timer, jiffies + + (bsi->tx_timer_interval * HZ)); /* assert BT_WAKE */ if (debug_mask & DEBUG_BTWAKE) @@ -487,6 +492,10 @@ static int bluesleep_populate_dt_pinfo(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; int tmp; + u32 val; + + if (!of_property_read_u32(np, "tx-timer-interval", &val)) + bsi->tx_timer_interval = val; tmp = of_get_named_gpio(np, "host-wake-gpio", 0); if (tmp < 0) { @@ -557,6 +566,9 @@ static int bluesleep_probe(struct platform_device *pdev) } } + if (!bsi->tx_timer_interval) + bsi->tx_timer_interval = TX_TIMER_INTERVAL; + /* configure host_wake as input */ ret = gpio_request_one(bsi->host_wake, GPIOF_IN, "bt_host_wake"); if (ret < 0) {