aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>2014-04-22 10:00:25 -0400
committerLee Jones <lee.jones@linaro.org>2014-06-03 03:11:22 -0400
commit360d15d6ef6f6e69baac6672147f16e2ac8b4c81 (patch)
tree9d52ca7b76d50060f2d5cace444e81f715da2a61 /drivers/mfd
parent9549b5ff001a8904372370d10be9a2f05e10eca5 (diff)
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>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/sec-core.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c
index 09fd256abcf6..01beae8af255 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-core.c
@@ -374,19 +374,18 @@ static int sec_pmic_suspend(struct device *dev)
374 struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); 374 struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
375 struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c); 375 struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c);
376 376
377 if (device_may_wakeup(dev)) { 377 if (device_may_wakeup(dev))
378 enable_irq_wake(sec_pmic->irq); 378 enable_irq_wake(sec_pmic->irq);
379 /* 379 /*
380 * PMIC IRQ must be disabled during suspend for RTC alarm 380 * PMIC IRQ must be disabled during suspend for RTC alarm
381 * to work properly. 381 * to work properly.
382 * When device is woken up from suspend by RTC Alarm, an 382 * When device is woken up from suspend, an
383 * interrupt occurs before resuming I2C bus controller. 383 * interrupt occurs before resuming I2C bus controller.
384 * The interrupt is handled by regmap_irq_thread which tries 384 * The interrupt is handled by regmap_irq_thread which tries
385 * to read RTC registers. This read fails (I2C is still 385 * to read RTC registers. This read fails (I2C is still
386 * suspended) and RTC Alarm interrupt is disabled. 386 * suspended) and RTC Alarm interrupt is disabled.
387 */ 387 */
388 disable_irq(sec_pmic->irq); 388 disable_irq(sec_pmic->irq);
389 }
390 389
391 return 0; 390 return 0;
392} 391}
@@ -396,10 +395,9 @@ static int sec_pmic_resume(struct device *dev)
396 struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); 395 struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
397 struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c); 396 struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c);
398 397
399 if (device_may_wakeup(dev)) { 398 if (device_may_wakeup(dev))
400 disable_irq_wake(sec_pmic->irq); 399 disable_irq_wake(sec_pmic->irq);
401 enable_irq(sec_pmic->irq); 400 enable_irq(sec_pmic->irq);
402 }
403 401
404 return 0; 402 return 0;
405} 403}