]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mfd: Fix for DA9055 driver initialization
authorAnkur Raina <Ankur.Raina@kpitcummins.com>
Fri, 5 Jul 2013 13:18:30 +0000 (18:48 +0530)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 31 Jul 2013 00:02:53 +0000 (02:02 +0200)
This patch clears all the events received while powering up DA9055.

While powering up DA9055, both power sequencer and gpio events are received.
These events remain uncleared after boot up, due to which further event handling
also fails. DA9055 has three event registers. The event register bits are set
to '1' on receiving an event. The events can be cleared on writing a '1' to
the set bit, which would then clear that bit to '0'. After applying this patch
we have a clean state after boot up.

Signed-off-by: Ankur Raina <Ankur.Raina@kpitcummins.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/da9055-core.c

index 49cb23d37469153980f5b78ceb0126f1d46aa852..e4c0596723abc29fe6b8579d382f636c51b25804 100644 (file)
@@ -381,6 +381,7 @@ int da9055_device_init(struct da9055 *da9055)
 {
        struct da9055_pdata *pdata = da9055->dev->platform_data;
        int ret;
+       uint8_t clear_events[3] = {0xFF, 0xFF, 0xFF};
 
        if (pdata && pdata->init != NULL)
                pdata->init(da9055);
@@ -390,6 +391,10 @@ int da9055_device_init(struct da9055 *da9055)
        else
                da9055->irq_base = pdata->irq_base;
 
+       ret = da9055_group_write(da9055, DA9055_REG_EVENT_A, 3, clear_events);
+       if (ret < 0)
+               return ret;
+
        ret = regmap_add_irq_chip(da9055->regmap, da9055->chip_irq,
                                  IRQF_TRIGGER_LOW | IRQF_ONESHOT,
                                  da9055->irq_base, &da9055_regmap_irq_chip,