diff options
Diffstat (limited to 'drivers/mfd/tps65910.c')
| -rw-r--r-- | drivers/mfd/tps65910.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index f4b99d84396..28219d12a9f 100644 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c @@ -312,6 +312,23 @@ static int tps65910_ck32k_init(struct tps65910 *tps65910, return 0; } +static void tps65910_clear_interrupts(struct tps65910 *tps65910) +{ + u32 val; + int ret; + + ret = tps65910_reg_read(tps65910, TPS65910_INT_STS, &val); + + /* interrupts are cleared by writing '1' to the bit */ + if (val) + ret = tps65910_reg_write(tps65910, TPS65910_INT_STS, val); + + ret = tps65910_reg_read(tps65910, TPS65910_INT_STS2, &val); + + if (val) + ret = tps65910_reg_write(tps65910, TPS65910_INT_STS2, val); +} + static int tps65910_sleepinit(struct tps65910 *tps65910, struct tps65910_board *pmic_pdata) { @@ -320,8 +337,13 @@ static int tps65910_sleepinit(struct tps65910 *tps65910, dev = tps65910->dev; - if (!pmic_pdata->en_dev_slp) - return 0; + /* set polarity of SLLEEPSIG requst ot enter OFF mode */ + ret = tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL2, + DEVCTRL2_SLEEPSIG_POL_MASK); + if (ret < 0) { + dev_err(dev, "set sleepsig_pol failed: %d\n", ret); + goto err_sleep_init; + } /* enabling SLEEP device state */ ret = tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL, @@ -497,6 +519,11 @@ static int tps65910_i2c_probe(struct i2c_client *i2c, init_data->irq = pmic_plat_data->irq; init_data->irq_base = pmic_plat_data->irq_base; + /* + * clear pending interrupts - power on event generate several + * interrupts. + */ + tps65910_clear_interrupts(tps65910); tps65910_irq_init(tps65910, init_data->irq, init_data); tps65910_ck32k_init(tps65910, pmic_plat_data); tps65910_sleepinit(tps65910, pmic_plat_data); |