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/rtc | |
parent | mfd: Make twl6030_irq_set_wake static (diff) | |
download | linux-2853378b6eafd8b9e2f0e39ab599c93ce518b04d.tar.xz linux-2853378b6eafd8b9e2f0e39ab599c93ce518b04d.zip |
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/rtc')
-rw-r--r-- | drivers/rtc/rtc-88pm860x.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c index f04761e6622d..afee0e8ae714 100644 --- a/drivers/rtc/rtc-88pm860x.c +++ b/drivers/rtc/rtc-88pm860x.c @@ -376,6 +376,9 @@ static int __devinit pm860x_rtc_probe(struct platform_device *pdev) INIT_DELAYED_WORK(&info->calib_work, calibrate_vrtc_work); schedule_delayed_work(&info->calib_work, VRTC_CALIB_INTERVAL); #endif /* VRTC_CALIBRATION */ + + device_init_wakeup(&pdev->dev, 1); + return 0; out_rtc: free_irq(info->irq, info); @@ -401,10 +404,34 @@ static int __devexit pm860x_rtc_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int pm860x_rtc_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); + + if (device_may_wakeup(dev)) + chip->wakeup_flag |= 1 << PM8607_IRQ_RTC; + return 0; +} +static int pm860x_rtc_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); + + if (device_may_wakeup(dev)) + chip->wakeup_flag &= ~(1 << PM8607_IRQ_RTC); + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(pm860x_rtc_pm_ops, pm860x_rtc_suspend, pm860x_rtc_resume); + static struct platform_driver pm860x_rtc_driver = { .driver = { .name = "88pm860x-rtc", .owner = THIS_MODULE, + .pm = &pm860x_rtc_pm_ops, }, .probe = pm860x_rtc_probe, .remove = __devexit_p(pm860x_rtc_remove), |