Lines Matching defs:tm
32 static int m41t94_set_time(struct device *dev, struct rtc_time *tm)
39 "write", tm->tm_sec, tm->tm_min,
40 tm->tm_hour, tm->tm_mday,
41 tm->tm_mon, tm->tm_year, tm->tm_wday);
44 buf[M41T94_REG_SECONDS] = bin2bcd(tm->tm_sec);
45 buf[M41T94_REG_MINUTES] = bin2bcd(tm->tm_min);
46 buf[M41T94_REG_HOURS] = bin2bcd(tm->tm_hour);
47 buf[M41T94_REG_WDAY] = bin2bcd(tm->tm_wday + 1);
48 buf[M41T94_REG_DAY] = bin2bcd(tm->tm_mday);
49 buf[M41T94_REG_MONTH] = bin2bcd(tm->tm_mon + 1);
52 if (tm->tm_year >= 100)
54 buf[M41T94_REG_YEAR] = bin2bcd(tm->tm_year % 100);
59 static int m41t94_read_time(struct device *dev, struct rtc_time *tm)
85 tm->tm_sec = bcd2bin(spi_w8r8(spi, M41T94_REG_SECONDS));
86 tm->tm_min = bcd2bin(spi_w8r8(spi, M41T94_REG_MINUTES));
88 tm->tm_hour = bcd2bin(hour & 0x3f);
89 tm->tm_wday = bcd2bin(spi_w8r8(spi, M41T94_REG_WDAY)) - 1;
90 tm->tm_mday = bcd2bin(spi_w8r8(spi, M41T94_REG_DAY));
91 tm->tm_mon = bcd2bin(spi_w8r8(spi, M41T94_REG_MONTH)) - 1;
92 tm->tm_year = bcd2bin(spi_w8r8(spi, M41T94_REG_YEAR));
94 tm->tm_year += 100;
98 "read", tm->tm_sec, tm->tm_min,
99 tm->tm_hour, tm->tm_mday,
100 tm->tm_mon, tm->tm_year, tm->tm_wday);
103 return rtc_valid_tm(tm);