summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2013-01-18 01:13:05 +0400
committerAlejandro Mery <amery@geeks.cl>2013-01-24 20:28:57 +0400
commitc3acbe9ad5d6953295cd1bdfcd863b7fd1a31cec (patch)
tree1a00815a573eb5ea1c0b2c21a343170b1a3253dc
parent3bfbc55fbc64b998e983cf56f77c7e72f9f5c04e (diff)
downloadlinux-sunxi-c3acbe9ad5d6953295cd1bdfcd863b7fd1a31cec.tar.xz
axp20-mfd.h: Fixup axp20_init_chip to not cause spurious interrupts
Before this patch axp20_init_chip did the following: 1) Set the interrupt enable registers to 0x000000000103ffd8 2) Write 0xffffffffffffffff to the interrupt status registers to write-clear all interrupt status bits 3) Write 0x0000000000000000 to the interrupt enable registers to disable all interrupts Between 2 and 3 an unwanted interrupt can trigger and since this is all done over slow i2c there is plenty of time for this. This patch fixes this by changing the init sequence to: 1) Set the interrupt enable registers to 0x0000000000000000 2) Write 0xffffffffffffffff to the interrupt status registers to write-clear all interrupt status bits Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--drivers/power/axp_power/axp20-mfd.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/drivers/power/axp_power/axp20-mfd.h b/drivers/power/axp_power/axp20-mfd.h
index 3c4ad310cba3..1c7a41bfa0f6 100644
--- a/drivers/power/axp_power/axp20-mfd.h
+++ b/drivers/power/axp_power/axp20-mfd.h
@@ -26,9 +26,9 @@
static int __devinit axp20_init_chip(struct axp_mfd_chip *chip)
{
uint8_t chip_id;
- uint8_t v[19] = { /* POWER20_INTEN1 */ 0xd8,
- POWER20_INTEN2, 0xff, POWER20_INTEN3, 0x03,
- POWER20_INTEN4, 0x01, POWER20_INTEN5, 0x00,
+ uint8_t v[19] = { /* POWER20_INTEN1 */ 0x00,
+ POWER20_INTEN2, 0x00, POWER20_INTEN3, 0x00,
+ POWER20_INTEN4, 0x00, POWER20_INTEN5, 0x00,
POWER20_INTSTS1, 0xff, POWER20_INTSTS2, 0xff,
POWER20_INTSTS3, 0xff, POWER20_INTSTS4, 0xff,
POWER20_INTSTS5, 0xff };
@@ -40,20 +40,17 @@ static int __devinit axp20_init_chip(struct axp_mfd_chip *chip)
return err;
}
- /*enable irqs and clear*/
+ /* Mask and clear all IRQs */
err = __axp_writes(chip->client, POWER20_INTEN1, 19, v);
if (err) {
printk("[AXP20-MFD] try to clear irq failed!\n");
return err;
}
+ chip->irqs_enabled = 0;
dev_info(chip->dev, "AXP (CHIP ID: 0x%02x) detected\n", chip_id);
chip->type = AXP20;
- /* mask and clear all IRQs */
- chip->irqs_enabled = 0xffffffff | (uint64_t)0xff << 32;
- chip->ops->disable_irqs(chip, chip->irqs_enabled);
-
return 0;
}