aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Liu <kliu5@marvell.com>2012-01-04 02:14:24 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2012-01-08 19:03:34 -0500
commitba74e80ebaf8209cb553eb2195b26302270cfa42 (patch)
treee383e2ce63450326d135a84fe0826c720283675a
parent5214e5659a9760cd01aa14171c8fdf38d3deec3a (diff)
mfd: Add pm ops to max8925
Signed-off-by: Kevin Liu <kliu5@marvell.com> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/mfd/max8925-i2c.c27
-rw-r--r--include/linux/mfd/max8925.h2
2 files changed, 29 insertions, 0 deletions
diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
index 0219115e00c7..d9e4b36edee9 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,
161 chip->adc = i2c_new_dummy(chip->i2c->adapter, ADC_I2C_ADDR); 161 chip->adc = i2c_new_dummy(chip->i2c->adapter, ADC_I2C_ADDR);
162 i2c_set_clientdata(chip->adc, chip); 162 i2c_set_clientdata(chip->adc, chip);
163 163
164 device_init_wakeup(&client->dev, 1);
165
164 max8925_device_init(chip, pdata); 166 max8925_device_init(chip, pdata);
165 167
166 return 0; 168 return 0;
@@ -177,10 +179,35 @@ static int __devexit max8925_remove(struct i2c_client *client)
177 return 0; 179 return 0;
178} 180}
179 181
182#ifdef CONFIG_PM_SLEEP
183static int max8925_suspend(struct device *dev)
184{
185 struct i2c_client *client = container_of(dev, struct i2c_client, dev);
186 struct max8925_chip *chip = i2c_get_clientdata(client);
187
188 if (device_may_wakeup(dev) && chip->wakeup_flag)
189 enable_irq_wake(chip->core_irq);
190 return 0;
191}
192
193static int max8925_resume(struct device *dev)
194{
195 struct i2c_client *client = container_of(dev, struct i2c_client, dev);
196 struct max8925_chip *chip = i2c_get_clientdata(client);
197
198 if (device_may_wakeup(dev) && chip->wakeup_flag)
199 disable_irq_wake(chip->core_irq);
200 return 0;
201}
202#endif
203
204static SIMPLE_DEV_PM_OPS(max8925_pm_ops, max8925_suspend, max8925_resume);
205
180static struct i2c_driver max8925_driver = { 206static struct i2c_driver max8925_driver = {
181 .driver = { 207 .driver = {
182 .name = "max8925", 208 .name = "max8925",
183 .owner = THIS_MODULE, 209 .owner = THIS_MODULE,
210 .pm = &max8925_pm_ops,
184 }, 211 },
185 .probe = max8925_probe, 212 .probe = max8925_probe,
186 .remove = __devexit_p(max8925_remove), 213 .remove = __devexit_p(max8925_remove),
diff --git a/include/linux/mfd/max8925.h b/include/linux/mfd/max8925.h
index 5259dfe8c585..daaba00f0bc5 100644
--- a/include/linux/mfd/max8925.h
+++ b/include/linux/mfd/max8925.h
@@ -206,6 +206,8 @@ struct max8925_chip {
206 int irq_base; 206 int irq_base;
207 int core_irq; 207 int core_irq;
208 int tsc_irq; 208 int tsc_irq;
209
210 unsigned int wakeup_flag;
209}; 211};
210 212
211struct max8925_backlight_pdata { 213struct max8925_backlight_pdata {