summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-mc13892.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-mc13892.c')
-rw-r--r--drivers/rtc/rtc-mc13892.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-mc13892.c b/drivers/rtc/rtc-mc13892.c
index 3b7e3af4e54c..213aba5c8d85 100644
--- a/drivers/rtc/rtc-mc13892.c
+++ b/drivers/rtc/rtc-mc13892.c
@@ -18,6 +18,8 @@
#include <linux/pmic_status.h>
#include <linux/pmic_external.h>
+#include <linux/irq.h>
+
#define RTC_TIME_LSH 0
#define RTC_DAY_LSH 0
#define RTCALARM_TIME_LSH 0
@@ -232,8 +234,22 @@ static int __exit mxc_rtc_remove(struct platform_device *pdev)
static int mxc_rtc_suspend(struct platform_device *pdev, pm_message_t state)
{
- if (device_may_wakeup(&pdev->dev))
- enable_irq_wake(platform_get_irq(pdev, 0));
+ int irq;
+ struct irq_desc *desc;
+
+ if(!pdev)
+ return -1;
+
+ irq = platform_get_irq(pdev, 0);
+
+ if (device_may_wakeup(&pdev->dev)) {
+ enable_irq_wake(irq);
+ }
+ else {
+ desc = irq_to_desc(irq);
+ if(desc->status & IRQ_WAKEUP)
+ disable_irq_wake(irq);
+ }
return 0;
}