Skip to content

Commit

Permalink
mfd: max77693: Fix always masked MUIC interrupts
Browse files Browse the repository at this point in the history
All interrupts coming from MUIC were ignored because interrupt source
register was masked.

The Maxim 77693 has a "interrupt source" - a separate register and interrupts
which give information about PMIC block triggering the individual
interrupt (charger, topsys, MUIC, flash LED).

By default bootloader could initialize this register to "mask all"
value. In such case (observed on Trats2 board) MUIC interrupts won't be
generated regardless of their mask status. Regmap irq chip was unmasking
individual MUIC interrupts but the source was masked

Before introducing regmap irq chip this interrupt source was unmasked,
read and acked. Reading and acking is not necessary but unmasking is.

Fixes: 342d669 ("mfd: max77693: Handle IRQs using regmap")

Cc: <[email protected]>
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Chanwoo Choi <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
  • Loading branch information
krzk authored and Lee Jones committed Nov 10, 2014
1 parent 43fc939 commit c0acb81
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/mfd/max77693.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,17 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
goto err_irq_muic;
}

/* Unmask interrupts from all blocks in interrupt source register */
ret = regmap_update_bits(max77693->regmap,
MAX77693_PMIC_REG_INTSRC_MASK,
SRC_IRQ_ALL, (unsigned int)~SRC_IRQ_ALL);
if (ret < 0) {
dev_err(max77693->dev,
"Could not unmask interrupts in INTSRC: %d\n",
ret);
goto err_intsrc;
}

pm_runtime_set_active(max77693->dev);

ret = mfd_add_devices(max77693->dev, -1, max77693_devs,
Expand All @@ -261,6 +272,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,

err_mfd:
mfd_remove_devices(max77693->dev);
err_intsrc:
regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic);
err_irq_muic:
regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger);
Expand Down
7 changes: 7 additions & 0 deletions include/linux/mfd/max77693-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,13 @@ enum max77693_irq_source {
MAX77693_IRQ_GROUP_NR,
};

#define SRC_IRQ_CHARGER BIT(0)
#define SRC_IRQ_TOP BIT(1)
#define SRC_IRQ_FLASH BIT(2)
#define SRC_IRQ_MUIC BIT(3)
#define SRC_IRQ_ALL (SRC_IRQ_CHARGER | SRC_IRQ_TOP \
| SRC_IRQ_FLASH | SRC_IRQ_MUIC)

#define LED_IRQ_FLED2_OPEN BIT(0)
#define LED_IRQ_FLED2_SHORT BIT(1)
#define LED_IRQ_FLED1_OPEN BIT(2)
Expand Down

0 comments on commit c0acb81

Please sign in to comment.