summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBibek Basu <bbasu@nvidia.com>2014-02-27 12:12:45 +0530
committerLaxman Dewangan <ldewangan@nvidia.com>2014-03-04 09:43:22 -0800
commit718c112c01f0904c3611663e9eeb8fd9fd1d1b5f (patch)
tree5d8186c402944c8412b74a8d1caf5a206be787d9
parentb8cd1b2d7d5a08fd6d70e210a7ffe2da314378ee (diff)
rtc: as3722: correct month value
Month value written to RTCmonth register is not correct. As a result correct rollover is not happening when date changes from 31 to 1 Bug 1442350 Change-Id: Ib08b02b9f0245d042e626e7a4e15b3249896c609 Signed-off-by: Bibek Basu <bbasu@nvidia.com> Reviewed-on: http://git-master/r/375281 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
-rw-r--r--drivers/rtc/rtc-as3722.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-as3722.c b/drivers/rtc/rtc-as3722.c
index a796e8f04c92..81397bc7bef8 100644
--- a/drivers/rtc/rtc-as3722.c
+++ b/drivers/rtc/rtc-as3722.c
@@ -50,7 +50,7 @@ static void as3722_time_to_reg(u8 *rbuff, struct rtc_time *tm)
rbuff[1] = bin2bcd(tm->tm_min);
rbuff[2] = bin2bcd(tm->tm_hour);
rbuff[3] = bin2bcd(tm->tm_mday);
- rbuff[4] = bin2bcd(tm->tm_mon);
+ rbuff[4] = bin2bcd(tm->tm_mon + 1);
rbuff[5] = bin2bcd(tm->tm_year - (AS3722_RTC_START_YEAR - 1900));
}
@@ -60,7 +60,7 @@ static void as3722_reg_to_time(u8 *rbuff, struct rtc_time *tm)
tm->tm_min = bcd2bin(rbuff[1] & 0x7F);
tm->tm_hour = bcd2bin(rbuff[2] & 0x3F);
tm->tm_mday = bcd2bin(rbuff[3] & 0x3F);
- tm->tm_mon = bcd2bin(rbuff[4] & 0x1F);
+ tm->tm_mon = bcd2bin(rbuff[4] & 0x1F) - 1;
tm->tm_year = (AS3722_RTC_START_YEAR - 1900) + bcd2bin(rbuff[5] & 0x7F);
return;
}