From fc165319a5e77170991fbc9762bd534b0bbd09dd Mon Sep 17 00:00:00 2001 From: Kevin Liu Date: Wed, 4 Jan 2012 15:14:26 +0800 Subject: [PATCH] --- yaml --- r: 284595 b: refs/heads/master c: 74d836c4142e5d100f8d9a1b2ee3003c2ed7109d h: refs/heads/master i: 284593: cd9282eeb45a922eda6fa554d303896d4cb209b2 284591: d640d6a8a1464c0f9ff5614e7daa457b354e1cc9 v: v3 --- [refs] | 2 +- trunk/drivers/rtc/rtc-max8925.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 20b730ed7643..30a082218378 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ba74e80ebaf8209cb553eb2195b26302270cfa42 +refs/heads/master: 74d836c4142e5d100f8d9a1b2ee3003c2ed7109d diff --git a/trunk/drivers/rtc/rtc-max8925.c b/trunk/drivers/rtc/rtc-max8925.c index 3bc046f427e0..b281baead658 100644 --- a/trunk/drivers/rtc/rtc-max8925.c +++ b/trunk/drivers/rtc/rtc-max8925.c @@ -261,6 +261,8 @@ static int __devinit max8925_rtc_probe(struct platform_device *pdev) /* XXX - isn't this redundant? */ platform_set_drvdata(pdev, info); + device_init_wakeup(&pdev->dev, 1); + info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev, &max8925_rtc_ops, THIS_MODULE); ret = PTR_ERR(info->rtc_dev); @@ -290,10 +292,34 @@ static int __devexit max8925_rtc_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int max8925_rtc_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); + + if (device_may_wakeup(dev)) + chip->wakeup_flag |= 1 << MAX8925_IRQ_RTC_ALARM0; + return 0; +} +static int max8925_rtc_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); + + if (device_may_wakeup(dev)) + chip->wakeup_flag &= ~(1 << MAX8925_IRQ_RTC_ALARM0); + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(max8925_rtc_pm_ops, max8925_rtc_suspend, max8925_rtc_resume); + static struct platform_driver max8925_rtc_driver = { .driver = { .name = "max8925-rtc", .owner = THIS_MODULE, + .pm = &max8925_rtc_pm_ops, }, .probe = max8925_rtc_probe, .remove = __devexit_p(max8925_rtc_remove),