Lines Matching refs:rs5c

132 static int rs5c_get_regs(struct rs5c372 *rs5c)  in rs5c_get_regs()  argument
134 struct i2c_client *client = rs5c->client; in rs5c_get_regs()
139 .len = sizeof(rs5c->buf), in rs5c_get_regs()
140 .buf = rs5c->buf in rs5c_get_regs()
155 if (rs5c->smbus) { in rs5c_get_regs()
157 int size = sizeof(rs5c->buf) - 1; in rs5c_get_regs()
160 rs5c->buf + 1) != size) { in rs5c_get_regs()
173 rs5c->regs + 0, rs5c->regs[3], in rs5c_get_regs()
174 rs5c->regs + 4, rs5c->regs[7], in rs5c_get_regs()
175 rs5c->regs + 8, rs5c->regs + 11, in rs5c_get_regs()
176 rs5c->regs[14], rs5c->regs[15]); in rs5c_get_regs()
181 static unsigned rs5c_reg2hr(struct rs5c372 *rs5c, unsigned reg) in rs5c_reg2hr() argument
185 if (rs5c->time24) in rs5c_reg2hr()
196 static unsigned rs5c_hr2reg(struct rs5c372 *rs5c, unsigned hour) in rs5c_hr2reg() argument
198 if (rs5c->time24) in rs5c_hr2reg()
213 struct rs5c372 *rs5c = i2c_get_clientdata(client); in rs5c372_rtc_read_time() local
214 int status = rs5c_get_regs(rs5c); in rs5c372_rtc_read_time()
219 tm->tm_sec = bcd2bin(rs5c->regs[RS5C372_REG_SECS] & 0x7f); in rs5c372_rtc_read_time()
220 tm->tm_min = bcd2bin(rs5c->regs[RS5C372_REG_MINS] & 0x7f); in rs5c372_rtc_read_time()
221 tm->tm_hour = rs5c_reg2hr(rs5c, rs5c->regs[RS5C372_REG_HOURS]); in rs5c372_rtc_read_time()
223 tm->tm_wday = bcd2bin(rs5c->regs[RS5C372_REG_WDAY] & 0x07); in rs5c372_rtc_read_time()
224 tm->tm_mday = bcd2bin(rs5c->regs[RS5C372_REG_DAY] & 0x3f); in rs5c372_rtc_read_time()
227 tm->tm_mon = bcd2bin(rs5c->regs[RS5C372_REG_MONTH] & 0x1f) - 1; in rs5c372_rtc_read_time()
230 tm->tm_year = bcd2bin(rs5c->regs[RS5C372_REG_YEAR]) + 100; in rs5c372_rtc_read_time()
244 struct rs5c372 *rs5c = i2c_get_clientdata(client); in rs5c372_rtc_set_time() local
257 buf[2] = rs5c_hr2reg(rs5c, tm->tm_hour); in rs5c372_rtc_set_time()
312 struct rs5c372 *rs5c = i2c_get_clientdata(client); in rs5c_rtc_alarm_irq_enable() local
316 buf = rs5c->regs[RS5C_REG_CTRL1]; in rs5c_rtc_alarm_irq_enable()
318 if (!rs5c->has_irq) in rs5c_rtc_alarm_irq_enable()
321 status = rs5c_get_regs(rs5c); in rs5c_rtc_alarm_irq_enable()
335 rs5c->regs[RS5C_REG_CTRL1] = buf; in rs5c_rtc_alarm_irq_enable()
353 struct rs5c372 *rs5c = i2c_get_clientdata(client); in rs5c_read_alarm() local
356 status = rs5c_get_regs(rs5c); in rs5c_read_alarm()
362 t->time.tm_min = bcd2bin(rs5c->regs[RS5C_REG_ALARM_A_MIN] & 0x7f); in rs5c_read_alarm()
363 t->time.tm_hour = rs5c_reg2hr(rs5c, rs5c->regs[RS5C_REG_ALARM_A_HOURS]); in rs5c_read_alarm()
366 t->enabled = !!(rs5c->regs[RS5C_REG_CTRL1] & RS5C_CTRL1_AALE); in rs5c_read_alarm()
367 t->pending = !!(rs5c->regs[RS5C_REG_CTRL2] & RS5C_CTRL2_AAFG); in rs5c_read_alarm()
375 struct rs5c372 *rs5c = i2c_get_clientdata(client); in rs5c_set_alarm() local
388 status = rs5c_get_regs(rs5c); in rs5c_set_alarm()
391 if (rs5c->regs[RS5C_REG_CTRL1] & RS5C_CTRL1_AALE) { in rs5c_set_alarm()
393 buf[0] = rs5c->regs[RS5C_REG_CTRL1] & ~RS5C_CTRL1_AALE; in rs5c_set_alarm()
398 rs5c->regs[RS5C_REG_CTRL1] = buf[0]; in rs5c_set_alarm()
403 buf[1] = rs5c_hr2reg(rs5c, t->time.tm_hour); in rs5c_set_alarm()
417 buf[0] = rs5c->regs[RS5C_REG_CTRL1] | RS5C_CTRL1_AALE; in rs5c_set_alarm()
420 rs5c->regs[RS5C_REG_CTRL1] = buf[0]; in rs5c_set_alarm()