Lines Matching refs:client
31 struct i2c_client *client; member
46 static int adp5588_gpio_read(struct i2c_client *client, u8 reg) in adp5588_gpio_read() argument
48 int ret = i2c_smbus_read_byte_data(client, reg); in adp5588_gpio_read()
51 dev_err(&client->dev, "Read Error\n"); in adp5588_gpio_read()
56 static int adp5588_gpio_write(struct i2c_client *client, u8 reg, u8 val) in adp5588_gpio_write() argument
58 int ret = i2c_smbus_write_byte_data(client, reg, val); in adp5588_gpio_write()
61 dev_err(&client->dev, "Write Error\n"); in adp5588_gpio_write()
79 val = adp5588_gpio_read(dev->client, GPIO_DAT_STAT1 + bank); in adp5588_gpio_get_value()
102 adp5588_gpio_write(dev->client, GPIO_DAT_OUT1 + bank, in adp5588_gpio_set_value()
118 ret = adp5588_gpio_write(dev->client, GPIO_DIR1 + bank, dev->dir[bank]); in adp5588_gpio_direction_input()
143 ret = adp5588_gpio_write(dev->client, GPIO_DAT_OUT1 + bank, in adp5588_gpio_direction_output()
145 ret |= adp5588_gpio_write(dev->client, GPIO_DIR1 + bank, in adp5588_gpio_direction_output()
183 adp5588_gpio_write(dev->client, GPIO_INT_EN1 + i, in adp5588_irq_bus_sync_unlock()
213 dev_err(&dev->client->dev, "irq %d: unsupported type %d\n", in adp5588_irq_set_type()
229 adp5588_gpio_write(dev->client, GPIO_INT_LVL1 + bank, in adp5588_irq_set_type()
244 static int adp5588_gpio_read_intstat(struct i2c_client *client, u8 *buf) in adp5588_gpio_read_intstat() argument
246 int ret = i2c_smbus_read_i2c_block_data(client, GPIO_INT_STAT1, 3, buf); in adp5588_gpio_read_intstat()
249 dev_err(&client->dev, "Read INT_STAT Error\n"); in adp5588_gpio_read_intstat()
259 status = adp5588_gpio_read(dev->client, INT_STAT); in adp5588_irq_handler()
262 ret = adp5588_gpio_read_intstat(dev->client, dev->irq_stat); in adp5588_irq_handler()
282 adp5588_gpio_write(dev->client, INT_STAT, status); /* Status is W1C */ in adp5588_irq_handler()
289 struct i2c_client *client = dev->client; in adp5588_irq_setup() local
291 dev_get_platdata(&client->dev); in adp5588_irq_setup()
295 adp5588_gpio_write(client, CFG, ADP5588_AUTO_INC); in adp5588_irq_setup()
296 adp5588_gpio_write(client, INT_STAT, -1); /* status is W1C */ in adp5588_irq_setup()
297 adp5588_gpio_read_intstat(client, dev->irq_stat); /* read to clear */ in adp5588_irq_setup()
311 ret = request_threaded_irq(client->irq, in adp5588_irq_setup()
315 dev_name(&client->dev), dev); in adp5588_irq_setup()
317 dev_err(&client->dev, "failed to request irq %d\n", in adp5588_irq_setup()
318 client->irq); in adp5588_irq_setup()
323 adp5588_gpio_write(client, CFG, in adp5588_irq_setup()
336 free_irq(dev->client->irq, dev); in adp5588_irq_teardown()
342 struct i2c_client *client = dev->client; in adp5588_irq_setup() local
343 dev_warn(&client->dev, "interrupt support not compiled in\n"); in adp5588_irq_setup()
353 static int adp5588_gpio_probe(struct i2c_client *client, in adp5588_gpio_probe() argument
357 dev_get_platdata(&client->dev); in adp5588_gpio_probe()
363 dev_err(&client->dev, "missing platform data\n"); in adp5588_gpio_probe()
367 if (!i2c_check_functionality(client->adapter, in adp5588_gpio_probe()
369 dev_err(&client->dev, "SMBUS Byte Data not Supported\n"); in adp5588_gpio_probe()
373 dev = devm_kzalloc(&client->dev, sizeof(*dev), GFP_KERNEL); in adp5588_gpio_probe()
377 dev->client = client; in adp5588_gpio_probe()
388 gc->label = client->name; in adp5588_gpio_probe()
394 ret = adp5588_gpio_read(dev->client, DEV_ID); in adp5588_gpio_probe()
401 dev->dat_out[i] = adp5588_gpio_read(client, GPIO_DAT_OUT1 + i); in adp5588_gpio_probe()
402 dev->dir[i] = adp5588_gpio_read(client, GPIO_DIR1 + i); in adp5588_gpio_probe()
403 ret |= adp5588_gpio_write(client, KP_GPIO1 + i, 0); in adp5588_gpio_probe()
404 ret |= adp5588_gpio_write(client, GPIO_PULL1 + i, in adp5588_gpio_probe()
406 ret |= adp5588_gpio_write(client, GPIO_INT_EN1 + i, 0); in adp5588_gpio_probe()
413 dev_warn(&client->dev, "GPIO int not supported\n"); in adp5588_gpio_probe()
425 dev_info(&client->dev, "IRQ Base: %d Rev.: %d\n", in adp5588_gpio_probe()
429 ret = pdata->setup(client, gc->base, gc->ngpio, pdata->context); in adp5588_gpio_probe()
431 dev_warn(&client->dev, "setup failed, %d\n", ret); in adp5588_gpio_probe()
434 i2c_set_clientdata(client, dev); in adp5588_gpio_probe()
444 static int adp5588_gpio_remove(struct i2c_client *client) in adp5588_gpio_remove() argument
447 dev_get_platdata(&client->dev); in adp5588_gpio_remove()
448 struct adp5588_gpio *dev = i2c_get_clientdata(client); in adp5588_gpio_remove()
452 ret = pdata->teardown(client, in adp5588_gpio_remove()
456 dev_err(&client->dev, "teardown failed %d\n", ret); in adp5588_gpio_remove()
462 free_irq(dev->client->irq, dev); in adp5588_gpio_remove()