Lines Matching defs:tm
29 static int m41t94_set_time(struct device *dev, struct rtc_time *tm)
36 "write", tm->tm_sec, tm->tm_min,
37 tm->tm_hour, tm->tm_mday,
38 tm->tm_mon, tm->tm_year, tm->tm_wday);
41 buf[M41T94_REG_SECONDS] = bin2bcd(tm->tm_sec);
42 buf[M41T94_REG_MINUTES] = bin2bcd(tm->tm_min);
43 buf[M41T94_REG_HOURS] = bin2bcd(tm->tm_hour);
44 buf[M41T94_REG_WDAY] = bin2bcd(tm->tm_wday + 1);
45 buf[M41T94_REG_DAY] = bin2bcd(tm->tm_mday);
46 buf[M41T94_REG_MONTH] = bin2bcd(tm->tm_mon + 1);
49 if (tm->tm_year >= 100)
51 buf[M41T94_REG_YEAR] = bin2bcd(tm->tm_year % 100);
56 static int m41t94_read_time(struct device *dev, struct rtc_time *tm)
82 tm->tm_sec = bcd2bin(spi_w8r8(spi, M41T94_REG_SECONDS));
83 tm->tm_min = bcd2bin(spi_w8r8(spi, M41T94_REG_MINUTES));
85 tm->tm_hour = bcd2bin(hour & 0x3f);
86 tm->tm_wday = bcd2bin(spi_w8r8(spi, M41T94_REG_WDAY)) - 1;
87 tm->tm_mday = bcd2bin(spi_w8r8(spi, M41T94_REG_DAY));
88 tm->tm_mon = bcd2bin(spi_w8r8(spi, M41T94_REG_MONTH)) - 1;
89 tm->tm_year = bcd2bin(spi_w8r8(spi, M41T94_REG_YEAR));
91 tm->tm_year += 100;
95 "read", tm->tm_sec, tm->tm_min,
96 tm->tm_hour, tm->tm_mday,
97 tm->tm_mon, tm->tm_year, tm->tm_wday);