Commit 35738392 authored by Chris Cui's avatar Chris Cui Committed by Linus Torvalds

drivers/rtc/rtc-pcf8523.c: fix month definition

PCF8523 uses 1-12 to represent month according to datasheet.
link: www.nxp.com/documents/data_sheet/PCF8523.pdf.
Signed-off-by: default avatarChris Cui <chris.wei.cui@gmail.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 256cf4c4
...@@ -206,7 +206,7 @@ static int pcf8523_rtc_read_time(struct device *dev, struct rtc_time *tm) ...@@ -206,7 +206,7 @@ static int pcf8523_rtc_read_time(struct device *dev, struct rtc_time *tm)
tm->tm_hour = bcd2bin(regs[2] & 0x3f); tm->tm_hour = bcd2bin(regs[2] & 0x3f);
tm->tm_mday = bcd2bin(regs[3] & 0x3f); tm->tm_mday = bcd2bin(regs[3] & 0x3f);
tm->tm_wday = regs[4] & 0x7; tm->tm_wday = regs[4] & 0x7;
tm->tm_mon = bcd2bin(regs[5] & 0x1f); tm->tm_mon = bcd2bin(regs[5] & 0x1f) - 1;
tm->tm_year = bcd2bin(regs[6]) + 100; tm->tm_year = bcd2bin(regs[6]) + 100;
return rtc_valid_tm(tm); return rtc_valid_tm(tm);
...@@ -229,7 +229,7 @@ static int pcf8523_rtc_set_time(struct device *dev, struct rtc_time *tm) ...@@ -229,7 +229,7 @@ static int pcf8523_rtc_set_time(struct device *dev, struct rtc_time *tm)
regs[3] = bin2bcd(tm->tm_hour); regs[3] = bin2bcd(tm->tm_hour);
regs[4] = bin2bcd(tm->tm_mday); regs[4] = bin2bcd(tm->tm_mday);
regs[5] = tm->tm_wday; regs[5] = tm->tm_wday;
regs[6] = bin2bcd(tm->tm_mon); regs[6] = bin2bcd(tm->tm_mon + 1);
regs[7] = bin2bcd(tm->tm_year - 100); regs[7] = bin2bcd(tm->tm_year - 100);
msg.addr = client->addr; msg.addr = client->addr;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment