]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mfd: arizona: Disable interrupts during resume
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 27 Jan 2013 04:07:32 +0000 (12:07 +0800)
committerSamuel Ortiz <sameo@linux.intel.com>
Wed, 13 Feb 2013 23:22:47 +0000 (00:22 +0100)
Runtime power management does not function during system suspend but the
Arizona devices need to use runtime power management to power up the device
in order to handle interrupts. Try to avoid interrupts firing during
resume by disabling the primary IRQ before interrupts are reenabled on
resume and only reenabling it again during main resume.

The goal is to avoid issues in the situation where an interrupt is asserted
during resume (eg, due to it being the wake source) and the interrupt
handling gets scheduled prior to the device being able to handle runtime
PM.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/arizona-core.c

index 1ab02a7d2b05e82292cd3f6eba67ee29198ed55e..9c994b69b063bfe90f635098671c2ce5781f0c1b 100644 (file)
@@ -263,10 +263,36 @@ static int arizona_runtime_suspend(struct device *dev)
 }
 #endif
 
+#ifdef CONFIG_PM_SLEEP
+static int arizona_resume_noirq(struct device *dev)
+{
+       struct arizona *arizona = dev_get_drvdata(dev);
+
+       dev_dbg(arizona->dev, "Early resume, disabling IRQ\n");
+       disable_irq(arizona->irq);
+
+       return 0;
+}
+
+static int arizona_resume(struct device *dev)
+{
+       struct arizona *arizona = dev_get_drvdata(dev);
+
+       dev_dbg(arizona->dev, "Late resume, reenabling IRQ\n");
+       enable_irq(arizona->irq);
+
+       return 0;
+}
+#endif
+
 const struct dev_pm_ops arizona_pm_ops = {
        SET_RUNTIME_PM_OPS(arizona_runtime_suspend,
                           arizona_runtime_resume,
                           NULL)
+       SET_SYSTEM_SLEEP_PM_OPS(NULL, arizona_resume)
+#ifdef CONFIG_PM_SLEEP
+       .resume_noirq = arizona_resume_noirq,
+#endif
 };
 EXPORT_SYMBOL_GPL(arizona_pm_ops);