Lines Matching refs:client
41 struct i2c_client *client; member
58 static int adp5588_read(struct i2c_client *client, u8 reg) in adp5588_read() argument
60 int ret = i2c_smbus_read_byte_data(client, reg); in adp5588_read()
63 dev_err(&client->dev, "Read Error\n"); in adp5588_read()
68 static int adp5588_write(struct i2c_client *client, u8 reg, u8 val) in adp5588_write() argument
70 return i2c_smbus_write_byte_data(client, reg, val); in adp5588_write()
86 val = adp5588_read(kpad->client, GPIO_DAT_STAT1 + bank); in adp5588_gpio_get_value()
107 adp5588_write(kpad->client, GPIO_DAT_OUT1 + bank, in adp5588_gpio_set_value()
123 ret = adp5588_write(kpad->client, GPIO_DIR1 + bank, kpad->dir[bank]); in adp5588_gpio_direction_input()
147 ret = adp5588_write(kpad->client, GPIO_DAT_OUT1 + bank, in adp5588_gpio_direction_output()
149 ret |= adp5588_write(kpad->client, GPIO_DIR1 + bank, in adp5588_gpio_direction_output()
184 struct device *dev = &kpad->client->dev; in adp5588_gpio_add()
207 kpad->gc.label = kpad->client->name; in adp5588_gpio_add()
220 kpad->dat_out[i] = adp5588_read(kpad->client, in adp5588_gpio_add()
222 kpad->dir[i] = adp5588_read(kpad->client, GPIO_DIR1 + i); in adp5588_gpio_add()
226 error = gpio_data->setup(kpad->client, in adp5588_gpio_add()
238 struct device *dev = &kpad->client->dev; in adp5588_gpio_remove()
247 error = gpio_data->teardown(kpad->client, in adp5588_gpio_remove()
272 int key = adp5588_read(kpad->client, Key_EVENTA + i); in adp5588_report_events()
296 struct i2c_client *client = kpad->client; in adp5588_work() local
299 status = adp5588_read(client, INT_STAT); in adp5588_work()
302 dev_err(&client->dev, "Event Overflow Error\n"); in adp5588_work()
305 ev_cnt = adp5588_read(client, KEY_LCK_EC_STAT) & ADP5588_KEC; in adp5588_work()
311 adp5588_write(client, INT_STAT, status); /* Status is W1C */ in adp5588_work()
329 static int adp5588_setup(struct i2c_client *client) in adp5588_setup() argument
332 dev_get_platdata(&client->dev); in adp5588_setup()
337 ret = adp5588_write(client, KP_GPIO1, KP_SEL(pdata->rows)); in adp5588_setup()
338 ret |= adp5588_write(client, KP_GPIO2, KP_SEL(pdata->cols) & 0xFF); in adp5588_setup()
339 ret |= adp5588_write(client, KP_GPIO3, KP_SEL(pdata->cols) >> 8); in adp5588_setup()
342 ret |= adp5588_write(client, UNLOCK1, pdata->unlock_key1); in adp5588_setup()
343 ret |= adp5588_write(client, UNLOCK2, pdata->unlock_key2); in adp5588_setup()
344 ret |= adp5588_write(client, KEY_LCK_EC_STAT, ADP5588_K_LCK_EN); in adp5588_setup()
348 ret |= adp5588_read(client, Key_EVENTA); in adp5588_setup()
362 ret |= adp5588_write(client, GPI_EM1, evt_mode1); in adp5588_setup()
363 ret |= adp5588_write(client, GPI_EM2, evt_mode2); in adp5588_setup()
364 ret |= adp5588_write(client, GPI_EM3, evt_mode3); in adp5588_setup()
371 ret |= adp5588_write(client, GPIO_PULL1 + i, in adp5588_setup()
376 ret |= adp5588_write(client, INT_STAT, in adp5588_setup()
381 ret |= adp5588_write(client, CFG, ADP5588_INT_CFG | in adp5588_setup()
386 dev_err(&client->dev, "Write Error\n"); in adp5588_setup()
395 int gpi_stat1 = adp5588_read(kpad->client, GPIO_DAT_STAT1); in adp5588_report_switch_state()
396 int gpi_stat2 = adp5588_read(kpad->client, GPIO_DAT_STAT2); in adp5588_report_switch_state()
397 int gpi_stat3 = adp5588_read(kpad->client, GPIO_DAT_STAT3); in adp5588_report_switch_state()
416 dev_err(&kpad->client->dev, in adp5588_report_switch_state()
431 static int adp5588_probe(struct i2c_client *client, in adp5588_probe() argument
436 dev_get_platdata(&client->dev); in adp5588_probe()
442 if (!i2c_check_functionality(client->adapter, in adp5588_probe()
444 dev_err(&client->dev, "SMBUS Byte Data not Supported\n"); in adp5588_probe()
449 dev_err(&client->dev, "no platform data?\n"); in adp5588_probe()
454 dev_err(&client->dev, "no rows, cols or keymap from pdata\n"); in adp5588_probe()
459 dev_err(&client->dev, "invalid keymapsize\n"); in adp5588_probe()
464 dev_err(&client->dev, "invalid gpimap from pdata\n"); in adp5588_probe()
469 dev_err(&client->dev, "invalid gpimapsize\n"); in adp5588_probe()
477 dev_err(&client->dev, "invalid gpi pin data\n"); in adp5588_probe()
483 dev_err(&client->dev, "invalid gpi row data\n"); in adp5588_probe()
488 dev_err(&client->dev, "invalid gpi col data\n"); in adp5588_probe()
494 if (!client->irq) { in adp5588_probe()
495 dev_err(&client->dev, "no IRQ?\n"); in adp5588_probe()
506 kpad->client = client; in adp5588_probe()
510 ret = adp5588_read(client, DEV_ID); in adp5588_probe()
520 input->name = client->name; in adp5588_probe()
522 input->dev.parent = &client->dev; in adp5588_probe()
559 dev_err(&client->dev, "unable to register input device\n"); in adp5588_probe()
563 error = request_irq(client->irq, adp5588_irq, in adp5588_probe()
565 client->dev.driver->name, kpad); in adp5588_probe()
567 dev_err(&client->dev, "irq %d busy?\n", client->irq); in adp5588_probe()
571 error = adp5588_setup(client); in adp5588_probe()
582 device_init_wakeup(&client->dev, 1); in adp5588_probe()
583 i2c_set_clientdata(client, kpad); in adp5588_probe()
585 dev_info(&client->dev, "Rev.%d keypad, irq %d\n", revid, client->irq); in adp5588_probe()
589 free_irq(client->irq, kpad); in adp5588_probe()
601 static int adp5588_remove(struct i2c_client *client) in adp5588_remove() argument
603 struct adp5588_kpad *kpad = i2c_get_clientdata(client); in adp5588_remove()
605 adp5588_write(client, CFG, 0); in adp5588_remove()
606 free_irq(client->irq, kpad); in adp5588_remove()
619 struct i2c_client *client = kpad->client; in adp5588_suspend() local
621 disable_irq(client->irq); in adp5588_suspend()
624 if (device_may_wakeup(&client->dev)) in adp5588_suspend()
625 enable_irq_wake(client->irq); in adp5588_suspend()
633 struct i2c_client *client = kpad->client; in adp5588_resume() local
635 if (device_may_wakeup(&client->dev)) in adp5588_resume()
636 disable_irq_wake(client->irq); in adp5588_resume()
638 enable_irq(client->irq); in adp5588_resume()