Lines Matching refs:client

60 		dev_printk(KERN_DEBUG, &(ihid)->client->dev, fmt, ##arg); \
130 struct i2c_client *client; /* i2c client */ member
154 static int __i2c_hid_command(struct i2c_client *client, in __i2c_hid_command() argument
159 struct i2c_hid *ihid = i2c_get_clientdata(client); in __i2c_hid_command()
187 msg[0].addr = client->addr; in __i2c_hid_command()
188 msg[0].flags = client->flags & I2C_M_TEN; in __i2c_hid_command()
192 msg[1].addr = client->addr; in __i2c_hid_command()
193 msg[1].flags = client->flags & I2C_M_TEN; in __i2c_hid_command()
204 ret = i2c_transfer(client->adapter, msg, msg_num); in __i2c_hid_command()
226 static int i2c_hid_command(struct i2c_client *client, in i2c_hid_command() argument
230 return __i2c_hid_command(client, command, 0, 0, NULL, 0, in i2c_hid_command()
234 static int i2c_hid_get_report(struct i2c_client *client, u8 reportType, in i2c_hid_get_report() argument
237 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_get_report()
253 ret = __i2c_hid_command(client, &hid_get_report_cmd, reportID, in i2c_hid_get_report()
256 dev_err(&client->dev, in i2c_hid_get_report()
273 static int i2c_hid_set_or_send_report(struct i2c_client *client, u8 reportType, in i2c_hid_set_or_send_report() argument
276 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_set_or_send_report()
329 ret = __i2c_hid_command(client, hidcmd, reportID, in i2c_hid_set_or_send_report()
332 dev_err(&client->dev, "failed to set a report to device.\n"); in i2c_hid_set_or_send_report()
339 static int i2c_hid_set_power(struct i2c_client *client, int power_state) in i2c_hid_set_power() argument
341 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_set_power()
346 ret = __i2c_hid_command(client, &hid_set_power_cmd, power_state, in i2c_hid_set_power()
349 dev_err(&client->dev, "failed to change power setting.\n"); in i2c_hid_set_power()
354 static int i2c_hid_hwreset(struct i2c_client *client) in i2c_hid_hwreset() argument
356 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_hwreset()
361 ret = i2c_hid_set_power(client, I2C_HID_PWR_ON); in i2c_hid_hwreset()
367 ret = i2c_hid_command(client, &hid_reset_cmd, NULL, 0); in i2c_hid_hwreset()
369 dev_err(&client->dev, "failed to reset device.\n"); in i2c_hid_hwreset()
370 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP); in i2c_hid_hwreset()
385 ret = i2c_master_recv(ihid->client, ihid->inbuf, size); in i2c_hid_get_input()
390 dev_err(&ihid->client->dev, "%s: got %d data instead of %d\n", in i2c_hid_get_input()
405 dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n", in i2c_hid_get_input()
441 struct i2c_client *client = hid->driver_data; in i2c_hid_init_report() local
442 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_init_report()
446 if (i2c_hid_get_report(client, in i2c_hid_init_report()
456 dev_err(&client->dev, "error in %s size:%d / ret_size:%d\n", in i2c_hid_init_report()
473 struct i2c_client *client = hid->driver_data; in i2c_hid_init_reports() local
474 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_init_reports()
478 dev_err(&client->dev, "can not retrieve initial reports\n"); in i2c_hid_init_reports()
486 pm_runtime_get_sync(&client->dev); in i2c_hid_init_reports()
492 pm_runtime_put(&client->dev); in i2c_hid_init_reports()
556 struct i2c_client *client = hid->driver_data; in i2c_hid_get_raw_report() local
557 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_get_raw_report()
567 ret = i2c_hid_get_report(client, in i2c_hid_get_raw_report()
591 struct i2c_client *client = hid->driver_data; in i2c_hid_output_raw_report() local
603 ret = i2c_hid_set_or_send_report(client, in i2c_hid_output_raw_report()
638 struct i2c_client *client = hid->driver_data; in i2c_hid_parse() local
639 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_parse()
655 ret = i2c_hid_hwreset(client); in i2c_hid_parse()
672 ret = i2c_hid_command(client, &hid_report_descr_cmd, rdesc, rsize); in i2c_hid_parse()
693 struct i2c_client *client = hid->driver_data; in i2c_hid_start() local
694 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_start()
724 struct i2c_client *client = hid->driver_data; in i2c_hid_open() local
725 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_open()
730 ret = pm_runtime_get_sync(&client->dev); in i2c_hid_open()
744 struct i2c_client *client = hid->driver_data; in i2c_hid_close() local
745 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_close()
756 pm_runtime_put(&client->dev); in i2c_hid_close()
763 struct i2c_client *client = hid->driver_data; in i2c_hid_power() local
764 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_power()
770 pm_runtime_get_sync(&client->dev); in i2c_hid_power()
773 pm_runtime_put(&client->dev); in i2c_hid_power()
790 static int i2c_hid_init_irq(struct i2c_client *client) in i2c_hid_init_irq() argument
792 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_init_irq()
795 dev_dbg(&client->dev, "Requesting IRQ: %d\n", ihid->irq); in i2c_hid_init_irq()
799 client->name, ihid); in i2c_hid_init_irq()
801 dev_warn(&client->dev, in i2c_hid_init_irq()
804 client->name, ihid->irq, ret); in i2c_hid_init_irq()
814 struct i2c_client *client = ihid->client; in i2c_hid_fetch_hid_descriptor() local
821 ret = i2c_hid_command(client, &hid_descr_cmd, ihid->hdesc_buffer, in i2c_hid_fetch_hid_descriptor()
824 dev_err(&client->dev, "hid_descr_cmd failed\n"); in i2c_hid_fetch_hid_descriptor()
833 dev_err(&client->dev, in i2c_hid_fetch_hid_descriptor()
842 dev_err(&client->dev, "weird size of HID descriptor (%u)\n", in i2c_hid_fetch_hid_descriptor()
859 static int i2c_hid_acpi_pdata(struct i2c_client *client, in i2c_hid_acpi_pdata() argument
871 handle = ACPI_HANDLE(&client->dev); in i2c_hid_acpi_pdata()
878 dev_err(&client->dev, "device _DSM execution failed\n"); in i2c_hid_acpi_pdata()
897 static inline int i2c_hid_acpi_pdata(struct i2c_client *client, in i2c_hid_acpi_pdata() argument
905 static int i2c_hid_of_probe(struct i2c_client *client, in i2c_hid_of_probe() argument
908 struct device *dev = &client->dev; in i2c_hid_of_probe()
914 dev_err(&client->dev, "HID register address not provided\n"); in i2c_hid_of_probe()
918 dev_err(&client->dev, "Bad HID register address: 0x%08x\n", in i2c_hid_of_probe()
933 static inline int i2c_hid_of_probe(struct i2c_client *client, in i2c_hid_of_probe() argument
940 static int i2c_hid_probe(struct i2c_client *client, in i2c_hid_probe() argument
947 struct i2c_hid_platform_data *platform_data = client->dev.platform_data; in i2c_hid_probe()
949 dbg_hid("HID probe called for i2c 0x%02x\n", client->addr); in i2c_hid_probe()
955 if (client->dev.of_node) { in i2c_hid_probe()
956 ret = i2c_hid_of_probe(client, &ihid->pdata); in i2c_hid_probe()
960 ret = i2c_hid_acpi_pdata(client, &ihid->pdata); in i2c_hid_probe()
962 dev_err(&client->dev, in i2c_hid_probe()
970 if (client->irq > 0) { in i2c_hid_probe()
971 ihid->irq = client->irq; in i2c_hid_probe()
972 } else if (ACPI_COMPANION(&client->dev)) { in i2c_hid_probe()
973 ihid->desc = gpiod_get(&client->dev, NULL, GPIOD_IN); in i2c_hid_probe()
975 dev_err(&client->dev, "Failed to get GPIO interrupt\n"); in i2c_hid_probe()
982 dev_err(&client->dev, "Failed to convert GPIO to IRQ\n"); in i2c_hid_probe()
987 i2c_set_clientdata(client, ihid); in i2c_hid_probe()
989 ihid->client = client; in i2c_hid_probe()
1003 pm_runtime_get_noresume(&client->dev); in i2c_hid_probe()
1004 pm_runtime_set_active(&client->dev); in i2c_hid_probe()
1005 pm_runtime_enable(&client->dev); in i2c_hid_probe()
1011 ret = i2c_hid_init_irq(client); in i2c_hid_probe()
1023 hid->driver_data = client; in i2c_hid_probe()
1025 hid->dev.parent = &client->dev; in i2c_hid_probe()
1026 ACPI_COMPANION_SET(&hid->dev, ACPI_COMPANION(&client->dev)); in i2c_hid_probe()
1033 client->name, hid->vendor, hid->product); in i2c_hid_probe()
1038 hid_err(client, "can't add hid device: %d\n", ret); in i2c_hid_probe()
1042 pm_runtime_put(&client->dev); in i2c_hid_probe()
1052 pm_runtime_put_noidle(&client->dev); in i2c_hid_probe()
1053 pm_runtime_disable(&client->dev); in i2c_hid_probe()
1064 static int i2c_hid_remove(struct i2c_client *client) in i2c_hid_remove() argument
1066 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_remove()
1069 pm_runtime_get_sync(&client->dev); in i2c_hid_remove()
1070 pm_runtime_disable(&client->dev); in i2c_hid_remove()
1071 pm_runtime_set_suspended(&client->dev); in i2c_hid_remove()
1072 pm_runtime_put_noidle(&client->dev); in i2c_hid_remove()
1087 acpi_dev_remove_driver_gpios(ACPI_COMPANION(&client->dev)); in i2c_hid_remove()
1095 struct i2c_client *client = to_i2c_client(dev); in i2c_hid_suspend() local
1096 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_suspend()
1101 if (device_may_wakeup(&client->dev)) in i2c_hid_suspend()
1108 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP); in i2c_hid_suspend()
1116 struct i2c_client *client = to_i2c_client(dev); in i2c_hid_resume() local
1117 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_resume()
1121 ret = i2c_hid_hwreset(client); in i2c_hid_resume()
1125 if (device_may_wakeup(&client->dev)) in i2c_hid_resume()
1140 struct i2c_client *client = to_i2c_client(dev); in i2c_hid_runtime_suspend() local
1141 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_runtime_suspend()
1143 i2c_hid_set_power(client, I2C_HID_PWR_SLEEP); in i2c_hid_runtime_suspend()
1150 struct i2c_client *client = to_i2c_client(dev); in i2c_hid_runtime_resume() local
1151 struct i2c_hid *ihid = i2c_get_clientdata(client); in i2c_hid_runtime_resume()
1154 i2c_hid_set_power(client, I2C_HID_PWR_ON); in i2c_hid_runtime_resume()