Lines Matching refs:client

60 		dev_printk(KERN_DEBUG, &(ihid)->client->dev, fmt, ##arg); \
130 struct i2c_client *client; /* i2c client */ member
156 static int __i2c_hid_command(struct i2c_client *client, in __i2c_hid_command() argument
161 struct i2c_hid *ihid = i2c_get_clientdata(client); in __i2c_hid_command()
189 msg[0].addr = client->addr; in __i2c_hid_command()
190 msg[0].flags = client->flags & I2C_M_TEN; in __i2c_hid_command()
194 msg[1].addr = client->addr; in __i2c_hid_command()
195 msg[1].flags = client->flags & I2C_M_TEN; in __i2c_hid_command()
206 ret = i2c_transfer(client->adapter, msg, msg_num); in __i2c_hid_command()
228 static int i2c_hid_command(struct i2c_client *client, in i2c_hid_command() argument
232 return __i2c_hid_command(client, command, 0, 0, NULL, 0, in i2c_hid_command()
236 static int i2c_hid_get_report(struct i2c_client *client, u8 reportType, in i2c_hid_get_report() argument
239 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_get_report()
255 ret = __i2c_hid_command(client, &hid_get_report_cmd, reportID, in i2c_hid_get_report()
258 dev_err(&client->dev, in i2c_hid_get_report()
275 static int i2c_hid_set_or_send_report(struct i2c_client *client, u8 reportType, in i2c_hid_set_or_send_report() argument
278 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_set_or_send_report()
331 ret = __i2c_hid_command(client, hidcmd, reportID, in i2c_hid_set_or_send_report()
334 dev_err(&client->dev, "failed to set a report to device.\n"); in i2c_hid_set_or_send_report()
341 static int i2c_hid_set_power(struct i2c_client *client, int power_state) in i2c_hid_set_power() argument
343 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_set_power()
348 ret = __i2c_hid_command(client, &hid_set_power_cmd, power_state, in i2c_hid_set_power()
351 dev_err(&client->dev, "failed to change power setting.\n"); in i2c_hid_set_power()
356 static int i2c_hid_hwreset(struct i2c_client *client) in i2c_hid_hwreset() argument
358 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_hwreset()
363 ret = i2c_hid_set_power(client, I2C_HID_PWR_ON); in i2c_hid_hwreset()
369 ret = i2c_hid_command(client, &hid_reset_cmd, NULL, 0); in i2c_hid_hwreset()
371 dev_err(&client->dev, "failed to reset device.\n"); in i2c_hid_hwreset()
372 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP); in i2c_hid_hwreset()
387 ret = i2c_master_recv(ihid->client, ihid->inbuf, size); in i2c_hid_get_input()
392 dev_err(&ihid->client->dev, "%s: got %d data instead of %d\n", in i2c_hid_get_input()
407 dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n", in i2c_hid_get_input()
443 struct i2c_client *client = hid->driver_data; in i2c_hid_init_report() local
444 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_init_report()
448 if (i2c_hid_get_report(client, in i2c_hid_init_report()
458 dev_err(&client->dev, "error in %s size:%d / ret_size:%d\n", in i2c_hid_init_report()
475 struct i2c_client *client = hid->driver_data; in i2c_hid_init_reports() local
476 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_init_reports()
480 dev_err(&client->dev, "can not retrieve initial reports\n"); in i2c_hid_init_reports()
488 pm_runtime_get_sync(&client->dev); in i2c_hid_init_reports()
494 pm_runtime_put(&client->dev); in i2c_hid_init_reports()
558 struct i2c_client *client = hid->driver_data; in i2c_hid_get_raw_report() local
559 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_get_raw_report()
569 ret = i2c_hid_get_report(client, in i2c_hid_get_raw_report()
593 struct i2c_client *client = hid->driver_data; in i2c_hid_output_raw_report() local
605 ret = i2c_hid_set_or_send_report(client, in i2c_hid_output_raw_report()
640 struct i2c_client *client = hid->driver_data; in i2c_hid_parse() local
641 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_parse()
657 ret = i2c_hid_hwreset(client); in i2c_hid_parse()
674 ret = i2c_hid_command(client, &hid_report_descr_cmd, rdesc, rsize); in i2c_hid_parse()
695 struct i2c_client *client = hid->driver_data; in i2c_hid_start() local
696 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_start()
726 struct i2c_client *client = hid->driver_data; in i2c_hid_open() local
727 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_open()
732 ret = pm_runtime_get_sync(&client->dev); in i2c_hid_open()
746 struct i2c_client *client = hid->driver_data; in i2c_hid_close() local
747 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_close()
758 pm_runtime_put(&client->dev); in i2c_hid_close()
765 struct i2c_client *client = hid->driver_data; in i2c_hid_power() local
766 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_power()
772 pm_runtime_get_sync(&client->dev); in i2c_hid_power()
775 pm_runtime_put(&client->dev); in i2c_hid_power()
792 static int i2c_hid_init_irq(struct i2c_client *client) in i2c_hid_init_irq() argument
794 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_init_irq()
797 dev_dbg(&client->dev, "Requesting IRQ: %d\n", ihid->irq); in i2c_hid_init_irq()
801 client->name, ihid); in i2c_hid_init_irq()
803 dev_warn(&client->dev, in i2c_hid_init_irq()
806 client->name, ihid->irq, ret); in i2c_hid_init_irq()
816 struct i2c_client *client = ihid->client; in i2c_hid_fetch_hid_descriptor() local
823 ret = i2c_hid_command(client, &hid_descr_cmd, ihid->hdesc_buffer, in i2c_hid_fetch_hid_descriptor()
826 dev_err(&client->dev, "hid_descr_cmd failed\n"); in i2c_hid_fetch_hid_descriptor()
835 dev_err(&client->dev, in i2c_hid_fetch_hid_descriptor()
844 dev_err(&client->dev, "weird size of HID descriptor (%u)\n", in i2c_hid_fetch_hid_descriptor()
861 static int i2c_hid_acpi_pdata(struct i2c_client *client, in i2c_hid_acpi_pdata() argument
873 handle = ACPI_HANDLE(&client->dev); in i2c_hid_acpi_pdata()
880 dev_err(&client->dev, "device _DSM execution failed\n"); in i2c_hid_acpi_pdata()
899 static inline int i2c_hid_acpi_pdata(struct i2c_client *client, in i2c_hid_acpi_pdata() argument
907 static int i2c_hid_of_probe(struct i2c_client *client, in i2c_hid_of_probe() argument
910 struct device *dev = &client->dev; in i2c_hid_of_probe()
916 dev_err(&client->dev, "HID register address not provided\n"); in i2c_hid_of_probe()
920 dev_err(&client->dev, "Bad HID register address: 0x%08x\n", in i2c_hid_of_probe()
935 static inline int i2c_hid_of_probe(struct i2c_client *client, in i2c_hid_of_probe() argument
942 static int i2c_hid_probe(struct i2c_client *client, in i2c_hid_probe() argument
949 struct i2c_hid_platform_data *platform_data = client->dev.platform_data; in i2c_hid_probe()
951 dbg_hid("HID probe called for i2c 0x%02x\n", client->addr); in i2c_hid_probe()
957 if (client->dev.of_node) { in i2c_hid_probe()
958 ret = i2c_hid_of_probe(client, &ihid->pdata); in i2c_hid_probe()
962 ret = i2c_hid_acpi_pdata(client, &ihid->pdata); in i2c_hid_probe()
964 dev_err(&client->dev, in i2c_hid_probe()
972 if (client->irq > 0) { in i2c_hid_probe()
973 ihid->irq = client->irq; in i2c_hid_probe()
974 } else if (ACPI_COMPANION(&client->dev)) { in i2c_hid_probe()
975 ihid->desc = gpiod_get(&client->dev, NULL, GPIOD_IN); in i2c_hid_probe()
977 dev_err(&client->dev, "Failed to get GPIO interrupt\n"); in i2c_hid_probe()
984 dev_err(&client->dev, "Failed to convert GPIO to IRQ\n"); in i2c_hid_probe()
989 i2c_set_clientdata(client, ihid); in i2c_hid_probe()
991 ihid->client = client; in i2c_hid_probe()
1005 pm_runtime_get_noresume(&client->dev); in i2c_hid_probe()
1006 pm_runtime_set_active(&client->dev); in i2c_hid_probe()
1007 pm_runtime_enable(&client->dev); in i2c_hid_probe()
1013 ret = i2c_hid_init_irq(client); in i2c_hid_probe()
1025 hid->driver_data = client; in i2c_hid_probe()
1027 hid->dev.parent = &client->dev; in i2c_hid_probe()
1034 client->name, hid->vendor, hid->product); in i2c_hid_probe()
1035 strlcpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys)); in i2c_hid_probe()
1040 hid_err(client, "can't add hid device: %d\n", ret); in i2c_hid_probe()
1044 pm_runtime_put(&client->dev); in i2c_hid_probe()
1054 pm_runtime_put_noidle(&client->dev); in i2c_hid_probe()
1055 pm_runtime_disable(&client->dev); in i2c_hid_probe()
1066 static int i2c_hid_remove(struct i2c_client *client) in i2c_hid_remove() argument
1068 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_remove()
1071 pm_runtime_get_sync(&client->dev); in i2c_hid_remove()
1072 pm_runtime_disable(&client->dev); in i2c_hid_remove()
1073 pm_runtime_set_suspended(&client->dev); in i2c_hid_remove()
1074 pm_runtime_put_noidle(&client->dev); in i2c_hid_remove()
1089 acpi_dev_remove_driver_gpios(ACPI_COMPANION(&client->dev)); in i2c_hid_remove()
1097 struct i2c_client *client = to_i2c_client(dev); in i2c_hid_suspend() local
1098 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_suspend()
1107 if (device_may_wakeup(&client->dev)) { in i2c_hid_suspend()
1117 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP); in i2c_hid_suspend()
1125 struct i2c_client *client = to_i2c_client(dev); in i2c_hid_resume() local
1126 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_resume()
1131 ret = i2c_hid_hwreset(client); in i2c_hid_resume()
1135 if (device_may_wakeup(&client->dev) && ihid->irq_wake_enabled) { in i2c_hid_resume()
1156 struct i2c_client *client = to_i2c_client(dev); in i2c_hid_runtime_suspend() local
1157 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_runtime_suspend()
1159 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP); in i2c_hid_runtime_suspend()
1166 struct i2c_client *client = to_i2c_client(dev); in i2c_hid_runtime_resume() local
1167 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_runtime_resume()
1170 i2c_hid_set_power(client, I2C_HID_PWR_ON); in i2c_hid_runtime_resume()