#include <linux/idr.h>
#include <linux/i2c.h>
#include <linux/slab.h>
+#include <linux/interrupt.h>
#include <asm/unaligned.h>
#include <linux/power/bq27xxx_battery.h>
di->last_update = jiffies;
}
+static irqreturn_t bq27xxx_battery_irq_handler_thread(int irq, void *data)
+{
+ struct bq27xxx_device_info *di = data;
+
+ bq27xxx_battery_update(di);
+
+ return IRQ_HANDLED;
+}
+
static void bq27xxx_battery_poll(struct work_struct *work)
{
struct bq27xxx_device_info *di =
i2c_set_clientdata(client, di);
+ if (client->irq) {
+ retval = devm_request_threaded_irq(&client->dev, client->irq,
+ NULL, bq27xxx_battery_irq_handler_thread,
+ IRQF_ONESHOT,
+ name, di);
+ if (retval) {
+ dev_err(&client->dev,
+ "Unable to register IRQ %d error %d\n",
+ client->irq, retval);
+ return retval;
+ }
+ }
+
return 0;
batt_failed: