Lines Matching defs:hdev
22 static int wacom_get_report(struct hid_device *hdev, u8 type, u8 *buf,
28 retval = hid_hw_raw_request(hdev, buf[0], buf, size, type,
33 hid_err(hdev, "wacom_get_report: ran out of retries "
39 static int wacom_set_report(struct hid_device *hdev, u8 type, u8 *buf,
45 retval = hid_hw_raw_request(hdev, buf[0], buf, size, type,
50 hid_err(hdev, "wacom_set_report: ran out of retries "
56 static void wacom_wac_queue_insert(struct hid_device *hdev,
64 hid_warn(hdev, "%s: kfifo has filled, starting to drop events\n", __func__);
73 static void wacom_wac_queue_flush(struct hid_device *hdev,
82 err = hid_report_raw_event(hdev, HID_INPUT_REPORT, buf, size, false);
84 hid_warn(hdev, "%s: unable to flush event due to error %d\n",
90 static int wacom_wac_pen_serial_enforce(struct hid_device *hdev,
93 struct wacom *wacom = hid_get_drvdata(hdev);
121 value = hid_field_extract(hdev, raw_data+1, offset + j * size, size);
150 wacom_wac_queue_flush(hdev, wacom_wac->pen_fifo);
152 wacom_wac_queue_insert(hdev, wacom_wac->pen_fifo,
158 static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
161 struct wacom *wacom = hid_get_drvdata(hdev);
169 if (wacom_wac_pen_serial_enforce(hdev, report, raw_data, size))
183 return hid_hw_open(wacom->hdev);
191 * wacom->hdev should never be null, but surprisingly, I had the case
194 if (wacom->hdev)
195 hid_hw_close(wacom->hdev);
214 static void wacom_hid_usage_quirk(struct hid_device *hdev,
217 struct wacom *wacom = hid_get_drvdata(hdev);
225 if (hdev->vendor == USB_VENDOR_ID_WACOM &&
226 hdev->product == 0x4200 &&
289 if (hdev->vendor == USB_VENDOR_ID_WACOM &&
290 hdev->product == 0x0358 &&
297 static void wacom_feature_mapping(struct hid_device *hdev,
300 struct wacom *wacom = hid_get_drvdata(hdev);
308 wacom_hid_usage_quirk(hdev, field, usage);
323 ret = wacom_get_report(hdev, HID_FEATURE_REPORT,
326 ret = hid_report_raw_event(hdev,
332 hid_warn(hdev, "wacom_feature_mapping: "
343 dev_err(&hdev->dev, "HID_DG_INPUTMODE out of range\n");
384 ret = wacom_get_report(hdev, HID_FEATURE_REPORT,
387 ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT,
390 hid_warn(hdev, "%s: could not retrieve sensor offsets\n",
430 static void wacom_usage_mapping(struct hid_device *hdev,
433 struct wacom *wacom = hid_get_drvdata(hdev);
451 wacom_hid_usage_quirk(hdev, field, usage);
483 wacom_wac_usage_mapping(hdev, field, usage);
486 static void wacom_post_parse_hid(struct hid_device *hdev,
489 struct wacom *wacom = hid_get_drvdata(hdev);
514 static void wacom_parse_hid(struct hid_device *hdev,
522 rep_enum = &hdev->report_enum[HID_FEATURE_REPORT];
530 wacom_feature_mapping(hdev, hreport->field[i],
537 rep_enum = &hdev->report_enum[HID_INPUT_REPORT];
545 wacom_usage_mapping(hdev, hreport->field[i],
549 wacom_post_parse_hid(hdev, features);
552 static int wacom_hid_set_device_mode(struct hid_device *hdev)
554 struct wacom *wacom = hid_get_drvdata(hdev);
562 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
566 hid_hw_request(hdev, r, HID_REQ_SET_REPORT);
571 static int wacom_set_device_mode(struct hid_device *hdev,
583 re = &(hdev->report_enum[HID_FEATURE_REPORT]);
598 error = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data,
601 error = wacom_get_report(hdev, HID_FEATURE_REPORT,
612 static int wacom_bt_query_tablet_data(struct hid_device *hdev, u8 speed,
615 struct wacom *wacom = hid_get_drvdata(hdev);
623 ret = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, 2,
630 ret = wacom_set_report(hdev, HID_FEATURE_REPORT,
643 hid_warn(hdev, "failed to poke device, command %d, err %d\n",
655 ret = wacom_set_report(hdev, HID_FEATURE_REPORT, rep_data, 2,
674 struct hid_device *hdev = wacom->hdev;
678 if (hdev->bus == BUS_BLUETOOTH)
679 return wacom_bt_query_tablet_data(hdev, 1, features);
705 wacom_set_device_mode(hdev, wacom_wac);
708 return wacom_hid_set_device_mode(hdev);
713 static void wacom_retrieve_hid_descriptor(struct hid_device *hdev,
716 struct wacom *wacom = hid_get_drvdata(hdev);
740 wacom_parse_hid(hdev, features);
753 static bool wacom_are_sibling(struct hid_device *hdev,
756 struct wacom *wacom = hid_get_drvdata(hdev);
760 __u32 oVid = features->oVid ? features->oVid : hdev->vendor;
761 __u32 oPid = features->oPid ? features->oPid : hdev->product;
774 if (hdev->vendor == sibling->vendor && hdev->product == sibling->product) {
775 if (!hid_compare_device_paths(hdev, sibling, '/'))
778 if (!hid_compare_device_paths(hdev, sibling, '.'))
819 static struct wacom_hdev_data *wacom_get_hdev_data(struct hid_device *hdev)
825 if (hid_compare_device_paths(hdev, data->dev, '/')) {
833 if (wacom_are_sibling(hdev, data->dev)) {
864 if (wacom_wac->shared->touch == wacom->hdev)
866 else if (wacom_wac->shared->pen == wacom->hdev)
874 static int wacom_add_shared_data(struct hid_device *hdev)
876 struct wacom *wacom = hid_get_drvdata(hdev);
883 data = wacom_get_hdev_data(hdev);
892 data->dev = hdev;
898 retval = devm_add_action(&hdev->dev, wacom_remove_shared_data, wacom);
906 wacom_wac->shared->touch = hdev;
908 wacom_wac->shared->pen = hdev;
959 wacom_get_report(wacom->hdev, HID_FEATURE_REPORT,
990 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, buf_size,
1011 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2,
1022 retval = wacom_set_report(wacom->hdev, HID_FEATURE_REPORT,
1031 wacom_set_report(wacom->hdev, HID_FEATURE_REPORT, buf, 2,
1042 struct hid_device *hdev = to_hid_device(dev);
1043 struct wacom *wacom = hid_get_drvdata(hdev);
1070 struct hid_device *hdev = to_hid_device(dev);\
1071 struct wacom *wacom = hid_get_drvdata(hdev); \
1106 struct hid_device *hdev = to_hid_device(dev);\
1107 struct wacom *wacom = hid_get_drvdata(hdev); \
1129 struct hid_device *hdev = to_hid_device(dev);
1130 struct wacom *wacom = hid_get_drvdata(hdev);
1135 if (hdev->bus == BUS_BLUETOOTH) {
1264 devres_add(&wacom->hdev->dev, devres);
1272 return __wacom_devm_sysfs_create_group(wacom, &wacom->hdev->dev.kobj,
1302 devres_add(&wacom->hdev->dev, pen_fifo);
1385 hid_err(wacom->hdev,
1410 hid_err(wacom->hdev,
1470 error = devm_add_action_or_reset(&wacom->hdev->dev,
1537 struct device *dev = &wacom->hdev->dev;
1599 hid_err(wacom->hdev,
1620 hid_err(wacom->hdev,
1637 hid_err(wacom->hdev,
1657 hid_err(wacom->hdev,
1671 hid_err(wacom->hdev,
1682 hid_err(wacom->hdev,
1693 hid_err(wacom->hdev,
1767 struct device *dev = &wacom->hdev->dev;
1795 power_supply_powers(ps_bat, &wacom->hdev->dev);
1818 devres_release_group(&wacom->hdev->dev,
1828 struct hid_device *hdev = to_hid_device(dev);
1829 struct wacom *wacom = hid_get_drvdata(hdev);
1838 struct hid_device *hdev = to_hid_device(dev);
1839 struct wacom *wacom = hid_get_drvdata(hdev);
1848 wacom_bt_query_tablet_data(hdev, new_speed, &wacom->wacom_wac.features);
1862 struct hid_device *hdev = to_hid_device(dev);
1863 struct wacom *wacom = hid_get_drvdata(hdev);
1902 remote->remotes[index].group.name = devm_kasprintf(&wacom->hdev->dev,
1912 hid_err(wacom->hdev,
1933 retval = wacom_set_report(wacom->hdev, HID_OUTPUT_REPORT, buf,
1946 struct hid_device *hdev = to_hid_device(dev);
1947 struct wacom *wacom = hid_get_drvdata(hdev);
1953 hid_info(wacom->hdev, "remote: unrecognized unpair code: %s\n",
1998 remote = devm_kzalloc(&wacom->hdev->dev, sizeof(*wacom->remote),
2011 hid_err(wacom->hdev, "failed allocating remote_fifo\n");
2022 &wacom->hdev->dev.kobj);
2029 hid_err(wacom->hdev,
2039 error = devm_add_action_or_reset(&wacom->hdev->dev,
2050 struct hid_device *hdev = wacom->hdev;
2053 input_dev = devm_input_allocate_device(&hdev->dev);
2058 input_dev->phys = hdev->phys;
2059 input_dev->dev.parent = &hdev->dev;
2062 input_dev->uniq = hdev->uniq;
2063 input_dev->id.bustype = hdev->bus;
2064 input_dev->id.vendor = hdev->vendor;
2065 input_dev->id.product = wacom_wac->pid ? wacom_wac->pid : hdev->product;
2066 input_dev->id.version = hdev->version;
2215 static size_t wacom_compute_pktlen(struct hid_device *hdev)
2221 report_enum = hdev->report_enum + HID_INPUT_REPORT;
2240 char *product_name = wacom->hdev->name;
2242 if (hid_is_usb(wacom->hdev)) {
2243 struct usb_interface *intf = to_usb_interface(wacom->hdev->dev.parent);
2248 if (wacom->hdev->bus == BUS_I2C) {
2250 features->name, wacom->hdev->product);
2289 struct hid_device *hdev = wacom->hdev;
2294 devres_release_group(&hdev->dev, wacom);
2327 struct hid_device *hdev = wacom->hdev;
2331 features->pktlen = wacom_compute_pktlen(hdev);
2335 if (!devres_open_group(&hdev->dev, wacom, GFP_KERNEL))
2363 wacom_retrieve_hid_descriptor(hdev, features);
2370 dev_warn(&hdev->dev, "Unknown device_type for '%s'. %s.",
2371 hdev->name,
2392 error = wacom_add_shared_data(hdev);
2411 error = hid_hw_start(hdev, connect_mask);
2413 hid_err(hdev, "hw start failed\n");
2446 error = hid_hw_open(hdev);
2448 hid_err(hdev, "hw open failed\n");
2454 devres_close_group(&hdev->dev, wacom);
2459 hid_hw_stop(hdev);
2498 hid_info(wacom->hdev, "wireless tablet disconnected\n");
2502 hid_info(wacom->hdev, "wireless tablet connected with PID %x\n",
2513 hid_info(wacom->hdev, "ignoring unknown PID.\n");
2560 devres_release_group(&wacom->hdev->dev,
2584 devres_release_group(&wacom->hdev->dev,
2598 struct device *dev = &wacom->hdev->dev;
2703 hid_err(wacom->hdev,
2750 hid_hw_stop(wacom1->hdev);
2758 hid_hw_stop(wacom2->hdev);
2778 static int wacom_probe(struct hid_device *hdev,
2789 hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS;
2792 hdev->quirks &= ~HID_QUIRK_NOGET;
2794 wacom = devm_kzalloc(&hdev->dev, sizeof(struct wacom), GFP_KERNEL);
2798 hid_set_drvdata(hdev, wacom);
2799 wacom->hdev = hdev;
2805 if (features->check_for_hid_type && features->hid_type != hdev->type)
2815 if (hid_is_usb(hdev)) {
2816 struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
2832 error = hid_parse(hdev);
2834 hid_err(hdev, "parse failed\n");
2839 hid_warn(hdev, "Using device in hidraw-only mode");
2840 return hid_hw_start(hdev, HID_CONNECT_HIDRAW);
2847 if (hdev->bus == BUS_BLUETOOTH) {
2848 error = device_create_file(&hdev->dev, &dev_attr_speed);
2850 hid_warn(hdev,
2858 static void wacom_remove(struct hid_device *hdev)
2860 struct wacom *wacom = hid_get_drvdata(hdev);
2865 hid_hw_close(hdev);
2867 hid_hw_stop(hdev);
2875 if (hdev->bus == BUS_BLUETOOTH)
2876 device_remove_file(&hdev->dev, &dev_attr_speed);
2886 static int wacom_resume(struct hid_device *hdev)
2888 struct wacom *wacom = hid_get_drvdata(hdev);
2901 static int wacom_reset_resume(struct hid_device *hdev)
2903 return wacom_resume(hdev);