diff options
Diffstat (limited to 'drivers/mfd/max8997.c')
-rw-r--r-- | drivers/mfd/max8997.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c index f83103b8970..5be53ae9b61 100644 --- a/drivers/mfd/max8997.c +++ b/drivers/mfd/max8997.c | |||
@@ -23,7 +23,9 @@ | |||
23 | 23 | ||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
26 | #include <linux/interrupt.h> | ||
26 | #include <linux/pm_runtime.h> | 27 | #include <linux/pm_runtime.h> |
28 | #include <linux/module.h> | ||
27 | #include <linux/mutex.h> | 29 | #include <linux/mutex.h> |
28 | #include <linux/mfd/core.h> | 30 | #include <linux/mfd/core.h> |
29 | #include <linux/mfd/max8997.h> | 31 | #include <linux/mfd/max8997.h> |
@@ -142,7 +144,6 @@ static int max8997_i2c_probe(struct i2c_client *i2c, | |||
142 | 144 | ||
143 | max8997->irq_base = pdata->irq_base; | 145 | max8997->irq_base = pdata->irq_base; |
144 | max8997->ono = pdata->ono; | 146 | max8997->ono = pdata->ono; |
145 | max8997->wakeup = pdata->wakeup; | ||
146 | 147 | ||
147 | mutex_init(&max8997->iolock); | 148 | mutex_init(&max8997->iolock); |
148 | 149 | ||
@@ -169,6 +170,9 @@ static int max8997_i2c_probe(struct i2c_client *i2c, | |||
169 | if (ret < 0) | 170 | if (ret < 0) |
170 | goto err_mfd; | 171 | goto err_mfd; |
171 | 172 | ||
173 | /* MAX8997 has a power button input. */ | ||
174 | device_init_wakeup(max8997->dev, pdata->wakeup); | ||
175 | |||
172 | return ret; | 176 | return ret; |
173 | 177 | ||
174 | err_mfd: | 178 | err_mfd: |
@@ -398,7 +402,29 @@ static int max8997_restore(struct device *dev) | |||
398 | return 0; | 402 | return 0; |
399 | } | 403 | } |
400 | 404 | ||
405 | static int max8997_suspend(struct device *dev) | ||
406 | { | ||
407 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); | ||
408 | struct max8997_dev *max8997 = i2c_get_clientdata(i2c); | ||
409 | |||
410 | if (device_may_wakeup(dev)) | ||
411 | irq_set_irq_wake(max8997->irq, 1); | ||
412 | return 0; | ||
413 | } | ||
414 | |||
415 | static int max8997_resume(struct device *dev) | ||
416 | { | ||
417 | struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); | ||
418 | struct max8997_dev *max8997 = i2c_get_clientdata(i2c); | ||
419 | |||
420 | if (device_may_wakeup(dev)) | ||
421 | irq_set_irq_wake(max8997->irq, 0); | ||
422 | return max8997_irq_resume(max8997); | ||
423 | } | ||
424 | |||
401 | const struct dev_pm_ops max8997_pm = { | 425 | const struct dev_pm_ops max8997_pm = { |
426 | .suspend = max8997_suspend, | ||
427 | .resume = max8997_resume, | ||
402 | .freeze = max8997_freeze, | 428 | .freeze = max8997_freeze, |
403 | .restore = max8997_restore, | 429 | .restore = max8997_restore, |
404 | }; | 430 | }; |