diff options
author | Jett.Zhou <jtzhou@marvell.com> | 2012-02-27 09:44:20 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-03-06 12:46:49 -0500 |
commit | 2853378b6eafd8b9e2f0e39ab599c93ce518b04d (patch) | |
tree | 2e92700fe3714e3b919cbd920709fcbc4fb8aed8 /drivers/rtc/rtc-88pm860x.c | |
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/rtc/rtc-88pm860x.c')
-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) | |||
376 | INIT_DELAYED_WORK(&info->calib_work, calibrate_vrtc_work); | 376 | INIT_DELAYED_WORK(&info->calib_work, calibrate_vrtc_work); |
377 | schedule_delayed_work(&info->calib_work, VRTC_CALIB_INTERVAL); | 377 | schedule_delayed_work(&info->calib_work, VRTC_CALIB_INTERVAL); |
378 | #endif /* VRTC_CALIBRATION */ | 378 | #endif /* VRTC_CALIBRATION */ |
379 | |||
380 | device_init_wakeup(&pdev->dev, 1); | ||
381 | |||
379 | return 0; | 382 | return 0; |
380 | out_rtc: | 383 | out_rtc: |
381 | free_irq(info->irq, info); | 384 | free_irq(info->irq, info); |
@@ -401,10 +404,34 @@ static int __devexit pm860x_rtc_remove(struct platform_device *pdev) | |||
401 | return 0; | 404 | return 0; |
402 | } | 405 | } |
403 | 406 | ||
407 | #ifdef CONFIG_PM_SLEEP | ||
408 | static int pm860x_rtc_suspend(struct device *dev) | ||
409 | { | ||
410 | struct platform_device *pdev = to_platform_device(dev); | ||
411 | struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); | ||
412 | |||
413 | if (device_may_wakeup(dev)) | ||
414 | chip->wakeup_flag |= 1 << PM8607_IRQ_RTC; | ||
415 | return 0; | ||
416 | } | ||
417 | static int pm860x_rtc_resume(struct device *dev) | ||
418 | { | ||
419 | struct platform_device *pdev = to_platform_device(dev); | ||
420 | struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); | ||
421 | |||
422 | if (device_may_wakeup(dev)) | ||
423 | chip->wakeup_flag &= ~(1 << PM8607_IRQ_RTC); | ||
424 | return 0; | ||
425 | } | ||
426 | #endif | ||
427 | |||
428 | static SIMPLE_DEV_PM_OPS(pm860x_rtc_pm_ops, pm860x_rtc_suspend, pm860x_rtc_resume); | ||
429 | |||
404 | static struct platform_driver pm860x_rtc_driver = { | 430 | static struct platform_driver pm860x_rtc_driver = { |
405 | .driver = { | 431 | .driver = { |
406 | .name = "88pm860x-rtc", | 432 | .name = "88pm860x-rtc", |
407 | .owner = THIS_MODULE, | 433 | .owner = THIS_MODULE, |
434 | .pm = &pm860x_rtc_pm_ops, | ||
408 | }, | 435 | }, |
409 | .probe = pm860x_rtc_probe, | 436 | .probe = pm860x_rtc_probe, |
410 | .remove = __devexit_p(pm860x_rtc_remove), | 437 | .remove = __devexit_p(pm860x_rtc_remove), |