diff options
author | Jett.Zhou <jtzhou@marvell.com> | 2012-02-27 15:44:20 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-03-06 18:46:49 +0100 |
commit | 2853378b6eafd8b9e2f0e39ab599c93ce518b04d (patch) | |
tree | 2e92700fe3714e3b919cbd920709fcbc4fb8aed8 /drivers/mfd | |
parent | b8b8d7932bb83300d0ae6553e320ab1aecb37990 (diff) |
mfd: Add ability to wake the system for 88pm860x
For 88pm860x pmic, it can wake the system from low power mode by irq,
its sub-devs like RTC and onkey can be enabled for this usage.
Signed-off-by: Jett.Zhou <jtzhou@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r-- | drivers/mfd/88pm860x-i2c.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/mfd/88pm860x-i2c.c b/drivers/mfd/88pm860x-i2c.c index f93dd9571c3..b2cfdc45856 100644 --- a/drivers/mfd/88pm860x-i2c.c +++ b/drivers/mfd/88pm860x-i2c.c @@ -334,10 +334,35 @@ static int __devexit pm860x_remove(struct i2c_client *client) return 0; } +#ifdef CONFIG_PM_SLEEP +static int pm860x_suspend(struct device *dev) +{ + struct i2c_client *client = container_of(dev, struct i2c_client, dev); + struct pm860x_chip *chip = i2c_get_clientdata(client); + + if (device_may_wakeup(dev) && chip->wakeup_flag) + enable_irq_wake(chip->core_irq); + return 0; +} + +static int pm860x_resume(struct device *dev) +{ + struct i2c_client *client = container_of(dev, struct i2c_client, dev); + struct pm860x_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(pm860x_pm_ops, pm860x_suspend, pm860x_resume); + static struct i2c_driver pm860x_driver = { .driver = { .name = "88PM860x", .owner = THIS_MODULE, + .pm = &pm860x_pm_ops, }, .probe = pm860x_probe, .remove = __devexit_p(pm860x_remove), |