Lines Matching refs:tm
65 static void m41t62_update_rtc_time(struct rtc_time *tm, u8 *buf) in m41t62_update_rtc_time() argument
73 tm->tm_sec = bcd2bin(buf[M41T62_REG_SEC] & 0x7f); in m41t62_update_rtc_time()
74 tm->tm_min = bcd2bin(buf[M41T62_REG_MIN] & 0x7f); in m41t62_update_rtc_time()
75 tm->tm_hour = bcd2bin(buf[M41T62_REG_HOUR] & 0x3f); in m41t62_update_rtc_time()
76 tm->tm_mday = bcd2bin(buf[M41T62_REG_DAY] & 0x3f); in m41t62_update_rtc_time()
77 tm->tm_wday = buf[M41T62_REG_WDAY] & 0x07; in m41t62_update_rtc_time()
78 tm->tm_mon = bcd2bin(buf[M41T62_REG_MON] & 0x1f); in m41t62_update_rtc_time()
82 tm->tm_year = bcd2bin(buf[M41T62_REG_YEAR]) + 100 + 1900; in m41t62_update_rtc_time()
87 tm->tm_sec, tm->tm_min, tm->tm_hour, in m41t62_update_rtc_time()
88 tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday); in m41t62_update_rtc_time()
91 static void m41t62_set_rtc_buf(const struct rtc_time *tm, u8 *buf) in m41t62_set_rtc_buf() argument
94 tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_wday, in m41t62_set_rtc_buf()
95 tm->tm_hour, tm->tm_min, tm->tm_sec); in m41t62_set_rtc_buf()
100 bin2bcd(tm->tm_sec) | (buf[M41T62_REG_SEC] & ~0x7f); in m41t62_set_rtc_buf()
102 bin2bcd(tm->tm_min) | (buf[M41T62_REG_MIN] & ~0x7f); in m41t62_set_rtc_buf()
104 bin2bcd(tm->tm_hour) | (buf[M41T62_REG_HOUR] & ~0x3f) ; in m41t62_set_rtc_buf()
106 (tm->tm_wday & 0x07) | (buf[M41T62_REG_WDAY] & ~0x07); in m41t62_set_rtc_buf()
108 bin2bcd(tm->tm_mday) | (buf[M41T62_REG_DAY] & ~0x3f); in m41t62_set_rtc_buf()
110 bin2bcd(tm->tm_mon) | (buf[M41T62_REG_MON] & ~0x1f); in m41t62_set_rtc_buf()
112 buf[M41T62_REG_YEAR] = bin2bcd(tm->tm_year % 100); in m41t62_set_rtc_buf()
116 static int m41t62_rtc_get(struct udevice *dev, struct rtc_time *tm) in m41t62_rtc_get() argument
125 m41t62_update_rtc_time(tm, buf); in m41t62_rtc_get()
130 static int m41t62_rtc_set(struct udevice *dev, const struct rtc_time *tm) in m41t62_rtc_set() argument
139 m41t62_set_rtc_buf(tm, buf); in m41t62_rtc_set()
318 int rtc_get(struct rtc_time *tm) in rtc_get() argument
323 m41t62_update_rtc_time(tm, buf); in rtc_get()
328 int rtc_set(struct rtc_time *tm) in rtc_set() argument
333 m41t62_set_rtc_buf(tm, buf); in rtc_set()