mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
drivers/rtc/rtc-isl12057.c: fix masking of register values
When Intersil ISL12057 support was added by commit70e123373c("rtc: Add support for Intersil ISL12057 I2C RTC chip"), two masks for time registers values imported from the device were either wrong or omitted, leading to additional bits from those registers to impact read values: - mask for hour register value when reading it in AM/PM mode. As AM/PM mode is not the usual mode used by the driver, this error would only have an impact on an externally configured RTC hour later read by the driver. - mask for month value. The lack of masking would provide an erroneous value if century bit is set. This patch fixes those two masks. Fixes:70e123373c("rtc: Add support for Intersil ISL12057 I2C RTC chip") Signed-off-by: Arnaud Ebalard <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Peter Huewe <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Thierry Reding <[email protected]> Cc: Mark Brown <[email protected]> Cc: Grant Likely <[email protected]> Acked-by: Uwe Kleine-König <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
dd01a1c526
commit
5945b28803
1 changed files with 2 additions and 2 deletions
|
|
@ -88,7 +88,7 @@ static void isl12057_rtc_regs_to_tm(struct rtc_time *tm, u8 *regs)
|
|||
tm->tm_min = bcd2bin(regs[ISL12057_REG_RTC_MN]);
|
||||
|
||||
if (regs[ISL12057_REG_RTC_HR] & ISL12057_REG_RTC_HR_MIL) { /* AM/PM */
|
||||
tm->tm_hour = bcd2bin(regs[ISL12057_REG_RTC_HR] & 0x0f);
|
||||
tm->tm_hour = bcd2bin(regs[ISL12057_REG_RTC_HR] & 0x1f);
|
||||
if (regs[ISL12057_REG_RTC_HR] & ISL12057_REG_RTC_HR_PM)
|
||||
tm->tm_hour += 12;
|
||||
} else { /* 24 hour mode */
|
||||
|
|
@ -97,7 +97,7 @@ static void isl12057_rtc_regs_to_tm(struct rtc_time *tm, u8 *regs)
|
|||
|
||||
tm->tm_mday = bcd2bin(regs[ISL12057_REG_RTC_DT]);
|
||||
tm->tm_wday = bcd2bin(regs[ISL12057_REG_RTC_DW]) - 1; /* starts at 1 */
|
||||
tm->tm_mon = bcd2bin(regs[ISL12057_REG_RTC_MO]) - 1; /* starts at 1 */
|
||||
tm->tm_mon = bcd2bin(regs[ISL12057_REG_RTC_MO] & 0x1f) - 1; /* ditto */
|
||||
tm->tm_year = bcd2bin(regs[ISL12057_REG_RTC_YR]) + 100;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue