summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorVenu Byravarasu <vbyravarasu@nvidia.com>2012-02-08 10:57:15 +0530
committerSimone Willett <swillett@nvidia.com>2012-02-09 12:52:07 -0800
commit4c22dadf6e0fa5e48d799692497cba728208135a (patch)
treeb63a57e876b3712ed8daa4c7e7c0aac222a730c3 /drivers/rtc
parentce2f802c3e2ff8ce2f0408e911635ca7e6331cfe (diff)
rtc: tps6591x: Fixing month register program error
The month field of tm structure managed by kernel, expects a value between 0 to 11. However, TPS6591x RTC month register expects the month range to be between 1 to 12. Hence fixing it. Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com> Change-Id: I054de10dcd58497167c8460fe935325cee3c582f Reviewed-on: http://git-master/r/79930 Tested-by: Venu Byravarasu <vbyravarasu@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Diffstat (limited to 'drivers/rtc')
-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 878c2046aac7..cab3e8874dff 100644
--- a/drivers/rtc/rtc-tps6591x.c
+++ b/drivers/rtc/rtc-tps6591x.c
@@ -161,7 +161,7 @@ static int tps6591x_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_min = buff[1];
tm->tm_hour = buff[2];
tm->tm_mday = buff[3];
- tm->tm_mon = buff[4];
+ tm->tm_mon = buff[4] - 1;
tm->tm_year = buff[5];
tm->tm_wday = buff[6];
print_time(dev, tm);
@@ -249,7 +249,7 @@ static int tps6591x_rtc_set_time(struct device *dev, struct rtc_time *tm)
buff[1] = tm->tm_min;
buff[2] = tm->tm_hour;
buff[3] = tm->tm_mday;
- buff[4] = tm->tm_mon;
+ buff[4] = tm->tm_mon + 1;
buff[5] = tm->tm_year;
buff[6] = tm->tm_wday;
@@ -308,7 +308,7 @@ static int tps6591x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
buff[1] = alrm->time.tm_min;
buff[2] = alrm->time.tm_hour;
buff[3] = alrm->time.tm_mday;
- buff[4] = alrm->time.tm_mon;
+ buff[4] = alrm->time.tm_mon + 1;
buff[5] = alrm->time.tm_year;
convert_decimal_to_bcd(buff, sizeof(buff));
err = tps6591x_write_regs(dev, RTC_ALARM, sizeof(buff), buff);
@@ -332,7 +332,7 @@ static int tps6591x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
alrm->time.tm_min = buff[1];
alrm->time.tm_hour = buff[2];
alrm->time.tm_mday = buff[3];
- alrm->time.tm_mon = buff[4];
+ alrm->time.tm_mon = buff[4] - 1;
alrm->time.tm_year = buff[5];
dev_info(dev->parent, "\n getting alarm time::\n");