summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorVenu Byravarasu <vbyravarasu@nvidia.com>2012-05-16 15:45:45 +0530
committerRohan Somvanshi <rsomvanshi@nvidia.com>2012-05-22 23:52:12 -0700
commit3910362a2873687a41a9dd4c186e28b1451db7d0 (patch)
tree597627be42cc3160eb10409c26a3e72ce06877d5 /drivers
parent861e4862835fc8ee069de7b3bbc2736d0a618eae (diff)
rtc: tps6591x: Limiting years in the 0 - 99 range
As RTC can store year in the 0 - 99 range only, handling it accordingly bug 985890 Change-Id: Idcfb29028f482283ae2658579a3283c7d4f230f1 Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com> Reviewed-on: http://git-master/r/102798 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/rtc/rtc-tps6591x.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/rtc/rtc-tps6591x.c b/drivers/rtc/rtc-tps6591x.c
index 6223f1108f06..ebc46b4cf46e 100644
--- a/drivers/rtc/rtc-tps6591x.c
+++ b/drivers/rtc/rtc-tps6591x.c
@@ -162,7 +162,7 @@ static int tps6591x_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_hour = buff[2];
tm->tm_mday = buff[3];
tm->tm_mon = buff[4] - 1;
- tm->tm_year = buff[5];
+ tm->tm_year = buff[5] + RTC_YEAR_OFFSET;
tm->tm_wday = buff[6];
print_time(dev, tm);
return tps6591x_rtc_valid_tm(tm);
@@ -250,7 +250,7 @@ static int tps6591x_rtc_set_time(struct device *dev, struct rtc_time *tm)
buff[2] = tm->tm_hour;
buff[3] = tm->tm_mday;
buff[4] = tm->tm_mon + 1;
- buff[5] = tm->tm_year;
+ buff[5] = tm->tm_year % RTC_YEAR_OFFSET;
buff[6] = tm->tm_wday;
print_time(dev, tm);
@@ -345,7 +345,7 @@ static int tps6591x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
buff[2] = alrm->time.tm_hour;
buff[3] = alrm->time.tm_mday;
buff[4] = alrm->time.tm_mon + 1;
- buff[5] = alrm->time.tm_year;
+ buff[5] = alrm->time.tm_year % RTC_YEAR_OFFSET;
convert_decimal_to_bcd(buff, sizeof(buff));
err = tps6591x_write_regs(dev, RTC_ALARM, sizeof(buff), buff);
if (err)
@@ -369,7 +369,7 @@ static int tps6591x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
alrm->time.tm_hour = buff[2];
alrm->time.tm_mday = buff[3];
alrm->time.tm_mon = buff[4] - 1;
- alrm->time.tm_year = buff[5];
+ alrm->time.tm_year = buff[5] + RTC_YEAR_OFFSET;
dev_info(dev->parent, "\n getting alarm time::\n");
print_time(dev, &alrm->time);