From 2ae2f3393361a18327d3f2a031eb7e80bdf3eb8e Mon Sep 17 00:00:00 2001 From: Evan Wilson Date: Tue, 29 Nov 2016 20:09:05 -0800 Subject: WA-1362: Potential fix for unresponsive watches This essentially reverts e3a36b207f76364c281aeecaf14c1b22a7247278 The problem was originally fixed in f08ac4e79424c266aed8282939649104b37f53b4 Essentially there is a race condition when the system is suspending and accessing the i2c bus Many drivers use the i2c bus in their suspend routine (PMICs, RTCs, etc.) The original fixed no longer worked with the introduction of pm_runtime and with the addition of this commit 2f3dcb081e91c074580fcd3da1ca1495634a8378 This commit ensures that we don't handle the interrupt if the device is supposed to already be suspended Change-Id: Icfe32eb28973eeac35f0623fcabba6db3c79cc45 --- drivers/i2c/busses/i2c-omap.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 00fb5ac811c..aaeb93e44e0 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -960,6 +960,11 @@ omap_i2c_isr_handler(struct omap_i2c_dev *dev) u16 stat; int err = 0, count = 0; + if (pm_runtime_suspended(dev->dev)) { + WARN_ONCE(true, "We should never be here!\n"); + return IRQ_NONE; + } + do { bits = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG); @@ -1109,6 +1114,11 @@ omap_i2c_isr(int irq, void *dev_id) u16 mask; u16 stat; + if (pm_runtime_suspended(dev->dev)) { + WARN_ONCE(true, "We should never be here!\n"); + return IRQ_NONE; + } + spin_lock(&dev->lock); mask = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG); -- cgit v1.2.3-70-g09d2