Lines Matching refs:rs5c
101 static int rs5c_get_regs(struct rs5c372 *rs5c) in rs5c_get_regs() argument
103 struct i2c_client *client = rs5c->client; in rs5c_get_regs()
105 { client->addr, I2C_M_RD, sizeof rs5c->buf, rs5c->buf }, in rs5c_get_regs()
119 if (rs5c->smbus) { in rs5c_get_regs()
121 int size = sizeof(rs5c->buf) - 1; in rs5c_get_regs()
124 rs5c->buf + 1) != size) { in rs5c_get_regs()
138 rs5c->regs[0], rs5c->regs[1], rs5c->regs[2], rs5c->regs[3], in rs5c_get_regs()
139 rs5c->regs[4], rs5c->regs[5], rs5c->regs[6], rs5c->regs[7], in rs5c_get_regs()
140 rs5c->regs[8], rs5c->regs[9], rs5c->regs[10], rs5c->regs[11], in rs5c_get_regs()
141 rs5c->regs[12], rs5c->regs[13], rs5c->regs[14], rs5c->regs[15]); in rs5c_get_regs()
146 static unsigned rs5c_reg2hr(struct rs5c372 *rs5c, unsigned reg) in rs5c_reg2hr() argument
150 if (rs5c->time24) in rs5c_reg2hr()
161 static unsigned rs5c_hr2reg(struct rs5c372 *rs5c, unsigned hour) in rs5c_hr2reg() argument
163 if (rs5c->time24) in rs5c_hr2reg()
177 struct rs5c372 *rs5c = i2c_get_clientdata(client); in rs5c372_get_datetime() local
178 int status = rs5c_get_regs(rs5c); in rs5c372_get_datetime()
183 tm->tm_sec = bcd2bin(rs5c->regs[RS5C372_REG_SECS] & 0x7f); in rs5c372_get_datetime()
184 tm->tm_min = bcd2bin(rs5c->regs[RS5C372_REG_MINS] & 0x7f); in rs5c372_get_datetime()
185 tm->tm_hour = rs5c_reg2hr(rs5c, rs5c->regs[RS5C372_REG_HOURS]); in rs5c372_get_datetime()
187 tm->tm_wday = bcd2bin(rs5c->regs[RS5C372_REG_WDAY] & 0x07); in rs5c372_get_datetime()
188 tm->tm_mday = bcd2bin(rs5c->regs[RS5C372_REG_DAY] & 0x3f); in rs5c372_get_datetime()
191 tm->tm_mon = bcd2bin(rs5c->regs[RS5C372_REG_MONTH] & 0x1f) - 1; in rs5c372_get_datetime()
194 tm->tm_year = bcd2bin(rs5c->regs[RS5C372_REG_YEAR]) + 100; in rs5c372_get_datetime()
208 struct rs5c372 *rs5c = i2c_get_clientdata(client); in rs5c372_set_datetime() local
221 buf[2] = rs5c_hr2reg(rs5c, tm->tm_hour); in rs5c372_set_datetime()
289 struct rs5c372 *rs5c = i2c_get_clientdata(client); in rs5c_rtc_ioctl() local
293 buf = rs5c->regs[RS5C_REG_CTRL1]; in rs5c_rtc_ioctl()
298 if (rs5c->type == rtc_rs5c372a in rs5c_rtc_ioctl()
306 if (!rs5c->has_irq) in rs5c_rtc_ioctl()
313 status = rs5c_get_regs(rs5c); in rs5c_rtc_ioctl()
336 rs5c->rtc->name); in rs5c_rtc_ioctl()
339 rs5c->regs[RS5C_REG_CTRL1] = buf; in rs5c_rtc_ioctl()
361 struct rs5c372 *rs5c = i2c_get_clientdata(client); in rs5c_read_alarm() local
364 status = rs5c_get_regs(rs5c); in rs5c_read_alarm()
370 t->time.tm_min = bcd2bin(rs5c->regs[RS5C_REG_ALARM_A_MIN] & 0x7f); in rs5c_read_alarm()
371 t->time.tm_hour = rs5c_reg2hr(rs5c, rs5c->regs[RS5C_REG_ALARM_A_HOURS]); in rs5c_read_alarm()
380 t->enabled = !!(rs5c->regs[RS5C_REG_CTRL1] & RS5C_CTRL1_AALE); in rs5c_read_alarm()
381 t->pending = !!(rs5c->regs[RS5C_REG_CTRL2] & RS5C_CTRL2_AAFG); in rs5c_read_alarm()
389 struct rs5c372 *rs5c = i2c_get_clientdata(client); in rs5c_set_alarm() local
402 status = rs5c_get_regs(rs5c); in rs5c_set_alarm()
405 if (rs5c->regs[RS5C_REG_CTRL1] & RS5C_CTRL1_AALE) { in rs5c_set_alarm()
407 buf[0] = rs5c->regs[RS5C_REG_CTRL1] & ~RS5C_CTRL1_AALE; in rs5c_set_alarm()
409 pr_debug("%s: can't disable alarm\n", rs5c->rtc->name); in rs5c_set_alarm()
412 rs5c->regs[RS5C_REG_CTRL1] = buf[0]; in rs5c_set_alarm()
417 buf[1] = rs5c_hr2reg(rs5c, t->time.tm_hour); in rs5c_set_alarm()
423 pr_debug("%s: can't set alarm time\n", rs5c->rtc->name); in rs5c_set_alarm()
431 buf[0] = rs5c->regs[RS5C_REG_CTRL1] | RS5C_CTRL1_AALE; in rs5c_set_alarm()
434 rs5c->rtc->name); in rs5c_set_alarm()
435 rs5c->regs[RS5C_REG_CTRL1] = buf[0]; in rs5c_set_alarm()