Lines Matching refs:tm

61 static void regs_to_tm(u8 *regs, struct rtc_time *tm)  in regs_to_tm()  argument
63 tm->tm_year = bcd2bin(regs[RTC_YEAR2]) * 100 + in regs_to_tm()
65 tm->tm_mon = bcd2bin(regs[RTC_MONTH] & 0x1f) - 1; in regs_to_tm()
66 tm->tm_mday = bcd2bin(regs[RTC_DATE] & 0x3f); in regs_to_tm()
67 tm->tm_wday = (regs[RTC_WEEKDAY] & 0x07); in regs_to_tm()
69 tm->tm_hour = bcd2bin(regs[RTC_HOUR] & 0x01f); in regs_to_tm()
70 if (tm->tm_hour == 12) in regs_to_tm()
71 tm->tm_hour = 0; in regs_to_tm()
73 tm->tm_hour += 12; in regs_to_tm()
75 tm->tm_hour = bcd2bin(regs[RTC_HOUR] & 0x03f); in regs_to_tm()
77 tm->tm_min = bcd2bin(regs[RTC_MIN] & 0x7f); in regs_to_tm()
78 tm->tm_sec = bcd2bin(regs[RTC_SEC] & 0x7f); in regs_to_tm()
81 static void tm_to_regs(struct rtc_time *tm, u8 *regs) in tm_to_regs() argument
85 high = (tm->tm_year + 1900) / 100; in tm_to_regs()
86 low = tm->tm_year % 100; in tm_to_regs()
89 regs[RTC_MONTH] = bin2bcd(tm->tm_mon + 1); in tm_to_regs()
90 regs[RTC_DATE] = bin2bcd(tm->tm_mday); in tm_to_regs()
91 regs[RTC_WEEKDAY] = tm->tm_wday; in tm_to_regs()
92 regs[RTC_HOUR] = bin2bcd(tm->tm_hour); in tm_to_regs()
93 regs[RTC_MIN] = bin2bcd(tm->tm_min); in tm_to_regs()
94 regs[RTC_SEC] = bin2bcd(tm->tm_sec); in tm_to_regs()
97 static int max8907_rtc_read_time(struct device *dev, struct rtc_time *tm) in max8907_rtc_read_time() argument
108 regs_to_tm(regs, tm); in max8907_rtc_read_time()
113 static int max8907_rtc_set_time(struct device *dev, struct rtc_time *tm) in max8907_rtc_set_time() argument
118 tm_to_regs(tm, regs); in max8907_rtc_set_time()