diff options
Diffstat (limited to 'drivers/rtc/rtc-rs5c348.c')
-rw-r--r-- | drivers/rtc/rtc-rs5c348.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c index 77074ccd2850..fd5c7af04ae5 100644 --- a/drivers/rtc/rtc-rs5c348.c +++ b/drivers/rtc/rtc-rs5c348.c | |||
@@ -122,9 +122,12 @@ rs5c348_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
122 | tm->tm_min = bcd2bin(rxbuf[RS5C348_REG_MINS] & RS5C348_MINS_MASK); | 122 | tm->tm_min = bcd2bin(rxbuf[RS5C348_REG_MINS] & RS5C348_MINS_MASK); |
123 | tm->tm_hour = bcd2bin(rxbuf[RS5C348_REG_HOURS] & RS5C348_HOURS_MASK); | 123 | tm->tm_hour = bcd2bin(rxbuf[RS5C348_REG_HOURS] & RS5C348_HOURS_MASK); |
124 | if (!pdata->rtc_24h) { | 124 | if (!pdata->rtc_24h) { |
125 | tm->tm_hour %= 12; | 125 | if (rxbuf[RS5C348_REG_HOURS] & RS5C348_BIT_PM) { |
126 | if (rxbuf[RS5C348_REG_HOURS] & RS5C348_BIT_PM) | 126 | tm->tm_hour -= 20; |
127 | tm->tm_hour %= 12; | ||
127 | tm->tm_hour += 12; | 128 | tm->tm_hour += 12; |
129 | } else | ||
130 | tm->tm_hour %= 12; | ||
128 | } | 131 | } |
129 | tm->tm_wday = bcd2bin(rxbuf[RS5C348_REG_WDAY] & RS5C348_WDAY_MASK); | 132 | tm->tm_wday = bcd2bin(rxbuf[RS5C348_REG_WDAY] & RS5C348_WDAY_MASK); |
130 | tm->tm_mday = bcd2bin(rxbuf[RS5C348_REG_DAY] & RS5C348_DAY_MASK); | 133 | tm->tm_mday = bcd2bin(rxbuf[RS5C348_REG_DAY] & RS5C348_DAY_MASK); |