diff options
author | Kevin Liu <kliu5@marvell.com> | 2012-01-04 02:14:26 -0500 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-01-08 19:30:12 -0500 |
commit | 74d836c4142e5d100f8d9a1b2ee3003c2ed7109d (patch) | |
tree | 29daf16ef1c8b8a0b741bd41b590351b142a4fd1 /drivers/rtc | |
parent | ba74e80ebaf8209cb553eb2195b26302270cfa42 (diff) |
rtc: max8925: Add function to work as wakeup source
Signed-off-by: Kevin Liu <kliu5@marvell.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-max8925.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-max8925.c b/drivers/rtc/rtc-max8925.c index 3bc046f427e0..b281baead658 100644 --- a/drivers/rtc/rtc-max8925.c +++ b/drivers/rtc/rtc-max8925.c | |||
@@ -261,6 +261,8 @@ static int __devinit max8925_rtc_probe(struct platform_device *pdev) | |||
261 | /* XXX - isn't this redundant? */ | 261 | /* XXX - isn't this redundant? */ |
262 | platform_set_drvdata(pdev, info); | 262 | platform_set_drvdata(pdev, info); |
263 | 263 | ||
264 | device_init_wakeup(&pdev->dev, 1); | ||
265 | |||
264 | info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev, | 266 | info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev, |
265 | &max8925_rtc_ops, THIS_MODULE); | 267 | &max8925_rtc_ops, THIS_MODULE); |
266 | ret = PTR_ERR(info->rtc_dev); | 268 | ret = PTR_ERR(info->rtc_dev); |
@@ -290,10 +292,34 @@ static int __devexit max8925_rtc_remove(struct platform_device *pdev) | |||
290 | return 0; | 292 | return 0; |
291 | } | 293 | } |
292 | 294 | ||
295 | #ifdef CONFIG_PM_SLEEP | ||
296 | static int max8925_rtc_suspend(struct device *dev) | ||
297 | { | ||
298 | struct platform_device *pdev = to_platform_device(dev); | ||
299 | struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); | ||
300 | |||
301 | if (device_may_wakeup(dev)) | ||
302 | chip->wakeup_flag |= 1 << MAX8925_IRQ_RTC_ALARM0; | ||
303 | return 0; | ||
304 | } | ||
305 | static int max8925_rtc_resume(struct device *dev) | ||
306 | { | ||
307 | struct platform_device *pdev = to_platform_device(dev); | ||
308 | struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); | ||
309 | |||
310 | if (device_may_wakeup(dev)) | ||
311 | chip->wakeup_flag &= ~(1 << MAX8925_IRQ_RTC_ALARM0); | ||
312 | return 0; | ||
313 | } | ||
314 | #endif | ||
315 | |||
316 | static SIMPLE_DEV_PM_OPS(max8925_rtc_pm_ops, max8925_rtc_suspend, max8925_rtc_resume); | ||
317 | |||
293 | static struct platform_driver max8925_rtc_driver = { | 318 | static struct platform_driver max8925_rtc_driver = { |
294 | .driver = { | 319 | .driver = { |
295 | .name = "max8925-rtc", | 320 | .name = "max8925-rtc", |
296 | .owner = THIS_MODULE, | 321 | .owner = THIS_MODULE, |
322 | .pm = &max8925_rtc_pm_ops, | ||
297 | }, | 323 | }, |
298 | .probe = max8925_rtc_probe, | 324 | .probe = max8925_rtc_probe, |
299 | .remove = __devexit_p(max8925_rtc_remove), | 325 | .remove = __devexit_p(max8925_rtc_remove), |