lp8727_charger: Clear interrrupts at inital time
authorKim, Milo <Milo.Kim@ti.com>
Fri, 31 Aug 2012 09:24:09 +0000 (09:24 +0000)
committerAnton Vorontsov <anton.vorontsov@linaro.org>
Fri, 21 Sep 2012 01:00:38 +0000 (18:00 -0700)
To initialize the device, previous interrupts need to be cleared while
loading the driver.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
drivers/power/lp8727_charger.c

index 134ed5c..b5567bc 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/power_supply.h>
 #include <linux/platform_data/lp8727.h>
 
+#define LP8788_NUM_INTREGS     2
 #define DEFAULT_DEBOUNCE_MSEC  270
 
 /* Registers */
@@ -136,6 +137,13 @@ static int lp8727_init_device(struct lp8727_chg *pchg)
 {
        u8 val;
        int ret;
+       u8 intstat[LP8788_NUM_INTREGS];
+
+       /* clear interrupts */
+       ret = lp8727_read_bytes(pchg, INT1, intstat, LP8788_NUM_INTREGS);
+       if (ret)
+               return ret;
+
 
        val = ID200_EN | ADC_EN | CP_EN;
        ret = lp8727_write_byte(pchg, CTRL1, val);