diff options
author | Krzysztof Kozlowski <k.kozlowski@samsung.com> | 2014-04-22 09:59:22 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-06-03 03:11:23 -0400 |
commit | c4f725b52cde3b82d66d54201bc97fcd539bffc8 (patch) | |
tree | ac285f6939b434671840e05da44d5ce3a76f521b /drivers/mfd | |
parent | 360d15d6ef6f6e69baac6672147f16e2ac8b4c81 (diff) |
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>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/max14577.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c index 484d372a4892..caaf50c1bd60 100644 --- a/drivers/mfd/max14577.c +++ b/drivers/mfd/max14577.c | |||
@@ -414,20 +414,18 @@ static int max14577_suspend(struct device *dev) | |||
414 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); | 414 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); |
415 | struct max14577 *max14577 = i2c_get_clientdata(i2c); | 415 | struct max14577 *max14577 = i2c_get_clientdata(i2c); |
416 | 416 | ||
417 | if (device_may_wakeup(dev)) { | 417 | if (device_may_wakeup(dev)) |
418 | enable_irq_wake(max14577->irq); | 418 | enable_irq_wake(max14577->irq); |
419 | /* | 419 | /* |
420 | * MUIC IRQ must be disabled during suspend if this is | 420 | * MUIC IRQ must be disabled during suspend because if it happens |
421 | * a wake up source because it will be handled before | 421 | * while suspended it will be handled before resuming I2C. |
422 | * resuming I2C. | 422 | * |
423 | * | 423 | * When device is woken up from suspend (e.g. by ADC change), |
424 | * When device is woken up from suspend (e.g. by ADC change), | 424 | * an interrupt occurs before resuming I2C bus controller. |
425 | * an interrupt occurs before resuming I2C bus controller. | 425 | * Interrupt handler tries to read registers but this read |
426 | * Interrupt handler tries to read registers but this read | 426 | * will fail because I2C is still suspended. |
427 | * will fail because I2C is still suspended. | 427 | */ |
428 | */ | 428 | disable_irq(max14577->irq); |
429 | disable_irq(max14577->irq); | ||
430 | } | ||
431 | 429 | ||
432 | return 0; | 430 | return 0; |
433 | } | 431 | } |
@@ -437,10 +435,9 @@ static int max14577_resume(struct device *dev) | |||
437 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); | 435 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); |
438 | struct max14577 *max14577 = i2c_get_clientdata(i2c); | 436 | struct max14577 *max14577 = i2c_get_clientdata(i2c); |
439 | 437 | ||
440 | if (device_may_wakeup(dev)) { | 438 | if (device_may_wakeup(dev)) |
441 | disable_irq_wake(max14577->irq); | 439 | disable_irq_wake(max14577->irq); |
442 | enable_irq(max14577->irq); | 440 | enable_irq(max14577->irq); |
443 | } | ||
444 | 441 | ||
445 | return 0; | 442 | return 0; |
446 | } | 443 | } |