1
0
Fork 0

rtc: max77686: Do not allow interrupt to fire before system resume

The rtc-max77686 device shares the main interrupt line with parent MFD
device (max77686 driver).  During the system suspend, the parent MFD
device disables this IRQ to prevent an early event happening before
resuming I2C bus controller.

The same should be done by rtc-max77686 driver because otherwise the
interrupt handler max77686_rtc_alarm_irq() will be called before its
resume function (max77686_rtc_resume()).  Such issue is not fatal but
disabling shared IRQ by all users ensures correct behavior.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20200615161455.4420-1-krzk@kernel.org
zero-sugar-mainline-defconfig
Krzysztof Kozlowski 2020-06-15 18:14:55 +02:00 committed by Alexandre Belloni
parent 05513a706b
commit d8f090dbea
1 changed files with 18 additions and 2 deletions

View File

@ -805,17 +805,33 @@ static int max77686_rtc_remove(struct platform_device *pdev)
#ifdef CONFIG_PM_SLEEP
static int max77686_rtc_suspend(struct device *dev)
{
struct max77686_rtc_info *info = dev_get_drvdata(dev);
int ret = 0;
if (device_may_wakeup(dev)) {
struct max77686_rtc_info *info = dev_get_drvdata(dev);
return enable_irq_wake(info->virq);
ret = enable_irq_wake(info->virq);
}
return 0;
/*
* Main IRQ (not virtual) must be disabled during suspend because if it
* happens while suspended it will be handled before resuming I2C.
*
* Since Main IRQ is shared, all its users should disable it to be sure
* it won't fire while one of them is still suspended.
*/
disable_irq(info->rtc_irq);
return ret;
}
static int max77686_rtc_resume(struct device *dev)
{
struct max77686_rtc_info *info = dev_get_drvdata(dev);
enable_irq(info->rtc_irq);
if (device_may_wakeup(dev)) {
struct max77686_rtc_info *info = dev_get_drvdata(dev);