Lines Matching refs:tm

57 static void regs_to_tm(u8 *regs, struct rtc_time *tm)  in regs_to_tm()  argument
59 tm->tm_year = bcd2bin(regs[RTC_YEAR2]) * 100 + in regs_to_tm()
61 tm->tm_mon = bcd2bin(regs[RTC_MONTH] & 0x1f) - 1; in regs_to_tm()
62 tm->tm_mday = bcd2bin(regs[RTC_DATE] & 0x3f); in regs_to_tm()
63 tm->tm_wday = (regs[RTC_WEEKDAY] & 0x07); in regs_to_tm()
65 tm->tm_hour = bcd2bin(regs[RTC_HOUR] & 0x01f); in regs_to_tm()
66 if (tm->tm_hour == 12) in regs_to_tm()
67 tm->tm_hour = 0; in regs_to_tm()
69 tm->tm_hour += 12; in regs_to_tm()
71 tm->tm_hour = bcd2bin(regs[RTC_HOUR] & 0x03f); in regs_to_tm()
73 tm->tm_min = bcd2bin(regs[RTC_MIN] & 0x7f); in regs_to_tm()
74 tm->tm_sec = bcd2bin(regs[RTC_SEC] & 0x7f); in regs_to_tm()
77 static void tm_to_regs(struct rtc_time *tm, u8 *regs) in tm_to_regs() argument
81 high = (tm->tm_year + 1900) / 100; in tm_to_regs()
82 low = tm->tm_year % 100; in tm_to_regs()
85 regs[RTC_MONTH] = bin2bcd(tm->tm_mon + 1); in tm_to_regs()
86 regs[RTC_DATE] = bin2bcd(tm->tm_mday); in tm_to_regs()
87 regs[RTC_WEEKDAY] = tm->tm_wday; in tm_to_regs()
88 regs[RTC_HOUR] = bin2bcd(tm->tm_hour); in tm_to_regs()
89 regs[RTC_MIN] = bin2bcd(tm->tm_min); in tm_to_regs()
90 regs[RTC_SEC] = bin2bcd(tm->tm_sec); in tm_to_regs()
93 static int max8907_rtc_read_time(struct device *dev, struct rtc_time *tm) in max8907_rtc_read_time() argument
104 regs_to_tm(regs, tm); in max8907_rtc_read_time()
109 static int max8907_rtc_set_time(struct device *dev, struct rtc_time *tm) in max8907_rtc_set_time() argument
114 tm_to_regs(tm, regs); in max8907_rtc_set_time()