Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 273379
b: refs/heads/master
c: 01fdaab
h: refs/heads/master
i:
  273377: 8a27f91
  273375: 3f12b1e
v: v3
  • Loading branch information
MyungJoo Ham authored and Samuel Ortiz committed Oct 24, 2011
1 parent 27c0114 commit b38c459
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5f40c6b6508b622ea03c6b32c57b2e26eba2e4f1
refs/heads/master: 01fdaab8ffced1deeee14d9c7d2745f37349484e
27 changes: 26 additions & 1 deletion trunk/drivers/mfd/max8997.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <linux/slab.h>
#include <linux/i2c.h>
#include <linux/interrupt.h>
#include <linux/pm_runtime.h>
#include <linux/mutex.h>
#include <linux/mfd/core.h>
Expand Down Expand Up @@ -142,7 +143,6 @@ static int max8997_i2c_probe(struct i2c_client *i2c,

max8997->irq_base = pdata->irq_base;
max8997->ono = pdata->ono;
max8997->wakeup = pdata->wakeup;

mutex_init(&max8997->iolock);

Expand All @@ -169,6 +169,9 @@ static int max8997_i2c_probe(struct i2c_client *i2c,
if (ret < 0)
goto err_mfd;

/* MAX8997 has a power button input. */
device_init_wakeup(max8997->dev, pdata->wakeup);

return ret;

err_mfd:
Expand Down Expand Up @@ -398,7 +401,29 @@ static int max8997_restore(struct device *dev)
return 0;
}

static int max8997_suspend(struct device *dev)
{
struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
struct max8997_dev *max8997 = i2c_get_clientdata(i2c);

if (device_may_wakeup(dev))
irq_set_irq_wake(max8997->irq, 1);
return 0;
}

static int max8997_resume(struct device *dev)
{
struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
struct max8997_dev *max8997 = i2c_get_clientdata(i2c);

if (device_may_wakeup(dev))
irq_set_irq_wake(max8997->irq, 0);
return max8997_irq_resume(max8997);
}

const struct dev_pm_ops max8997_pm = {
.suspend = max8997_suspend,
.resume = max8997_resume,
.freeze = max8997_freeze,
.restore = max8997_restore,
};
Expand Down
1 change: 0 additions & 1 deletion trunk/include/linux/mfd/max8997-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ struct max8997_dev {
int irq;
int ono;
int irq_base;
bool wakeup;
struct mutex irqlock;
int irq_masks_cur[MAX8997_IRQ_GROUP_NR];
int irq_masks_cache[MAX8997_IRQ_GROUP_NR];
Expand Down

0 comments on commit b38c459

Please sign in to comment.