Lines Matching full:client
69 struct i2c_client *client; member
78 static int rv8803_read_reg(const struct i2c_client *client, u8 reg) in rv8803_read_reg() argument
88 ret = i2c_smbus_read_byte_data(client, reg); in rv8803_read_reg()
91 dev_err(&client->dev, "Unable to read register 0x%02x\n", reg); in rv8803_read_reg()
96 static int rv8803_read_regs(const struct i2c_client *client, in rv8803_read_regs() argument
103 ret = i2c_smbus_read_i2c_block_data(client, reg, count, values); in rv8803_read_regs()
106 dev_err(&client->dev, in rv8803_read_regs()
115 static int rv8803_write_reg(const struct i2c_client *client, u8 reg, u8 value) in rv8803_write_reg() argument
121 ret = i2c_smbus_write_byte_data(client, reg, value); in rv8803_write_reg()
124 dev_err(&client->dev, "Unable to write register 0x%02x\n", reg); in rv8803_write_reg()
129 static int rv8803_write_regs(const struct i2c_client *client, in rv8803_write_regs() argument
136 ret = i2c_smbus_write_i2c_block_data(client, reg, count, in rv8803_write_regs()
140 dev_err(&client->dev, in rv8803_write_regs()
151 ret = rv8803_write_reg(rv8803->client, RV8803_OSC_OFFSET, 0x00); in rv8803_regs_init()
155 ret = rv8803_write_reg(rv8803->client, RV8803_CTRL, in rv8803_regs_init()
160 ret = rv8803_write_regs(rv8803->client, RV8803_ALARM_MIN, 3, in rv8803_regs_init()
165 return rv8803_write_reg(rv8803->client, RV8803_RAM, 0x00); in rv8803_regs_init()
187 struct i2c_client *client = dev_id; in rv8803_handle_irq() local
188 struct rv8803_data *rv8803 = i2c_get_clientdata(client); in rv8803_handle_irq()
194 flags = rv8803_read_reg(client, RV8803_FLAG); in rv8803_handle_irq()
201 dev_warn(&client->dev, "Voltage low, temperature compensation stopped.\n"); in rv8803_handle_irq()
204 dev_warn(&client->dev, "Voltage low, data loss detected.\n"); in rv8803_handle_irq()
226 rv8803_write_reg(client, RV8803_FLAG, flags); in rv8803_handle_irq()
227 rv8803_write_reg(rv8803->client, RV8803_CTRL, rv8803->ctrl); in rv8803_handle_irq()
248 flags = rv8803_read_reg(rv8803->client, RV8803_FLAG); in rv8803_get_time()
257 ret = rv8803_read_regs(rv8803->client, RV8803_SEC, 7, date); in rv8803_get_time()
262 ret = rv8803_read_regs(rv8803->client, RV8803_SEC, 7, date2); in rv8803_get_time()
287 ctrl = rv8803_read_reg(rv8803->client, RV8803_CTRL); in rv8803_set_time()
292 ret = rv8803_write_reg(rv8803->client, RV8803_CTRL, in rv8803_set_time()
305 ret = rv8803_write_regs(rv8803->client, RV8803_SEC, 7, date); in rv8803_set_time()
310 ret = rv8803_write_reg(rv8803->client, RV8803_CTRL, in rv8803_set_time()
317 flags = rv8803_read_reg(rv8803->client, RV8803_FLAG); in rv8803_set_time()
338 ret = rv8803_write_reg(rv8803->client, RV8803_FLAG, in rv8803_set_time()
349 struct i2c_client *client = rv8803->client; in rv8803_get_alarm() local
353 ret = rv8803_read_regs(client, RV8803_ALARM_MIN, 3, alarmvals); in rv8803_get_alarm()
357 flags = rv8803_read_reg(client, RV8803_FLAG); in rv8803_get_alarm()
392 struct i2c_client *client = to_i2c_client(dev); in rv8803_set_alarm() local
408 ret = rv8803_read_regs(client, RV8803_FLAG, 2, ctrl); in rv8803_set_alarm()
420 err = rv8803_write_reg(rv8803->client, RV8803_CTRL, in rv8803_set_alarm()
429 err = rv8803_write_reg(rv8803->client, RV8803_FLAG, ctrl[0]); in rv8803_set_alarm()
434 err = rv8803_write_regs(rv8803->client, RV8803_ALARM_MIN, 3, alarmvals); in rv8803_set_alarm()
444 err = rv8803_write_reg(rv8803->client, RV8803_CTRL, in rv8803_set_alarm()
455 struct i2c_client *client = to_i2c_client(dev); in rv8803_alarm_irq_enable() local
474 flags = rv8803_read_reg(client, RV8803_FLAG); in rv8803_alarm_irq_enable()
480 err = rv8803_write_reg(client, RV8803_FLAG, flags); in rv8803_alarm_irq_enable()
487 err = rv8803_write_reg(client, RV8803_CTRL, rv8803->ctrl); in rv8803_alarm_irq_enable()
497 struct i2c_client *client = to_i2c_client(dev); in rv8803_ioctl() local
504 flags = rv8803_read_reg(client, RV8803_FLAG); in rv8803_ioctl()
509 dev_warn(&client->dev, "Voltage low, temperature compensation stopped.\n"); in rv8803_ioctl()
520 flags = rv8803_read_reg(client, RV8803_FLAG); in rv8803_ioctl()
527 ret = rv8803_write_reg(client, RV8803_FLAG, flags); in rv8803_ioctl()
570 struct i2c_client *client = rv8803->client; in rx8900_trickle_charger_init() local
571 struct device_node *node = client->dev.of_node; in rx8900_trickle_charger_init()
581 err = i2c_smbus_read_byte_data(rv8803->client, RX8900_BACKUP_CTRL); in rx8900_trickle_charger_init()
589 return i2c_smbus_write_byte_data(rv8803->client, RX8900_BACKUP_CTRL, in rx8900_trickle_charger_init()
598 err = rv8803_write_reg(rv8803->client, RV8803_EXT, RV8803_EXT_WADA); in rv8803_regs_configure()
604 dev_err(&rv8803->client->dev, "failed to init charger\n"); in rv8803_regs_configure()
615 if (rv8803->client->irq > 0 && device_may_wakeup(dev)) in rv8803_resume()
616 disable_irq_wake(rv8803->client->irq); in rv8803_resume()
625 if (rv8803->client->irq > 0 && device_may_wakeup(dev)) in rv8803_suspend()
626 enable_irq_wake(rv8803->client->irq); in rv8803_suspend()
642 static int rv8803_probe(struct i2c_client *client) in rv8803_probe() argument
644 struct i2c_adapter *adapter = client->adapter; in rv8803_probe()
654 .priv = client, in rv8803_probe()
663 rv8803 = devm_kzalloc(&client->dev, sizeof(struct rv8803_data), in rv8803_probe()
669 rv8803->client = client; in rv8803_probe()
670 if (client->dev.of_node) { in rv8803_probe()
671 rv8803->type = (uintptr_t)of_device_get_match_data(&client->dev); in rv8803_probe()
673 const struct i2c_device_id *id = i2c_match_id(rv8803_id, client); in rv8803_probe()
677 i2c_set_clientdata(client, rv8803); in rv8803_probe()
679 flags = rv8803_read_reg(client, RV8803_FLAG); in rv8803_probe()
684 dev_warn(&client->dev, "Voltage low, temperature compensation stopped.\n"); in rv8803_probe()
687 dev_warn(&client->dev, "Voltage low, data loss detected.\n"); in rv8803_probe()
690 dev_warn(&client->dev, "An alarm maybe have been missed.\n"); in rv8803_probe()
692 rv8803->rtc = devm_rtc_allocate_device(&client->dev); in rv8803_probe()
696 if (client->irq > 0) { in rv8803_probe()
699 if (dev_fwnode(&client->dev)) in rv8803_probe()
702 err = devm_request_threaded_irq(&client->dev, client->irq, in rv8803_probe()
705 "rv8803", client); in rv8803_probe()
707 dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n"); in rv8803_probe()
708 client->irq = 0; in rv8803_probe()
710 device_init_wakeup(&client->dev, true); in rv8803_probe()
711 err = dev_pm_set_wake_irq(&client->dev, client->irq); in rv8803_probe()
713 dev_err(&client->dev, "failed to set wake IRQ\n"); in rv8803_probe()
716 if (device_property_read_bool(&client->dev, "wakeup-source")) in rv8803_probe()
717 device_init_wakeup(&client->dev, true); in rv8803_probe()
722 if (of_property_read_bool(client->dev.of_node, "epson,vdet-disable")) in rv8803_probe()
725 if (of_property_read_bool(client->dev.of_node, "trickle-diode-disable")) in rv8803_probe()