diff options
author | Varun Wadekar <vwadekar@nvidia.com> | 2011-02-07 19:59:33 +0530 |
---|---|---|
committer | Niket Sirsi <nsirsi@nvidia.com> | 2011-02-07 18:15:29 -0800 |
commit | 1dea1254172ba7d8db550fbee5f525b363cbedab (patch) | |
tree | b0572a43e4b5c6fe07b6fe89870f3ff0e233d7b2 /drivers | |
parent | 9e790983fff1c7978a850db09bdb21b82a950d0e (diff) |
rtc: tps6586x: enable irqs while settings alarms
Bug 770380
Change-Id: I8950a3ef2259b233b1711b266fa7d29270d95bfd
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/18565
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/rtc/rtc-tps6586x.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-tps6586x.c b/drivers/rtc/rtc-tps6586x.c index 2ff339a21a5c..b0625a6215c1 100644 --- a/drivers/rtc/rtc-tps6586x.c +++ b/drivers/rtc/rtc-tps6586x.c @@ -39,6 +39,7 @@ struct tps6586x_rtc { unsigned long epoch_start; int irq; struct rtc_device *rtc; + bool irq_en; }; static inline struct device *to_tps6586x_dev(struct device *dev) @@ -139,6 +140,14 @@ static int tps6586x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm) return -EINVAL; } + if (alrm->enabled && !rtc->irq_en) { + enable_irq(rtc->irq); + rtc->irq_en = true; + } else if (!alrm->enabled && rtc->irq_en) { + disable_irq(rtc->irq); + rtc->irq_en = false; + } + seconds -= rtc->epoch_start; ticks = (unsigned long long)seconds << 10; @@ -202,14 +211,18 @@ static int tps6586x_rtc_alarm_irq_enable(struct device *dev, dev_err(dev, "failed to set RTC_ENABLE\n"); return err; } - enable_irq(rtc->irq); + + if (!rtc->irq_en) + enable_irq(rtc->irq); } else { err = tps6586x_clr_bits(tps_dev, RTC_CTRL, RTC_ENABLE); if (err < 0) { dev_err(dev, "failed to clear RTC_ENABLE\n"); return err; } - disable_irq(rtc->irq); + + if (rtc->irq_en) + disable_irq(rtc->irq); } return 0; @@ -286,8 +299,8 @@ static int __devinit tps6586x_rtc_probe(struct platform_device *pdev) rtc->irq = -1; } else { device_init_wakeup(&pdev->dev, 1); - disable_irq(rtc->irq); enable_irq_wake(rtc->irq); + disable_irq(rtc->irq); } } |