mfd: wcd9xxx: clear unhandled interrupt request properly
Current irq handler writes INTR_STATUS registers to clear irqs incorrectly
when unhandled irq is detected while it has to write INTR_CLEAR instead.
Also INTR_MODE register needs to be updated after clearing interrupt
requests if hardware is running off i2c.
Fix irq handler to write correct reset value to INTR_CLEAR registers along
with INTR_MODE register update for i2c mode.
Change-Id: Icc6837c3937a5c1251dd1821154ed4cb676ec063
Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
diff --git a/drivers/mfd/wcd9xxx-irq.c b/drivers/mfd/wcd9xxx-irq.c
index 111131a..5efd905 100644
--- a/drivers/mfd/wcd9xxx-irq.c
+++ b/drivers/mfd/wcd9xxx-irq.c
@@ -304,9 +304,11 @@
pr_warn("%s: status1 : %s\n", __func__, linebuf);
}
- memset(status, 0, num_irq_regs);
- wcd9xxx_bulk_write(wcd9xxx, WCD9XXX_A_INTR_STATUS0,
+ memset(status, 0xff, num_irq_regs);
+ wcd9xxx_bulk_write(wcd9xxx, WCD9XXX_A_INTR_CLEAR0,
num_irq_regs, status);
+ if (wcd9xxx_get_intf_type() == WCD9XXX_INTERFACE_TYPE_I2C)
+ wcd9xxx_reg_write(wcd9xxx, WCD9XXX_A_INTR_MODE, 0x02);
}
wcd9xxx_unlock_sleep(wcd9xxx);