Lines Matching refs:tim
183 static int mcp795_set_time(struct device *dev, struct rtc_time *tim) in mcp795_set_time() argument
200 data[0] = (data[0] & 0x80) | bin2bcd(tim->tm_sec); in mcp795_set_time()
201 data[1] = (data[1] & 0x80) | bin2bcd(tim->tm_min); in mcp795_set_time()
202 data[2] = bin2bcd(tim->tm_hour); in mcp795_set_time()
203 data[3] = (data[3] & 0xF8) | bin2bcd(tim->tm_wday + 1); in mcp795_set_time()
204 data[4] = bin2bcd(tim->tm_mday); in mcp795_set_time()
205 data[5] = (data[5] & MCP795_LP_BIT) | bin2bcd(tim->tm_mon + 1); in mcp795_set_time()
207 if (tim->tm_year > 100) in mcp795_set_time()
208 tim->tm_year -= 100; in mcp795_set_time()
210 data[6] = bin2bcd(tim->tm_year); in mcp795_set_time()
232 dev_dbg(dev, "Set mcp795: %ptR\n", tim); in mcp795_set_time()
237 static int mcp795_read_time(struct device *dev, struct rtc_time *tim) in mcp795_read_time() argument
247 tim->tm_sec = bcd2bin(data[0] & 0x7F); in mcp795_read_time()
248 tim->tm_min = bcd2bin(data[1] & 0x7F); in mcp795_read_time()
249 tim->tm_hour = bcd2bin(data[2] & 0x3F); in mcp795_read_time()
250 tim->tm_wday = bcd2bin(data[3] & 0x07) - 1; in mcp795_read_time()
251 tim->tm_mday = bcd2bin(data[4] & 0x3F); in mcp795_read_time()
252 tim->tm_mon = bcd2bin(data[5] & 0x1F) - 1; in mcp795_read_time()
253 tim->tm_year = bcd2bin(data[6]) + 100; /* Assume we are in 20xx */ in mcp795_read_time()
255 dev_dbg(dev, "Read from mcp795: %ptR\n", tim); in mcp795_read_time()