Lines Matching refs:tm
36 int rtc_set(struct rtc_time *tm) in rtc_set() argument
51 buf[M41T94_REG_SECONDS] = bin2bcd(tm->tm_sec); in rtc_set()
52 buf[M41T94_REG_MINUTES] = bin2bcd(tm->tm_min); in rtc_set()
53 buf[M41T94_REG_HOURS] = bin2bcd(tm->tm_hour); in rtc_set()
54 buf[M41T94_REG_WDAY] = bin2bcd(tm->tm_wday + 1); in rtc_set()
55 buf[M41T94_REG_DAY] = bin2bcd(tm->tm_mday); in rtc_set()
56 buf[M41T94_REG_MONTH] = bin2bcd(tm->tm_mon + 1); in rtc_set()
59 if (tm->tm_year >= 100) in rtc_set()
61 buf[M41T94_REG_YEAR] = bin2bcd(tm->tm_year % 100); in rtc_set()
68 int rtc_get(struct rtc_time *tm) in rtc_get() argument
102 tm->tm_sec = bcd2bin(spi_w8r8(slave, M41T94_REG_SECONDS)); in rtc_get()
103 tm->tm_min = bcd2bin(spi_w8r8(slave, M41T94_REG_MINUTES)); in rtc_get()
105 tm->tm_hour = bcd2bin(hour & 0x3f); in rtc_get()
106 tm->tm_wday = bcd2bin(spi_w8r8(slave, M41T94_REG_WDAY)) - 1; in rtc_get()
107 tm->tm_mday = bcd2bin(spi_w8r8(slave, M41T94_REG_DAY)); in rtc_get()
108 tm->tm_mon = bcd2bin(spi_w8r8(slave, M41T94_REG_MONTH)) - 1; in rtc_get()
109 tm->tm_year = bcd2bin(spi_w8r8(slave, M41T94_REG_YEAR)); in rtc_get()
111 tm->tm_year += 100; in rtc_get()