diff options
author | Venu Byravarasu <vbyravarasu@nvidia.com> | 2012-05-16 15:45:45 +0530 |
---|---|---|
committer | Varun Wadekar <vwadekar@nvidia.com> | 2012-05-30 13:04:30 +0530 |
commit | 80c088ce821d680e0f868c3a0c9e415a7ac7382d (patch) | |
tree | e0281c0eafb018f181ead72c85ebe69c61d38d66 /drivers/rtc | |
parent | d46bb3aa2dc3ae89e5a3d40a39e26aba9ebe34fc (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/rtc')
-rw-r--r-- | drivers/rtc/rtc-tps6591x.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/rtc/rtc-tps6591x.c b/drivers/rtc/rtc-tps6591x.c index e38d469639d1..037e456d7437 100644 --- a/drivers/rtc/rtc-tps6591x.c +++ b/drivers/rtc/rtc-tps6591x.c @@ -163,7 +163,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); @@ -251,7 +251,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); @@ -346,7 +346,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) @@ -370,7 +370,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); |