Lines Matching defs:hdev

17 static int wacom_get_report(struct hid_device *hdev, u8 type, u8 *buf,
23 retval = hid_hw_raw_request(hdev, buf[0], buf, size, type,
28 hid_err(hdev, "wacom_get_report: ran out of retries "
34 static int wacom_set_report(struct hid_device *hdev, u8 type, u8 *buf,
40 retval = hid_hw_raw_request(hdev, buf[0], buf, size, type,
45 hid_err(hdev, "wacom_set_report: ran out of retries "
51 static void wacom_wac_queue_insert(struct hid_device *hdev,
59 hid_warn(hdev, "%s: kfifo has filled, starting to drop events\n", __func__);
68 static void wacom_wac_queue_flush(struct hid_device *hdev,
77 err = hid_report_raw_event(hdev, HID_INPUT_REPORT, buf, size, false);
79 hid_warn(hdev, "%s: unable to flush event due to error %d\n",
85 static int wacom_wac_pen_serial_enforce(struct hid_device *hdev,
88 struct wacom *wacom = hid_get_drvdata(hdev);
116 value = hid_field_extract(hdev, raw_data+1, offset + j * size, size);
145 wacom_wac_queue_flush(hdev, wacom_wac->pen_fifo);
147 wacom_wac_queue_insert(hdev, wacom_wac->pen_fifo,
153 static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
156 struct wacom *wacom = hid_get_drvdata(hdev);
164 if (wacom_wac_pen_serial_enforce(hdev, report, raw_data, size))
178 return hid_hw_open(wacom->hdev);
186 * wacom->hdev should never be null, but surprisingly, I had the case
189 if (wacom->hdev)
190 hid_hw_close(wacom->hdev);
209 static void wacom_hid_usage_quirk(struct hid_device *hdev,
212 struct wacom *wacom = hid_get_drvdata(hdev);
220 if (hdev->vendor == USB_VENDOR_ID_WACOM &&
221 hdev->product == 0x4200 &&
284 if (hdev->vendor == USB_VENDOR_ID_WACOM &&
285 hdev->product == 0x0358 &&
292 static void wacom_feature_mapping(struct hid_device *hdev,
295 struct wacom *wacom = hid_get_drvdata(hdev);
303 wacom_hid_usage_quirk(hdev, field, usage);
318 ret = wacom_get_report(hdev, HID_FEATURE_REPORT,
321 ret = hid_report_raw_event(hdev,
327 hid_warn(hdev, "wacom_feature_mapping: "
338 dev_err(&hdev->dev, "HID_DG_INPUTMODE out of range\n");
379 ret = wacom_get_report(hdev, HID_FEATURE_REPORT,
382 ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT,
385 hid_warn(hdev, "%s: could not retrieve sensor offsets\n",
425 static void wacom_usage_mapping(struct hid_device *hdev,
428 struct wacom *wacom = hid_get_drvdata(hdev);
446 wacom_hid_usage_quirk(hdev, field, usage);
478 wacom_wac_usage_mapping(hdev, field, usage);
481 static void wacom_post_parse_hid(struct hid_device *hdev,
484 struct wacom *wacom = hid_get_drvdata(hdev);
509 static void wacom_parse_hid(struct hid_device *hdev,
517 rep_enum = &hdev->report_enum[HID_FEATURE_REPORT];
525 wacom_feature_mapping(hdev, hreport->field[i],
532 rep_enum = &hdev->report_enum[HID_INPUT_REPORT];
540 wacom_usage_mapping(hdev, hreport->field[i],
544 wacom_post_parse_hid(hdev, features);
547 static int wacom_hid_set_device_mode(struct hid_device *hdev)
549 struct wacom *wacom = hid_get_drvdata(hdev);
557 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
561 hid_hw_request(hdev, r, HID_REQ_SET_REPORT);
566 static int wacom_set_device_mode(struct hid_device *hdev,
578 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
593 error = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data,
596 error = wacom_get_report(hdev, HID_FEATURE_REPORT,
607 static int wacom_bt_query_tablet_data(struct hid_device *hdev, u8 speed,
610 struct wacom *wacom = hid_get_drvdata(hdev);
618 ret = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, 2,
625 ret = wacom_set_report(hdev, HID_FEATURE_REPORT,
638 hid_warn(hdev, "failed to poke device, command %d, err %d\n",
650 ret = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, 2,
669 struct hid_device *hdev = wacom->hdev;
673 if (hdev->bus == BUS_BLUETOOTH)
674 return wacom_bt_query_tablet_data(hdev, 1, features);
700 wacom_set_device_mode(hdev, wacom_wac);
703 return wacom_hid_set_device_mode(hdev);
708 static void wacom_retrieve_hid_descriptor(struct hid_device *hdev,
711 struct wacom *wacom = hid_get_drvdata(hdev);
735 wacom_parse_hid(hdev, features);
748 static bool wacom_are_sibling(struct hid_device *hdev,
751 struct wacom *wacom = hid_get_drvdata(hdev);
755 __u32 oVid = features->oVid ? features->oVid : hdev->vendor;
756 __u32 oPid = features->oPid ? features->oPid : hdev->product;
769 if (hdev->vendor == sibling->vendor && hdev->product == sibling->product) {
770 if (!hid_compare_device_paths(hdev, sibling, '/'))
773 if (!hid_compare_device_paths(hdev, sibling, '.'))
814 static struct wacom_hdev_data *wacom_get_hdev_data(struct hid_device *hdev)
820 if (hid_compare_device_paths(hdev, data->dev, '/')) {
828 if (wacom_are_sibling(hdev, data->dev)) {
859 if (wacom_wac->shared->touch == wacom->hdev)
861 else if (wacom_wac->shared->pen == wacom->hdev)
869 static int wacom_add_shared_data(struct hid_device *hdev)
871 struct wacom *wacom = hid_get_drvdata(hdev);
878 data = wacom_get_hdev_data(hdev);
887 data->dev = hdev;
895 retval = devm_add_action_or_reset(&hdev->dev, wacom_remove_shared_data, wacom);
900 wacom_wac->shared->touch = hdev;
902 wacom_wac->shared->pen = hdev;
951 wacom_get_report(wacom->hdev, HID_FEATURE_REPORT,
982 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, buf_size,
1003 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2,
1014 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT,
1023 wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2,
1034 struct hid_device *hdev = to_hid_device(dev);
1035 struct wacom *wacom = hid_get_drvdata(hdev);
1062 struct hid_device *hdev = to_hid_device(dev);\
1063 struct wacom *wacom = hid_get_drvdata(hdev); \
1098 struct hid_device *hdev = to_hid_device(dev);\
1099 struct wacom *wacom = hid_get_drvdata(hdev); \
1121 struct hid_device *hdev = to_hid_device(dev);
1122 struct wacom *wacom = hid_get_drvdata(hdev);
1127 if (hdev->bus == BUS_BLUETOOTH) {
1256 devres_add(&wacom->hdev->dev, devres);
1264 return __wacom_devm_sysfs_create_group(wacom, &wacom->hdev->dev.kobj,
1294 devres_add(&wacom->hdev->dev, pen_fifo);
1377 hid_err(wacom->hdev,
1402 hid_err(wacom->hdev,
1462 error = devm_add_action_or_reset(&wacom->hdev->dev,
1529 struct device *dev = &wacom->hdev->dev;
1591 hid_err(wacom->hdev,
1612 hid_err(wacom->hdev,
1629 hid_err(wacom->hdev,
1649 hid_err(wacom->hdev,
1663 hid_err(wacom->hdev,
1674 hid_err(wacom->hdev,
1685 hid_err(wacom->hdev,
1759 struct device *dev = &wacom->hdev->dev;
1787 power_supply_powers(ps_bat, &wacom->hdev->dev);
1810 devres_release_group(&wacom->hdev->dev,
1827 struct hid_device *hdev = to_hid_device(dev);
1828 struct wacom *wacom = hid_get_drvdata(hdev);
1837 struct hid_device *hdev = to_hid_device(dev);
1838 struct wacom *wacom = hid_get_drvdata(hdev);
1847 wacom_bt_query_tablet_data(hdev, new_speed, &wacom->wacom_wac.features);
1861 struct hid_device *hdev = to_hid_device(dev);
1862 struct wacom *wacom = hid_get_drvdata(hdev);
1901 remote->remotes[index].group.name = devm_kasprintf(&wacom->hdev->dev,
1911 hid_err(wacom->hdev,
1932 retval = wacom_set_report(wacom->hdev, HID_OUTPUT_REPORT, buf,
1945 struct hid_device *hdev = to_hid_device(dev);
1946 struct wacom *wacom = hid_get_drvdata(hdev);
1952 hid_info(wacom->hdev, "remote: unrecognized unpair code: %s\n",
1997 remote = devm_kzalloc(&wacom->hdev->dev, sizeof(*wacom->remote),
2010 hid_err(wacom->hdev, "failed allocating remote_fifo\n");
2021 &wacom->hdev->dev.kobj);
2028 hid_err(wacom->hdev,
2038 error = devm_add_action_or_reset(&wacom->hdev->dev,
2049 struct hid_device *hdev = wacom->hdev;
2052 input_dev = devm_input_allocate_device(&hdev->dev);
2057 input_dev->phys = hdev->phys;
2058 input_dev->dev.parent = &hdev->dev;
2061 input_dev->uniq = hdev->uniq;
2062 input_dev->id.bustype = hdev->bus;
2063 input_dev->id.vendor = hdev->vendor;
2064 input_dev->id.product = wacom_wac->pid ? wacom_wac->pid : hdev->product;
2065 input_dev->id.version = hdev->version;
2214 static size_t wacom_compute_pktlen(struct hid_device *hdev)
2220 report_enum = hdev->report_enum + HID_INPUT_REPORT;
2239 char *product_name = wacom->hdev->name;
2241 if (hid_is_usb(wacom->hdev)) {
2242 struct usb_interface *intf = to_usb_interface(wacom->hdev->dev.parent);
2247 if (wacom->hdev->bus == BUS_I2C) {
2249 features->name, wacom->hdev->product);
2254 hid_warn(wacom->hdev, "String overflow while assembling device name");
2274 hid_warn(wacom->hdev, "String overflow while assembling device name");
2292 struct hid_device *hdev = wacom->hdev;
2297 devres_release_group(&hdev->dev, wacom);
2336 struct hid_device *hdev = wacom->hdev;
2340 features->pktlen = wacom_compute_pktlen(hdev);
2344 if (!devres_open_group(&hdev->dev, wacom, GFP_KERNEL))
2372 wacom_retrieve_hid_descriptor(hdev, features);
2379 dev_warn(&hdev->dev, "Unknown device_type for '%s'. %s.",
2380 hdev->name,
2401 error = wacom_add_shared_data(hdev);
2413 error = hid_hw_start(hdev, connect_mask);
2415 hid_err(hdev, "hw start failed\n");
2448 error = hid_hw_open(hdev);
2450 hid_err(hdev, "hw open failed\n");
2456 devres_close_group(&hdev->dev, wacom);
2461 hid_hw_stop(hdev);
2500 hid_info(wacom->hdev, "wireless tablet disconnected\n");
2504 hid_info(wacom->hdev, "wireless tablet connected with PID %x\n",
2515 hid_info(wacom->hdev, "ignoring unknown PID.\n");
2544 hid_warn(wacom->hdev, "String overflow while assembling device name");
2561 devres_release_group(&wacom->hdev->dev,
2585 devres_release_group(&wacom->hdev->dev,
2599 struct device *dev = &wacom->hdev->dev;
2705 hid_err(wacom->hdev,
2752 hid_hw_stop(wacom1->hdev);
2760 hid_hw_stop(wacom2->hdev);
2780 static int wacom_probe(struct hid_device *hdev,
2791 hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;
2794 hdev->quirks &= ~HID_QUIRK_NOGET;
2796 wacom = devm_kzalloc(&hdev->dev, sizeof(struct wacom), GFP_KERNEL);
2800 hid_set_drvdata(hdev, wacom);
2801 wacom->hdev = hdev;
2807 if (features->check_for_hid_type && features->hid_type != hdev->type)
2817 if (hid_is_usb(hdev)) {
2818 struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
2835 error = hid_parse(hdev);
2837 hid_err(hdev, "parse failed\n");
2842 hid_warn(hdev, "Using device in hidraw-only mode");
2843 return hid_hw_start(hdev, HID_CONNECT_HIDRAW);
2850 if (hdev->bus == BUS_BLUETOOTH) {
2851 error = device_create_file(&hdev->dev, &dev_attr_speed);
2853 hid_warn(hdev,
2862 static void wacom_remove(struct hid_device *hdev)
2864 struct wacom *wacom = hid_get_drvdata(hdev);
2869 hid_hw_close(hdev);
2871 hid_hw_stop(hdev);
2879 if (hdev->bus == BUS_BLUETOOTH)
2880 device_remove_file(&hdev->dev, &dev_attr_speed);
2890 static int wacom_resume(struct hid_device *hdev)
2892 struct wacom *wacom = hid_get_drvdata(hdev);
2905 static int wacom_reset_resume(struct hid_device *hdev)
2907 return wacom_resume(hdev);