public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] mfd: max8925: add function to work as wakeup source
@ 2012-01-04  7:14 Haojian Zhuang
  2012-01-04  7:14 ` [PATCH 2/3] misc: max8925_onkey: " Haojian Zhuang
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Haojian Zhuang @ 2012-01-04  7:14 UTC (permalink / raw)
  To: sameo, a.zummo, dmitry.torokhov, linux-kernel; +Cc: Kevin Liu, Haojian Zhuang

From: Kevin Liu <kliu5@marvell.com>

Signed-off-by: Kevin Liu <kliu5@marvell.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
---
 drivers/mfd/max8925-i2c.c   |   27 +++++++++++++++++++++++++++
 include/linux/mfd/max8925.h |    2 ++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
index 0219115..d9e4b36 100644
--- a/drivers/mfd/max8925-i2c.c
+++ b/drivers/mfd/max8925-i2c.c
@@ -161,6 +161,8 @@ static int __devinit max8925_probe(struct i2c_client *client,
 	chip->adc = i2c_new_dummy(chip->i2c->adapter, ADC_I2C_ADDR);
 	i2c_set_clientdata(chip->adc, chip);
 
+	device_init_wakeup(&client->dev, 1);
+
 	max8925_device_init(chip, pdata);
 
 	return 0;
@@ -177,10 +179,35 @@ static int __devexit max8925_remove(struct i2c_client *client)
 	return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int max8925_suspend(struct device *dev)
+{
+	struct i2c_client *client = container_of(dev, struct i2c_client, dev);
+	struct max8925_chip *chip = i2c_get_clientdata(client);
+
+	if (device_may_wakeup(dev) && chip->wakeup_flag)
+		enable_irq_wake(chip->core_irq);
+	return 0;
+}
+
+static int max8925_resume(struct device *dev)
+{
+	struct i2c_client *client = container_of(dev, struct i2c_client, dev);
+	struct max8925_chip *chip = i2c_get_clientdata(client);
+
+	if (device_may_wakeup(dev) && chip->wakeup_flag)
+		disable_irq_wake(chip->core_irq);
+	return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(max8925_pm_ops, max8925_suspend, max8925_resume);
+
 static struct i2c_driver max8925_driver = {
 	.driver	= {
 		.name	= "max8925",
 		.owner	= THIS_MODULE,
+		.pm     = &max8925_pm_ops,
 	},
 	.probe		= max8925_probe,
 	.remove		= __devexit_p(max8925_remove),
diff --git a/include/linux/mfd/max8925.h b/include/linux/mfd/max8925.h
index 5259dfe..daaba00 100644
--- a/include/linux/mfd/max8925.h
+++ b/include/linux/mfd/max8925.h
@@ -206,6 +206,8 @@ struct max8925_chip {
 	int			irq_base;
 	int			core_irq;
 	int			tsc_irq;
+
+	unsigned int            wakeup_flag;
 };
 
 struct max8925_backlight_pdata {
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-03-06  8:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-04  7:14 [PATCH 1/3] mfd: max8925: add function to work as wakeup source Haojian Zhuang
2012-01-04  7:14 ` [PATCH 2/3] misc: max8925_onkey: " Haojian Zhuang
2012-01-09  0:29   ` Samuel Ortiz
2012-01-10 10:11     ` Haojian Zhuang
2012-01-10 10:24     ` Haojian Zhuang
2012-02-20 11:02       ` Samuel Ortiz
2012-03-06  6:09         ` Dmitry Torokhov
2012-01-04  7:14 ` [PATCH 3/3] rtc: max8925: " Haojian Zhuang
2012-01-09  0:05 ` [PATCH 1/3] mfd: " Samuel Ortiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox