Lines Matching refs:dt
182 static int rx8025_get_time(struct device *dev, struct rtc_time *dt) in rx8025_get_time() argument
201 dt->tm_sec = bcd2bin(date[RX8025_REG_SEC] & 0x7f); in rx8025_get_time()
202 dt->tm_min = bcd2bin(date[RX8025_REG_MIN] & 0x7f); in rx8025_get_time()
204 dt->tm_hour = bcd2bin(date[RX8025_REG_HOUR] & 0x3f); in rx8025_get_time()
206 dt->tm_hour = bcd2bin(date[RX8025_REG_HOUR] & 0x1f) % 12 in rx8025_get_time()
209 dt->tm_mday = bcd2bin(date[RX8025_REG_MDAY] & 0x3f); in rx8025_get_time()
210 dt->tm_mon = bcd2bin(date[RX8025_REG_MONTH] & 0x1f) - 1; in rx8025_get_time()
211 dt->tm_year = bcd2bin(date[RX8025_REG_YEAR]) + 100; in rx8025_get_time()
214 dt->tm_sec, dt->tm_min, dt->tm_hour, in rx8025_get_time()
215 dt->tm_mday, dt->tm_mon, dt->tm_year); in rx8025_get_time()
217 return rtc_valid_tm(dt); in rx8025_get_time()
220 static int rx8025_set_time(struct device *dev, struct rtc_time *dt) in rx8025_set_time() argument
226 if ((dt->tm_year < 100) || (dt->tm_year > 199)) in rx8025_set_time()
233 date[RX8025_REG_SEC] = bin2bcd(dt->tm_sec); in rx8025_set_time()
234 date[RX8025_REG_MIN] = bin2bcd(dt->tm_min); in rx8025_set_time()
236 date[RX8025_REG_HOUR] = bin2bcd(dt->tm_hour); in rx8025_set_time()
238 date[RX8025_REG_HOUR] = (dt->tm_hour >= 12 ? 0x20 : 0) in rx8025_set_time()
239 | bin2bcd((dt->tm_hour + 11) % 12 + 1); in rx8025_set_time()
241 date[RX8025_REG_WDAY] = bin2bcd(dt->tm_wday); in rx8025_set_time()
242 date[RX8025_REG_MDAY] = bin2bcd(dt->tm_mday); in rx8025_set_time()
243 date[RX8025_REG_MONTH] = bin2bcd(dt->tm_mon + 1); in rx8025_set_time()
244 date[RX8025_REG_YEAR] = bin2bcd(dt->tm_year - 100); in rx8025_set_time()