[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1334647824-1663-1-git-send-email-linus.walleij@stericsson.com>
Date: Tue, 17 Apr 2012 09:30:24 +0200
From: Linus Walleij <linus.walleij@...ricsson.com>
To: Samuel Ortiz <sameo@...ux.intel.com>,
<linux-kernel@...r.kernel.org>
Cc: Rabin Vincent <rabin.vincent@...ricsson.com>,
Linus Walleij <linus.walleij@...aro.org>
Subject: [PATCH 2/6] mfd/ab8500: handle the irq for suspend/resume
From: Rabin Vincent <rabin.vincent@...ricsson.com>
Ensure that the AB interrupt is only handled at a time when
all core drivers are resumed. Ensure that the AB interrupt
is marked as a wakeup interrupt.
Signed-off-by: Rabin Vincent <rabin.vincent@...ricsson.com>
Reviewed-by: Jonas Aberg <jonas.aberg@...ricsson.com>
Reviewed-by: Mattias Wallin <mattias.wallin@...ricsson.com>
Signed-off-by: Linus Walleij <linus.walleij@...aro.org>
---
drivers/mfd/ab8500-i2c.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/mfd/ab8500-i2c.c b/drivers/mfd/ab8500-i2c.c
index b83045f..89b31a3 100644
--- a/drivers/mfd/ab8500-i2c.c
+++ b/drivers/mfd/ab8500-i2c.c
@@ -101,10 +101,42 @@ static const struct platform_device_id ab8500_id[] = {
{ }
};
+#ifdef CONFIG_PM
+static int ab8500_i2c_suspend(struct device *dev)
+{
+ struct ab8500 *ab = dev_get_drvdata(dev);
+
+ disable_irq(ab->irq);
+ enable_irq_wake(ab->irq);
+
+ return 0;
+}
+
+static int ab8500_i2c_resume(struct device *dev)
+{
+ struct ab8500 *ab = dev_get_drvdata(dev);
+
+ disable_irq_wake(ab->irq);
+ enable_irq(ab->irq);
+
+ return 0;
+}
+
+static const struct dev_pm_ops ab8500_i2c_pm_ops = {
+ .suspend = ab8500_i2c_suspend,
+ .resume = ab8500_i2c_resume,
+};
+
+#define AB8500_I2C_PM_OPS (&ab8500_i2c_pm_ops)
+#else
+#define AB8500_I2C_PM_OPS NULL
+#endif
+
static struct platform_driver ab8500_i2c_driver = {
.driver = {
.name = "ab8500-i2c",
.owner = THIS_MODULE,
+ .pm = AB8500_I2C_PM_OPS,
},
.probe = ab8500_i2c_probe,
.remove = __devexit_p(ab8500_i2c_remove),
--
1.7.9.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists