Lines Matching refs:hdev

34 static int wacom_get_report(struct hid_device *hdev, u8 type, u8 *buf,  in wacom_get_report()  argument
40 retval = hid_hw_raw_request(hdev, buf[0], buf, size, type, in wacom_get_report()
45 hid_err(hdev, "wacom_get_report: ran out of retries " in wacom_get_report()
51 static int wacom_set_report(struct hid_device *hdev, u8 type, u8 *buf, in wacom_set_report() argument
57 retval = hid_hw_raw_request(hdev, buf[0], buf, size, type, in wacom_set_report()
62 hid_err(hdev, "wacom_set_report: ran out of retries " in wacom_set_report()
68 static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report, in wacom_raw_event() argument
71 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_raw_event()
87 return hid_hw_open(wacom->hdev); in wacom_open()
94 hid_hw_close(wacom->hdev); in wacom_close()
113 static void wacom_feature_mapping(struct hid_device *hdev, in wacom_feature_mapping() argument
116 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_feature_mapping()
131 ret = wacom_get_report(hdev, HID_FEATURE_REPORT, in wacom_feature_mapping()
137 hid_warn(hdev, "wacom_feature_mapping: " in wacom_feature_mapping()
148 dev_err(&hdev->dev, "HID_DG_INPUTMODE out of range\n"); in wacom_feature_mapping()
190 static void wacom_usage_mapping(struct hid_device *hdev, in wacom_usage_mapping() argument
193 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_usage_mapping()
250 wacom_wac_usage_mapping(hdev, field, usage); in wacom_usage_mapping()
253 static void wacom_post_parse_hid(struct hid_device *hdev, in wacom_post_parse_hid() argument
256 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_post_parse_hid()
268 static void wacom_parse_hid(struct hid_device *hdev, in wacom_parse_hid() argument
276 rep_enum = &hdev->report_enum[HID_FEATURE_REPORT]; in wacom_parse_hid()
284 wacom_feature_mapping(hdev, hreport->field[i], in wacom_parse_hid()
291 rep_enum = &hdev->report_enum[HID_INPUT_REPORT]; in wacom_parse_hid()
299 wacom_usage_mapping(hdev, hreport->field[i], in wacom_parse_hid()
303 wacom_post_parse_hid(hdev, features); in wacom_parse_hid()
306 static int wacom_hid_set_device_mode(struct hid_device *hdev) in wacom_hid_set_device_mode() argument
308 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_hid_set_device_mode()
316 re = &(hdev->report_enum[HID_FEATURE_REPORT]); in wacom_hid_set_device_mode()
320 hid_hw_request(hdev, r, HID_REQ_SET_REPORT); in wacom_hid_set_device_mode()
325 static int wacom_set_device_mode(struct hid_device *hdev, int report_id, in wacom_set_device_mode() argument
339 error = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, in wacom_set_device_mode()
342 error = wacom_get_report(hdev, HID_FEATURE_REPORT, in wacom_set_device_mode()
351 static int wacom_bt_query_tablet_data(struct hid_device *hdev, u8 speed, in wacom_bt_query_tablet_data() argument
354 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_bt_query_tablet_data()
362 ret = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, 2, in wacom_bt_query_tablet_data()
369 ret = wacom_set_report(hdev, HID_FEATURE_REPORT, in wacom_bt_query_tablet_data()
382 hid_warn(hdev, "failed to poke device, command %d, err %d\n", in wacom_bt_query_tablet_data()
394 ret = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, 2, in wacom_bt_query_tablet_data()
411 static int wacom_query_tablet_data(struct hid_device *hdev, in wacom_query_tablet_data() argument
414 if (hdev->bus == BUS_BLUETOOTH) in wacom_query_tablet_data()
415 return wacom_bt_query_tablet_data(hdev, 1, features); in wacom_query_tablet_data()
418 return wacom_hid_set_device_mode(hdev); in wacom_query_tablet_data()
423 return wacom_set_device_mode(hdev, 3, 4, 4); in wacom_query_tablet_data()
426 return wacom_set_device_mode(hdev, 18, 3, 2); in wacom_query_tablet_data()
429 return wacom_set_device_mode(hdev, 131, 3, 2); in wacom_query_tablet_data()
432 return wacom_set_device_mode(hdev, 2, 2, 2); in wacom_query_tablet_data()
436 return wacom_set_device_mode(hdev, 2, 2, 2); in wacom_query_tablet_data()
443 static void wacom_retrieve_hid_descriptor(struct hid_device *hdev, in wacom_retrieve_hid_descriptor() argument
446 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_retrieve_hid_descriptor()
469 wacom_parse_hid(hdev, features); in wacom_retrieve_hid_descriptor()
482 static bool wacom_are_sibling(struct hid_device *hdev, in wacom_are_sibling() argument
485 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_are_sibling()
492 vid = hdev->vendor; in wacom_are_sibling()
493 pid = hdev->product; in wacom_are_sibling()
500 n1 = strrchr(hdev->phys, '.') - hdev->phys; in wacom_are_sibling()
505 return !strncmp(hdev->phys, sibling->phys, n1); in wacom_are_sibling()
508 static struct wacom_hdev_data *wacom_get_hdev_data(struct hid_device *hdev) in wacom_get_hdev_data() argument
513 if (wacom_are_sibling(hdev, data->dev)) { in wacom_get_hdev_data()
522 static int wacom_add_shared_data(struct hid_device *hdev) in wacom_add_shared_data() argument
524 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_add_shared_data()
531 data = wacom_get_hdev_data(hdev); in wacom_add_shared_data()
540 data->dev = hdev; in wacom_add_shared_data()
547 wacom_wac->shared->touch = hdev; in wacom_add_shared_data()
549 wacom_wac->shared->pen = hdev; in wacom_add_shared_data()
577 if (wacom_wac->shared->touch == wacom->hdev) in wacom_remove_shared_data()
579 else if (wacom_wac->shared->pen == wacom->hdev) in wacom_remove_shared_data()
616 wacom_get_report(wacom->hdev, HID_FEATURE_REPORT, in wacom_led_control()
637 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, buf_size, in wacom_led_control()
658 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, in wacom_led_putimage()
669 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, in wacom_led_putimage()
678 wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2, in wacom_led_putimage()
689 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in wacom_led_select_store() local
690 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_led_select_store()
717 struct hid_device *hdev = container_of(dev, struct hid_device, dev);\
718 struct wacom *wacom = hid_get_drvdata(hdev); \
753 struct hid_device *hdev = container_of(dev, struct hid_device, dev);\
754 struct wacom *wacom = hid_get_drvdata(hdev); \
776 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in wacom_button_image_store() local
777 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_button_image_store()
782 if (hdev->bus == BUS_BLUETOOTH) { in wacom_button_image_store()
881 error = sysfs_create_group(&wacom->hdev->dev.kobj, in wacom_initialize_leds()
893 error = sysfs_create_group(&wacom->hdev->dev.kobj, in wacom_initialize_leds()
909 error = sysfs_create_group(&wacom->hdev->dev.kobj, in wacom_initialize_leds()
918 hid_err(wacom->hdev, in wacom_initialize_leds()
943 sysfs_remove_group(&wacom->hdev->dev.kobj, in wacom_destroy_leds()
949 sysfs_remove_group(&wacom->hdev->dev.kobj, in wacom_destroy_leds()
959 sysfs_remove_group(&wacom->hdev->dev.kobj, in wacom_destroy_leds()
1065 wacom->battery = power_supply_register(&wacom->hdev->dev, in wacom_initialize_battery()
1070 power_supply_powers(wacom->battery, &wacom->hdev->dev); in wacom_initialize_battery()
1072 wacom->ac = power_supply_register(&wacom->hdev->dev, in wacom_initialize_battery()
1080 power_supply_powers(wacom->ac, &wacom->hdev->dev); in wacom_initialize_battery()
1100 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in wacom_show_speed() local
1101 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_show_speed()
1110 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in wacom_store_speed() local
1111 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_store_speed()
1120 wacom_bt_query_tablet_data(hdev, new_speed, &wacom->wacom_wac.features); in wacom_store_speed()
1134 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in wacom_show_remote_mode() local
1135 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_show_remote_mode()
1188 hid_err(wacom->hdev, in wacom_remote_create_attr_group()
1232 retval = wacom_set_report(wacom->hdev, HID_OUTPUT_REPORT, buf, in wacom_cmd_unpair_remote()
1245 struct hid_device *hdev = container_of(dev, struct hid_device, dev); in wacom_store_unpair_remote() local
1246 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_store_unpair_remote()
1252 hid_info(wacom->hdev, "remote: unrecognized unpair code: %s\n", in wacom_store_unpair_remote()
1291 &wacom->hdev->dev.kobj); in wacom_initialize_remote()
1298 hid_err(wacom->hdev, in wacom_initialize_remote()
1314 struct hid_device *hdev = wacom->hdev; in wacom_allocate_input() local
1322 input_dev->phys = hdev->phys; in wacom_allocate_input()
1323 input_dev->dev.parent = &hdev->dev; in wacom_allocate_input()
1326 input_dev->uniq = hdev->uniq; in wacom_allocate_input()
1327 input_dev->id.bustype = hdev->bus; in wacom_allocate_input()
1328 input_dev->id.vendor = hdev->vendor; in wacom_allocate_input()
1329 input_dev->id.product = wacom_wac->pid ? wacom_wac->pid : hdev->product; in wacom_allocate_input()
1330 input_dev->id.version = hdev->version; in wacom_allocate_input()
1528 hid_info(wacom->hdev, "wireless tablet disconnected\n"); in wacom_wireless_work()
1533 hid_info(wacom->hdev, "wireless tablet connected with PID %x\n", in wacom_wireless_work()
1544 hid_info(wacom->hdev, "ignoring unknown PID.\n"); in wacom_wireless_work()
1629 static size_t wacom_compute_pktlen(struct hid_device *hdev) in wacom_compute_pktlen() argument
1635 report_enum = hdev->report_enum + HID_INPUT_REPORT; in wacom_compute_pktlen()
1654 if (strstr(wacom->hdev->name, "Wacom") || in wacom_update_name()
1655 strstr(wacom->hdev->name, "wacom") || in wacom_update_name()
1656 strstr(wacom->hdev->name, "WACOM")) { in wacom_update_name()
1658 strlcpy(name, wacom->hdev->name, sizeof(name)); in wacom_update_name()
1674 "%s %X", features->name, wacom->hdev->product); in wacom_update_name()
1689 static int wacom_probe(struct hid_device *hdev, in wacom_probe() argument
1692 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); in wacom_probe()
1703 hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; in wacom_probe()
1706 hdev->quirks &= ~HID_QUIRK_NOGET; in wacom_probe()
1712 hid_set_drvdata(hdev, wacom); in wacom_probe()
1713 wacom->hdev = hdev; in wacom_probe()
1716 error = hid_parse(hdev); in wacom_probe()
1718 hid_err(hdev, "parse failed\n"); in wacom_probe()
1725 features->pktlen = wacom_compute_pktlen(hdev); in wacom_probe()
1731 if (features->check_for_hid_type && features->hid_type != hdev->type) { in wacom_probe()
1764 wacom_retrieve_hid_descriptor(hdev, features); in wacom_probe()
1771 dev_warn(&hdev->dev, "Unknown device_type for '%s'. %s.", in wacom_probe()
1772 hdev->name, in wacom_probe()
1785 error = wacom_add_shared_data(hdev); in wacom_probe()
1800 if (hdev->bus == BUS_BLUETOOTH) { in wacom_probe()
1801 error = device_create_file(&hdev->dev, &dev_attr_speed); in wacom_probe()
1803 hid_warn(hdev, in wacom_probe()
1812 error = hid_hw_start(hdev, connect_mask); in wacom_probe()
1814 hid_err(hdev, "hw start failed\n"); in wacom_probe()
1819 wacom_query_tablet_data(hdev, features); in wacom_probe()
1837 error = hid_hw_open(hdev); in wacom_probe()
1848 if (hdev->bus == BUS_BLUETOOTH) in wacom_probe()
1849 device_remove_file(&hdev->dev, &dev_attr_speed); in wacom_probe()
1862 hid_set_drvdata(hdev, NULL); in wacom_probe()
1866 static void wacom_remove(struct hid_device *hdev) in wacom_remove() argument
1868 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_remove()
1870 hid_hw_stop(hdev); in wacom_remove()
1874 if (hdev->bus == BUS_BLUETOOTH) in wacom_remove()
1875 device_remove_file(&hdev->dev, &dev_attr_speed); in wacom_remove()
1879 hid_set_drvdata(hdev, NULL); in wacom_remove()
1884 static int wacom_resume(struct hid_device *hdev) in wacom_resume() argument
1886 struct wacom *wacom = hid_get_drvdata(hdev); in wacom_resume()
1892 wacom_query_tablet_data(hdev, features); in wacom_resume()
1900 static int wacom_reset_resume(struct hid_device *hdev) in wacom_reset_resume() argument
1902 return wacom_resume(hdev); in wacom_reset_resume()