|
@@ -261,6 +261,8 @@ static int __devinit max8925_rtc_probe(struct platform_device *pdev)
|
|
/* XXX - isn't this redundant? */
|
|
/* XXX - isn't this redundant? */
|
|
platform_set_drvdata(pdev, info);
|
|
platform_set_drvdata(pdev, info);
|
|
|
|
|
|
|
|
+ device_init_wakeup(&pdev->dev, 1);
|
|
|
|
+
|
|
info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev,
|
|
info->rtc_dev = rtc_device_register("max8925-rtc", &pdev->dev,
|
|
&max8925_rtc_ops, THIS_MODULE);
|
|
&max8925_rtc_ops, THIS_MODULE);
|
|
ret = PTR_ERR(info->rtc_dev);
|
|
ret = PTR_ERR(info->rtc_dev);
|
|
@@ -290,10 +292,34 @@ static int __devexit max8925_rtc_remove(struct platform_device *pdev)
|
|
return 0;
|
|
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 = {
|
|
static struct platform_driver max8925_rtc_driver = {
|
|
.driver = {
|
|
.driver = {
|
|
.name = "max8925-rtc",
|
|
.name = "max8925-rtc",
|
|
.owner = THIS_MODULE,
|
|
.owner = THIS_MODULE,
|
|
|
|
+ .pm = &max8925_rtc_pm_ops,
|
|
},
|
|
},
|
|
.probe = max8925_rtc_probe,
|
|
.probe = max8925_rtc_probe,
|
|
.remove = __devexit_p(max8925_rtc_remove),
|
|
.remove = __devexit_p(max8925_rtc_remove),
|