Lines Matching defs:hdev
163 struct hid_device *hdev; /* hid_device we're attached to */
407 struct hid_device *hdev = to_hid_device(dev);
408 struct mt_device *td = hid_get_drvdata(hdev);
417 struct hid_device *hdev = to_hid_device(dev);
418 struct mt_device *td = hid_get_drvdata(hdev);
448 static void mt_get_feature(struct hid_device *hdev, struct hid_report *report)
458 if (hdev->quirks & HID_QUIRK_NO_INIT_REPORTS)
465 ret = hid_hw_raw_request(hdev, report->id, buf, size,
468 dev_warn(&hdev->dev, "failed to fetch feature %d\n",
471 ret = hid_report_raw_event(hdev, HID_FEATURE_REPORT, buf,
474 dev_warn(&hdev->dev, "failed to report feature\n");
480 static void mt_feature_mapping(struct hid_device *hdev,
483 struct mt_device *td = hid_get_drvdata(hdev);
487 mt_get_feature(hdev, field->report);
500 dev_err(&hdev->dev, "HID_DG_BUTTONTYPE out of range\n");
504 mt_get_feature(hdev, field->report);
512 mt_get_feature(hdev, field->report);
527 static struct mt_usages *mt_allocate_usage(struct hid_device *hdev,
532 usage = devm_kzalloc(&hdev->dev, sizeof(*usage), GFP_KERNEL);
561 mt_application = devm_kzalloc(&td->hdev->dev, sizeof(*mt_application),
619 rdata = devm_kzalloc(&td->hdev->dev, sizeof(*rdata), GFP_KERNEL);
627 devm_kfree(&td->hdev->dev, rdata);
637 if (field->logical == HID_DG_FINGER || td->hdev->group != HID_GROUP_MULTITOUCH_WIN_8) {
670 static void mt_store_field(struct hid_device *hdev,
679 usage = mt_allocate_usage(hdev, application);
697 hid_dbg(hdev,
701 usage = mt_allocate_usage(hdev, application);
712 mt_store_field(hdev, app, \
716 static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
720 struct mt_device *td = hid_get_drvdata(hdev);
1013 struct hid_device *hdev = td->hdev;
1127 x = hdev->quirks & HID_QUIRK_X_INVERT ?
1130 y = hdev->quirks & HID_QUIRK_Y_INVERT ?
1133 cx = hdev->quirks & HID_QUIRK_X_INVERT ?
1136 cy = hdev->quirks & HID_QUIRK_Y_INVERT ?
1295 static int mt_touch_input_configured(struct hid_device *hdev,
1299 struct mt_device *td = hid_get_drvdata(hdev);
1342 static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi,
1346 struct mt_device *td = hid_get_drvdata(hdev);
1352 hid_err(hdev, "failed to allocate data for report\n");
1401 return mt_touch_input_mapping(hdev, hi, field, usage, bit, max,
1415 static int mt_input_mapped(struct hid_device *hdev, struct hid_input *hi,
1419 struct mt_device *td = hid_get_drvdata(hdev);
1462 static bool mt_need_to_apply_feature(struct hid_device *hdev,
1470 struct mt_device *td = hid_get_drvdata(hdev);
1492 hid_err(hdev,
1496 hid_hw_raw_request(hdev, report->id, buf, report_len,
1533 static void mt_set_modes(struct hid_device *hdev, enum latency_mode latency,
1543 rep_enum = &hdev->report_enum[HID_FEATURE_REPORT];
1555 if (mt_need_to_apply_feature(hdev,
1567 hid_hw_request(hdev, rep, HID_REQ_SET_REPORT);
1594 static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)
1596 struct mt_device *td = hid_get_drvdata(hdev);
1606 hid_err(hdev, "failed to allocate data for report\n");
1613 ret = mt_touch_input_configured(hdev, hi,
1633 hi->input->name = hdev->name;
1648 hi->input->name = devm_kasprintf(&hdev->dev, GFP_KERNEL,
1649 "%s %s", hdev->name, suffix);
1664 static void mt_fix_const_fields(struct hid_device *hdev, unsigned int usage)
1670 &hdev->report_enum[HID_INPUT_REPORT].report_list,
1711 struct hid_device *hdev = td->hdev;
1720 mt_release_contacts(hdev);
1724 static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id)
1737 td = devm_kzalloc(&hdev->dev, sizeof(struct mt_device), GFP_KERNEL);
1739 dev_err(&hdev->dev, "cannot allocate multitouch data\n");
1742 td->hdev = hdev;
1745 hid_set_drvdata(hdev, td);
1757 if (hdev->quirks & (HID_QUIRK_X_INVERT | HID_QUIRK_Y_INVERT) &&
1758 !((hdev->quirks & HID_QUIRK_X_INVERT)
1759 && (hdev->quirks & HID_QUIRK_Y_INVERT)))
1765 hdev->quirks |= HID_QUIRK_NO_INPUT_SYNC;
1772 hdev->quirks |= HID_QUIRK_INPUT_PER_APP;
1775 hdev->quirks |= HID_QUIRK_MULTI_INPUT;
1778 hdev->quirks &= ~HID_QUIRK_INPUT_PER_APP;
1779 hdev->quirks |= HID_QUIRK_MULTI_INPUT;
1784 ret = hid_parse(hdev);
1789 mt_fix_const_fields(hdev, HID_DG_CONTACTID);
1791 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
1795 ret = sysfs_create_group(&hdev->dev.kobj, &mt_attribute_group);
1797 dev_warn(&hdev->dev, "Cannot allocate sysfs group for %s\n",
1798 hdev->name);
1800 mt_set_modes(hdev, HID_LATENCY_NORMAL, true, true);
1806 static int mt_suspend(struct hid_device *hdev, pm_message_t state)
1808 struct mt_device *td = hid_get_drvdata(hdev);
1812 !hid_hw_may_wakeup(hdev))
1813 mt_set_modes(hdev, HID_LATENCY_HIGH, false, false);
1815 mt_set_modes(hdev, HID_LATENCY_HIGH, true, true);
1820 static int mt_reset_resume(struct hid_device *hdev)
1822 mt_release_contacts(hdev);
1823 mt_set_modes(hdev, HID_LATENCY_NORMAL, true, true);
1827 static int mt_resume(struct hid_device *hdev)
1833 hid_hw_idle(hdev, 0, 0, HID_REQ_SET_IDLE);
1835 mt_set_modes(hdev, HID_LATENCY_NORMAL, true, true);
1841 static void mt_remove(struct hid_device *hdev)
1843 struct mt_device *td = hid_get_drvdata(hdev);
1847 sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group);
1848 hid_hw_stop(hdev);