Skip to content

Commit c4f725b

Browse files
krzkLee Jones
authored andcommitted
mfd: max14577: 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 max14577 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: max14577 2-0025: Failed to read IRQ status: -5 Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
1 parent 360d15d commit c4f725b

1 file changed

Lines changed: 13 additions & 16 deletions

File tree

‎drivers/mfd/max14577.c‎

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -414,20 +414,18 @@ static int max14577_suspend(struct device *dev)
414414
struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
415415
struct max14577 *max14577 = i2c_get_clientdata(i2c);
416416

417-
if (device_may_wakeup(dev)) {
417+
if (device_may_wakeup(dev))
418418
enable_irq_wake(max14577->irq);
419-
/*
420-
* MUIC IRQ must be disabled during suspend if this is
421-
* a wake up source because it will be handled before
422-
* resuming I2C.
423-
*
424-
* When device is woken up from suspend (e.g. by ADC change),
425-
* an interrupt occurs before resuming I2C bus controller.
426-
* Interrupt handler tries to read registers but this read
427-
* will fail because I2C is still suspended.
428-
*/
429-
disable_irq(max14577->irq);
430-
}
419+
/*
420+
* MUIC IRQ must be disabled during suspend because if it happens
421+
* while suspended it will be handled before resuming I2C.
422+
*
423+
* When device is woken up from suspend (e.g. by ADC change),
424+
* an interrupt occurs before resuming I2C bus controller.
425+
* Interrupt handler tries to read registers but this read
426+
* will fail because I2C is still suspended.
427+
*/
428+
disable_irq(max14577->irq);
431429

432430
return 0;
433431
}
@@ -437,10 +435,9 @@ static int max14577_resume(struct device *dev)
437435
struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
438436
struct max14577 *max14577 = i2c_get_clientdata(i2c);
439437

440-
if (device_may_wakeup(dev)) {
438+
if (device_may_wakeup(dev))
441439
disable_irq_wake(max14577->irq);
442-
enable_irq(max14577->irq);
443-
}
440+
enable_irq(max14577->irq);
444441

445442
return 0;
446443
}

0 commit comments

Comments
 (0)