Lines Matching refs:tm
52 static int pcf2127_rtc_set(struct udevice *dev, const struct rtc_time *tm) in pcf2127_rtc_set() argument
58 buf[i++] = bin2bcd(tm->tm_sec); in pcf2127_rtc_set()
59 buf[i++] = bin2bcd(tm->tm_min); in pcf2127_rtc_set()
60 buf[i++] = bin2bcd(tm->tm_hour); in pcf2127_rtc_set()
61 buf[i++] = bin2bcd(tm->tm_mday); in pcf2127_rtc_set()
62 buf[i++] = tm->tm_wday & 0x07; in pcf2127_rtc_set()
65 buf[i++] = bin2bcd(tm->tm_mon); in pcf2127_rtc_set()
68 buf[i++] = bin2bcd(tm->tm_year % 100); in pcf2127_rtc_set()
76 static int pcf2127_rtc_get(struct udevice *dev, struct rtc_time *tm) in pcf2127_rtc_get() argument
88 tm->tm_sec = bcd2bin(buf[PCF2127_REG_SC] & 0x7F); in pcf2127_rtc_get()
89 tm->tm_min = bcd2bin(buf[PCF2127_REG_MN] & 0x7F); in pcf2127_rtc_get()
90 tm->tm_hour = bcd2bin(buf[PCF2127_REG_HR] & 0x3F); in pcf2127_rtc_get()
91 tm->tm_mday = bcd2bin(buf[PCF2127_REG_DM] & 0x3F); in pcf2127_rtc_get()
92 tm->tm_mon = bcd2bin(buf[PCF2127_REG_MO] & 0x1F); in pcf2127_rtc_get()
93 tm->tm_year = bcd2bin(buf[PCF2127_REG_YR]) + 1900; in pcf2127_rtc_get()
94 if (tm->tm_year < 1970) in pcf2127_rtc_get()
95 tm->tm_year += 100; /* assume we are in 1970...2069 */ in pcf2127_rtc_get()
96 tm->tm_wday = buf[PCF2127_REG_DW] & 0x07; in pcf2127_rtc_get()
97 tm->tm_yday = 0; in pcf2127_rtc_get()
98 tm->tm_isdst = 0; in pcf2127_rtc_get()
101 tm->tm_year, tm->tm_mon, tm->tm_mday, tm->tm_wday, in pcf2127_rtc_get()
102 tm->tm_hour, tm->tm_min, tm->tm_sec); in pcf2127_rtc_get()