summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorTom Cherry <tcherry@nvidia.com>2011-02-18 13:38:48 -0800
committerVarun Colbert <vcolbert@nvidia.com>2011-03-03 10:39:42 -0800
commit715a591214008391fe40fccca49ba133ac89dbf5 (patch)
treedab49b2588b097cf05b83357d9939e7a9d56666d /drivers/rtc
parent4c5b7132e5321f577041945c95990d52bacd3003 (diff)
max8907c rtc: support wake alarms
This change allows rtc alarms to wake the system. Change-Id: I2a7212fe7cc02b08893fe3a37824b0d39a9f5386 Reviewed-on: http://git-master/r/20101 Tested-by: Thomas Cherry <tcherry@nvidia.com> Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-max8907c.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-max8907c.c b/drivers/rtc/rtc-max8907c.c
index aa48f4bb2497..936f133f67c1 100644
--- a/drivers/rtc/rtc-max8907c.c
+++ b/drivers/rtc/rtc-max8907c.c
@@ -237,10 +237,14 @@ static int __devinit max8907c_rtc_probe(struct platform_device *pdev)
goto out_rtc;
}
+ max8907c_set_bits(chip->i2c_power, MAX8907C_REG_SYSENSEL, 0x2, 0x2);
+
dev_set_drvdata(&pdev->dev, info);
platform_set_drvdata(pdev, info);
+ device_init_wakeup(&pdev->dev, 1);
+
return 0;
out_rtc:
free_irq(chip->irq_base + MAX8907C_IRQ_RTC_ALARM0, info);
@@ -263,6 +267,28 @@ static int __devexit max8907c_rtc_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM
+static int max8907c_rtc_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ struct device *dev=&pdev->dev;
+ struct max8907c_rtc_info *info = platform_get_drvdata(pdev);
+
+ if (device_may_wakeup(dev))
+ enable_irq_wake(info->chip->irq_base + MAX8907C_IRQ_RTC_ALARM0);
+ return 0;
+}
+
+static int max8907c_rtc_resume(struct platform_device *pdev)
+{
+ struct device *dev=&pdev->dev;
+ struct max8907c_rtc_info *info = platform_get_drvdata(pdev);
+
+ if (device_may_wakeup(dev))
+ disable_irq_wake(info->chip->irq_base + MAX8907C_IRQ_RTC_ALARM0);
+ return 0;
+}
+#endif
+
static struct platform_driver max8907c_rtc_driver = {
.driver = {
.name = "max8907c-rtc",
@@ -270,6 +296,10 @@ static struct platform_driver max8907c_rtc_driver = {
},
.probe = max8907c_rtc_probe,
.remove = __devexit_p(max8907c_rtc_remove),
+#ifdef CONFIG_PM
+ .suspend = max8907c_rtc_suspend,
+ .resume = max8907c_rtc_resume,
+#endif
};
static int __init max8907c_rtc_init(void)