mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-26 08:30:53 +07:00
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>
This commit is contained in:
parent
360d15d6ef
commit
c4f725b52c
@ -414,20 +414,18 @@ static int max14577_suspend(struct device *dev)
|
||||
struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
|
||||
struct max14577 *max14577 = i2c_get_clientdata(i2c);
|
||||
|
||||
if (device_may_wakeup(dev)) {
|
||||
if (device_may_wakeup(dev))
|
||||
enable_irq_wake(max14577->irq);
|
||||
/*
|
||||
* MUIC IRQ must be disabled during suspend if this is
|
||||
* a wake up source because it will be handled before
|
||||
* resuming I2C.
|
||||
*
|
||||
* When device is woken up from suspend (e.g. by ADC change),
|
||||
* an interrupt occurs before resuming I2C bus controller.
|
||||
* Interrupt handler tries to read registers but this read
|
||||
* will fail because I2C is still suspended.
|
||||
*/
|
||||
disable_irq(max14577->irq);
|
||||
}
|
||||
/*
|
||||
* MUIC IRQ must be disabled during suspend because if it happens
|
||||
* while suspended it will be handled before resuming I2C.
|
||||
*
|
||||
* When device is woken up from suspend (e.g. by ADC change),
|
||||
* an interrupt occurs before resuming I2C bus controller.
|
||||
* Interrupt handler tries to read registers but this read
|
||||
* will fail because I2C is still suspended.
|
||||
*/
|
||||
disable_irq(max14577->irq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -437,10 +435,9 @@ static int max14577_resume(struct device *dev)
|
||||
struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
|
||||
struct max14577 *max14577 = i2c_get_clientdata(i2c);
|
||||
|
||||
if (device_may_wakeup(dev)) {
|
||||
if (device_may_wakeup(dev))
|
||||
disable_irq_wake(max14577->irq);
|
||||
enable_irq(max14577->irq);
|
||||
}
|
||||
enable_irq(max14577->irq);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user