summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorVenu Byravarasu <vbyravarasu@nvidia.com>2012-02-08 10:48:31 +0530
committerSimone Willett <swillett@nvidia.com>2012-02-09 12:51:58 -0800
commitce2f802c3e2ff8ce2f0408e911635ca7e6331cfe (patch)
tree9edca1082f637c7801a45b137fc9c8c44573a1c2 /drivers/rtc
parenta5ab014ca5dce7cd039a6080b480f7e516ffc59a (diff)
rtc: tps80031: Fixing month register program error
The month field of tm structure managed by kernel, expects a value between 0 to 11. However, TPS80031 RTC month register expects the month range to be between 1 to 12. Hence fixing it. bug 931452 Change-Id: Ie208c50b316e452e50eb2b607bafe83cb227eaea Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com> Reviewed-on: http://git-master/r/79928 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-tps80031.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/rtc/rtc-tps80031.c b/drivers/rtc/rtc-tps80031.c
index 7d32032266fd..17e4693b3c3e 100644
--- a/drivers/rtc/rtc-tps80031.c
+++ b/drivers/rtc/rtc-tps80031.c
@@ -141,7 +141,7 @@ static int tps80031_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] + RTC_YEAR_OFFSET;
tm->tm_wday = buff[6];
return 0;
@@ -175,7 +175,7 @@ static int tps80031_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 % RTC_YEAR_OFFSET;
buff[6] = tm->tm_wday;
@@ -223,7 +223,7 @@ static int tps80031_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 % RTC_YEAR_OFFSET;
convert_decimal_to_bcd(buff, sizeof(buff));
err = tps80031_write_regs(dev, RTC_ALARM, sizeof(buff), buff);
@@ -247,7 +247,7 @@ static int tps80031_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] + RTC_YEAR_OFFSET;
return 0;