diff options
| author | Evan Wilson <evan@oliodevices.com> | 2015-08-04 23:28:12 -0700 |
|---|---|---|
| committer | Evan Wilson <evan@oliodevices.com> | 2015-08-04 23:28:12 -0700 |
| commit | de3d691b61a9302d3284d790a630d720a906753b (patch) | |
| tree | ee43dbb71b147244422f65b77a692cf11c004afe | |
| parent | e67e4a3911a387f93f812331aa96046c0141f686 (diff) | |
| download | olio-linux-3.10-de3d691b61a9302d3284d790a630d720a906753b.tar.xz olio-linux-3.10-de3d691b61a9302d3284d790a630d720a906753b.zip | |
Adding timed wakelock to the charger irq, so it has time to notify Android
Change-Id: I061a6a86cee029941ffdb3a91012a7b642d17ea9
| -rw-r--r-- | drivers/power/bq27x00_battery.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c index 86b4709b911..c10f48b20c8 100644 --- a/drivers/power/bq27x00_battery.c +++ b/drivers/power/bq27x00_battery.c @@ -41,6 +41,7 @@ #include <linux/interrupt.h> #include <linux/slab.h> #include <asm/unaligned.h> +#include <linux/wakelock.h> #include <linux/power/bq27x00_battery.h> @@ -69,6 +70,8 @@ enum bq27xxx_reg_index { NUM_REGS }; +struct wake_lock chg_wake_lock; + /* bq27500 registers */ static __initdata u8 bq27500_regs[NUM_REGS] = { 0x00, /* CONTROL */ @@ -1351,6 +1354,7 @@ static void bq27x00_external_power_changed(struct power_supply *psy) static irqreturn_t bq27x00_chg_isr(int irq, void *dev) { struct power_supply *ps = (struct power_supply*) dev; + wake_lock_timeout(&chg_wake_lock, msecs_to_jiffies(500)); dev_dbg(ps->dev, "%s: Updating battery status\n", __func__); bq27x00_external_power_changed(ps); @@ -1405,6 +1409,8 @@ static int __init bq27x00_powersupply_init(struct bq27x00_device_info *di) return ret; } + wake_lock_init(&chg_wake_lock, WAKE_LOCK_SUSPEND, "chg_wake_lock"); + if(di->irq) { // If using an irq, disable poll interal poll_interval = 0; |