summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorVenu Byravarasu <vbyravarasu@nvidia.com>2012-02-15 13:09:02 +0530
committerRohan Somvanshi <rsomvanshi@nvidia.com>2012-03-30 09:12:04 -0700
commit536e91c520ea1c80209987d70bc29857f878cbeb (patch)
treedb08d536925db43c51bc4a457e56a241f6231da1 /drivers/rtc
parent1a1b1468b9ef4c33c7408b0c67bb9f751d485dec (diff)
rtc: tps80031: Enable RTC interrupt appropriately
Observed interrupt not getting enabled properly. hence fixing it. bug 937221 Change-Id: If852c9cd40fc98711fe12a124b533ee8ee99eb3c Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com> Reviewed-on: http://git-master/r/83992 Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com> Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-tps80031.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/rtc/rtc-tps80031.c b/drivers/rtc/rtc-tps80031.c
index 40e5b7c52129..70d6734a5708 100644
--- a/drivers/rtc/rtc-tps80031.c
+++ b/drivers/rtc/rtc-tps80031.c
@@ -64,7 +64,7 @@ struct tps80031_rtc {
unsigned long epoch_start;
int irq;
struct rtc_device *rtc;
- bool irq_en;
+ u8 alarm_irq_enabled;
};
static int tps80031_read_regs(struct device *dev, int reg, int len,
@@ -214,11 +214,6 @@ static int tps80031_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
return -EINVAL;
}
- if (alrm->enabled && !rtc->irq_en)
- rtc->irq_en = true;
- else if (!alrm->enabled && rtc->irq_en)
- rtc->irq_en = false;
-
buff[0] = alrm->time.tm_sec;
buff[1] = alrm->time.tm_min;
buff[2] = alrm->time.tm_hour;
@@ -264,24 +259,24 @@ static int tps80031_rtc_alarm_irq_enable(struct device *dev,
return -EIO;
if (enable) {
- if (rtc->irq_en == true)
+ if (rtc->alarm_irq_enabled)
return 0;
err = tps80031_set_bits(p, 1, RTC_INT, ENABLE_ALARM_INT);
if (err < 0) {
dev_err(p, "failed to set ALRM int. err: %d\n", err);
return err;
- }
- rtc->irq_en = true;
+ } else
+ rtc->alarm_irq_enabled = 1;
} else {
- if (rtc->irq_en == false)
+ if(!rtc->alarm_irq_enabled)
return 0;
err = tps80031_clr_bits(p, 1, RTC_INT, ENABLE_ALARM_INT);
if (err < 0) {
dev_err(p, "failed to clear ALRM int. err: %d\n", err);
return err;
- }
- rtc->irq_en = false;
+ } else
+ rtc->alarm_irq_enabled = 0;
}
return 0;
}
@@ -388,8 +383,10 @@ static int __devinit tps80031_rtc_probe(struct platform_device *pdev)
if (err) {
dev_err(&pdev->dev, "unable to program Interrupt Mask reg\n");
err = -EBUSY;
+ rtc->alarm_irq_enabled = 0;
goto fail;
- }
+ } else
+ rtc->alarm_irq_enabled = 1;
dev_set_drvdata(&pdev->dev, rtc);
if (pdata && (pdata->irq >= 0)) {