Lines Matching refs:rs5c

105 static int rs5c_get_regs(struct rs5c372 *rs5c)  in rs5c_get_regs()  argument
107 struct i2c_client *client = rs5c->client; in rs5c_get_regs()
112 .len = sizeof(rs5c->buf), in rs5c_get_regs()
113 .buf = rs5c->buf in rs5c_get_regs()
128 if (rs5c->smbus) { in rs5c_get_regs()
130 int size = sizeof(rs5c->buf) - 1; in rs5c_get_regs()
133 rs5c->buf + 1) != size) { in rs5c_get_regs()
146 rs5c->regs + 0, rs5c->regs[3], in rs5c_get_regs()
147 rs5c->regs + 4, rs5c->regs[7], in rs5c_get_regs()
148 rs5c->regs + 8, rs5c->regs + 11, in rs5c_get_regs()
149 rs5c->regs[14], rs5c->regs[15]); in rs5c_get_regs()
154 static unsigned rs5c_reg2hr(struct rs5c372 *rs5c, unsigned reg) in rs5c_reg2hr() argument
158 if (rs5c->time24) in rs5c_reg2hr()
169 static unsigned rs5c_hr2reg(struct rs5c372 *rs5c, unsigned hour) in rs5c_hr2reg() argument
171 if (rs5c->time24) in rs5c_hr2reg()
185 struct rs5c372 *rs5c = i2c_get_clientdata(client); in rs5c372_get_datetime() local
186 int status = rs5c_get_regs(rs5c); in rs5c372_get_datetime()
191 tm->tm_sec = bcd2bin(rs5c->regs[RS5C372_REG_SECS] & 0x7f); in rs5c372_get_datetime()
192 tm->tm_min = bcd2bin(rs5c->regs[RS5C372_REG_MINS] & 0x7f); in rs5c372_get_datetime()
193 tm->tm_hour = rs5c_reg2hr(rs5c, rs5c->regs[RS5C372_REG_HOURS]); in rs5c372_get_datetime()
195 tm->tm_wday = bcd2bin(rs5c->regs[RS5C372_REG_WDAY] & 0x07); in rs5c372_get_datetime()
196 tm->tm_mday = bcd2bin(rs5c->regs[RS5C372_REG_DAY] & 0x3f); in rs5c372_get_datetime()
199 tm->tm_mon = bcd2bin(rs5c->regs[RS5C372_REG_MONTH] & 0x1f) - 1; in rs5c372_get_datetime()
202 tm->tm_year = bcd2bin(rs5c->regs[RS5C372_REG_YEAR]) + 100; in rs5c372_get_datetime()
216 struct rs5c372 *rs5c = i2c_get_clientdata(client); in rs5c372_set_datetime() local
229 buf[2] = rs5c_hr2reg(rs5c, tm->tm_hour); in rs5c372_set_datetime()
295 struct rs5c372 *rs5c = i2c_get_clientdata(client); in rs5c_rtc_alarm_irq_enable() local
299 buf = rs5c->regs[RS5C_REG_CTRL1]; in rs5c_rtc_alarm_irq_enable()
301 if (!rs5c->has_irq) in rs5c_rtc_alarm_irq_enable()
304 status = rs5c_get_regs(rs5c); in rs5c_rtc_alarm_irq_enable()
318 rs5c->regs[RS5C_REG_CTRL1] = buf; in rs5c_rtc_alarm_irq_enable()
336 struct rs5c372 *rs5c = i2c_get_clientdata(client); in rs5c_read_alarm() local
339 status = rs5c_get_regs(rs5c); in rs5c_read_alarm()
345 t->time.tm_min = bcd2bin(rs5c->regs[RS5C_REG_ALARM_A_MIN] & 0x7f); in rs5c_read_alarm()
346 t->time.tm_hour = rs5c_reg2hr(rs5c, rs5c->regs[RS5C_REG_ALARM_A_HOURS]); in rs5c_read_alarm()
355 t->enabled = !!(rs5c->regs[RS5C_REG_CTRL1] & RS5C_CTRL1_AALE); in rs5c_read_alarm()
356 t->pending = !!(rs5c->regs[RS5C_REG_CTRL2] & RS5C_CTRL2_AAFG); in rs5c_read_alarm()
364 struct rs5c372 *rs5c = i2c_get_clientdata(client); in rs5c_set_alarm() local
377 status = rs5c_get_regs(rs5c); in rs5c_set_alarm()
380 if (rs5c->regs[RS5C_REG_CTRL1] & RS5C_CTRL1_AALE) { in rs5c_set_alarm()
382 buf[0] = rs5c->regs[RS5C_REG_CTRL1] & ~RS5C_CTRL1_AALE; in rs5c_set_alarm()
387 rs5c->regs[RS5C_REG_CTRL1] = buf[0]; in rs5c_set_alarm()
392 buf[1] = rs5c_hr2reg(rs5c, t->time.tm_hour); in rs5c_set_alarm()
406 buf[0] = rs5c->regs[RS5C_REG_CTRL1] | RS5C_CTRL1_AALE; in rs5c_set_alarm()
409 rs5c->regs[RS5C_REG_CTRL1] = buf[0]; in rs5c_set_alarm()