Skip to content

Commit 360d15d

Browse files
krzkLee Jones
authored andcommitted
mfd: sec-core: Fix IRQ handling after resume if this is not a wakeup source
During suspend the IRQ should be disabled even if this is not a wakeup source. This is a proper way of fixing the IRQ handling issue during resume (IRQ handler fails because I2C bus did not resume yet). When device is suspended and sec-core interrupt is signaled the irq chip will try to handle it regardless of wakeup source. Device could be woken up by different IRQ but still the IRQ handler will try to read the registers over I2C bus and fail because I2C bus won't be ready yet. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
1 parent 9549b5f commit 360d15d

1 file changed

Lines changed: 13 additions & 15 deletions

File tree

‎drivers/mfd/sec-core.c‎

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -374,19 +374,18 @@ static int sec_pmic_suspend(struct device *dev)
374374
struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
375375
struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c);
376376

377-
if (device_may_wakeup(dev)) {
377+
if (device_may_wakeup(dev))
378378
enable_irq_wake(sec_pmic->irq);
379-
/*
380-
* PMIC IRQ must be disabled during suspend for RTC alarm
381-
* to work properly.
382-
* When device is woken up from suspend by RTC Alarm, an
383-
* interrupt occurs before resuming I2C bus controller.
384-
* The interrupt is handled by regmap_irq_thread which tries
385-
* to read RTC registers. This read fails (I2C is still
386-
* suspended) and RTC Alarm interrupt is disabled.
387-
*/
388-
disable_irq(sec_pmic->irq);
389-
}
379+
/*
380+
* PMIC IRQ must be disabled during suspend for RTC alarm
381+
* to work properly.
382+
* When device is woken up from suspend, an
383+
* interrupt occurs before resuming I2C bus controller.
384+
* The interrupt is handled by regmap_irq_thread which tries
385+
* to read RTC registers. This read fails (I2C is still
386+
* suspended) and RTC Alarm interrupt is disabled.
387+
*/
388+
disable_irq(sec_pmic->irq);
390389

391390
return 0;
392391
}
@@ -396,10 +395,9 @@ static int sec_pmic_resume(struct device *dev)
396395
struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
397396
struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c);
398397

399-
if (device_may_wakeup(dev)) {
398+
if (device_may_wakeup(dev))
400399
disable_irq_wake(sec_pmic->irq);
401-
enable_irq(sec_pmic->irq);
402-
}
400+
enable_irq(sec_pmic->irq);
403401

404402
return 0;
405403
}

0 commit comments

Comments
 (0)