Lines Matching refs:td
127 static void mt_post_parse_default_settings(struct mt_device *td);
128 static void mt_post_parse(struct mt_device *td);
170 static int cypress_compute_slot(struct mt_device *td) in cypress_compute_slot() argument
172 if (td->curdata.contactid != 0 || td->num_received == 0) in cypress_compute_slot()
173 return td->curdata.contactid; in cypress_compute_slot()
276 struct mt_device *td = hid_get_drvdata(hdev); in mt_show_quirks() local
278 return sprintf(buf, "%u\n", td->mtclass.quirks); in mt_show_quirks()
286 struct mt_device *td = hid_get_drvdata(hdev); in mt_set_quirks() local
293 td->mtclass.quirks = val; in mt_set_quirks()
295 if (td->cc_index < 0) in mt_set_quirks()
296 td->mtclass.quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE; in mt_set_quirks()
314 struct mt_device *td = hid_get_drvdata(hdev); in mt_get_feature() local
325 if (td->mtclass.name != MT_CLS_WIN_8) in mt_get_feature()
350 struct mt_device *td = hid_get_drvdata(hdev); in mt_feature_mapping() local
360 if (td->inputmode < 0) { in mt_feature_mapping()
361 td->inputmode = field->report->id; in mt_feature_mapping()
362 td->inputmode_index = usage->usage_index; in mt_feature_mapping()
378 td->maxcontact_report_id = field->report->id; in mt_feature_mapping()
379 td->maxcontacts = field->value[0]; in mt_feature_mapping()
380 if (!td->maxcontacts && in mt_feature_mapping()
382 td->maxcontacts = field->logical_maximum; in mt_feature_mapping()
383 if (td->mtclass.maxcontacts) in mt_feature_mapping()
385 td->maxcontacts = td->mtclass.maxcontacts; in mt_feature_mapping()
396 td->is_buttonpad = true; in mt_feature_mapping()
417 static void mt_store_field(struct hid_usage *usage, struct mt_device *td, in mt_store_field() argument
420 struct mt_fields *f = td->fields; in mt_store_field()
432 struct mt_device *td = hid_get_drvdata(hdev); in mt_touch_input_mapping() local
433 struct mt_class *cls = &td->mtclass; in mt_touch_input_mapping()
438 td->mt_flags |= INPUT_MT_DIRECT; in mt_touch_input_mapping()
445 td->mt_flags |= INPUT_MT_POINTER; in mt_touch_input_mapping()
446 td->inputmode_value = MT_INPUTMODE_TOUCHPAD; in mt_touch_input_mapping()
451 td->buttons_count++; in mt_touch_input_mapping()
473 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
488 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
502 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
505 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
510 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
513 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
514 td->touches_by_report++; in mt_touch_input_mapping()
515 td->mt_report_id = field->report->id; in mt_touch_input_mapping()
523 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
534 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
541 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
548 td->cc_index = field->index; in mt_touch_input_mapping()
549 td->cc_value_index = usage->usage_index; in mt_touch_input_mapping()
587 static int mt_compute_slot(struct mt_device *td, struct input_dev *input) in mt_compute_slot() argument
589 __s32 quirks = td->mtclass.quirks; in mt_compute_slot()
592 return td->curdata.contactid; in mt_compute_slot()
595 return cypress_compute_slot(td); in mt_compute_slot()
598 return td->num_received; in mt_compute_slot()
601 return td->curdata.contactid - 1; in mt_compute_slot()
603 return input_mt_get_slot_by_key(input, td->curdata.contactid); in mt_compute_slot()
610 static void mt_complete_slot(struct mt_device *td, struct input_dev *input) in mt_complete_slot() argument
612 if ((td->mtclass.quirks & MT_QUIRK_CONTACT_CNT_ACCURATE) && in mt_complete_slot()
613 td->num_received >= td->num_expected) in mt_complete_slot()
616 if (td->curvalid || (td->mtclass.quirks & MT_QUIRK_ALWAYS_VALID)) { in mt_complete_slot()
617 int slotnum = mt_compute_slot(td, input); in mt_complete_slot()
618 struct mt_slot *s = &td->curdata; in mt_complete_slot()
621 if (slotnum < 0 || slotnum >= td->maxcontacts) in mt_complete_slot()
624 if ((td->mtclass.quirks & MT_QUIRK_IGNORE_DUPLICATES) && mt) { in mt_complete_slot()
654 td->num_received++; in mt_complete_slot()
661 static void mt_sync_frame(struct mt_device *td, struct input_dev *input) in mt_sync_frame() argument
665 td->num_received = 0; in mt_sync_frame()
681 struct mt_device *td = hid_get_drvdata(hid); in mt_process_mt_event() local
682 __s32 quirks = td->mtclass.quirks; in mt_process_mt_event()
689 td->curvalid = value; in mt_process_mt_event()
691 td->curdata.inrange_state = value; in mt_process_mt_event()
695 td->curvalid = value; in mt_process_mt_event()
696 td->curdata.touch_state = value; in mt_process_mt_event()
700 td->curvalid = value; in mt_process_mt_event()
703 td->curdata.contactid = value; in mt_process_mt_event()
706 td->curdata.p = value; in mt_process_mt_event()
710 td->curdata.cx = value; in mt_process_mt_event()
712 td->curdata.x = value; in mt_process_mt_event()
716 td->curdata.cy = value; in mt_process_mt_event()
718 td->curdata.y = value; in mt_process_mt_event()
721 td->curdata.w = value; in mt_process_mt_event()
724 td->curdata.h = value; in mt_process_mt_event()
741 if (usage->hid == td->last_slot_field) in mt_process_mt_event()
742 mt_complete_slot(td, field->hidinput->input); in mt_process_mt_event()
750 struct mt_device *td = hid_get_drvdata(hid); in mt_touch_report() local
759 if (td->cc_index >= 0) { in mt_touch_report()
760 struct hid_field *field = report->field[td->cc_index]; in mt_touch_report()
761 int value = field->value[td->cc_value_index]; in mt_touch_report()
763 td->num_expected = value; in mt_touch_report()
778 if (td->num_received >= td->num_expected) in mt_touch_report()
779 mt_sync_frame(td, report->field[0]->hidinput->input); in mt_touch_report()
785 struct mt_device *td = hid_get_drvdata(hdev); in mt_touch_input_configured() local
786 struct mt_class *cls = &td->mtclass; in mt_touch_input_configured()
790 if (!td->maxcontacts) in mt_touch_input_configured()
791 td->maxcontacts = MT_DEFAULT_MAXCONTACT; in mt_touch_input_configured()
793 mt_post_parse(td); in mt_touch_input_configured()
794 if (td->serial_maybe) in mt_touch_input_configured()
795 mt_post_parse_default_settings(td); in mt_touch_input_configured()
798 td->mt_flags |= INPUT_MT_POINTER; in mt_touch_input_configured()
801 td->mt_flags |= INPUT_MT_DROP_UNUSED; in mt_touch_input_configured()
804 if ((td->mt_flags & INPUT_MT_POINTER) && (td->buttons_count == 1)) in mt_touch_input_configured()
805 td->is_buttonpad = true; in mt_touch_input_configured()
807 if (td->is_buttonpad) in mt_touch_input_configured()
810 ret = input_mt_init_slots(input, td->maxcontacts, td->mt_flags); in mt_touch_input_configured()
814 td->mt_flags = 0; in mt_touch_input_configured()
822 struct mt_device *td = hid_get_drvdata(hdev); in mt_input_mapping() local
830 if (!td->mtclass.export_all_inputs && in mt_input_mapping()
846 (field->report->id != td->mt_report_id) && in mt_input_mapping()
847 (td->mt_report_id != -1)) in mt_input_mapping()
880 struct mt_device *td = hid_get_drvdata(hid); in mt_event() local
882 if (field->report->id == td->mt_report_id) in mt_event()
890 struct mt_device *td = hid_get_drvdata(hid); in mt_report() local
896 if (report->id == td->mt_report_id) in mt_report()
905 struct mt_device *td = hid_get_drvdata(hdev); in mt_set_input_mode() local
908 struct mt_class *cls = &td->mtclass; in mt_set_input_mode()
912 if (td->inputmode < 0) in mt_set_input_mode()
916 r = re->report_id_hash[td->inputmode]; in mt_set_input_mode()
930 r->field[0]->value[td->inputmode_index] = td->inputmode_value; in mt_set_input_mode()
937 struct mt_device *td = hid_get_drvdata(hdev); in mt_set_maxcontacts() local
942 if (td->maxcontact_report_id < 0) in mt_set_maxcontacts()
945 if (!td->mtclass.maxcontacts) in mt_set_maxcontacts()
949 r = re->report_id_hash[td->maxcontact_report_id]; in mt_set_maxcontacts()
951 max = td->mtclass.maxcontacts; in mt_set_maxcontacts()
961 static void mt_post_parse_default_settings(struct mt_device *td) in mt_post_parse_default_settings() argument
963 __s32 quirks = td->mtclass.quirks; in mt_post_parse_default_settings()
966 if (td->touches_by_report == 1) { in mt_post_parse_default_settings()
974 td->mtclass.quirks = quirks; in mt_post_parse_default_settings()
977 static void mt_post_parse(struct mt_device *td) in mt_post_parse() argument
979 struct mt_fields *f = td->fields; in mt_post_parse()
980 struct mt_class *cls = &td->mtclass; in mt_post_parse()
982 if (td->touches_by_report > 0) { in mt_post_parse()
983 int field_count_per_touch = f->length / td->touches_by_report; in mt_post_parse()
984 td->last_slot_field = f->usages[field_count_per_touch - 1]; in mt_post_parse()
987 if (td->cc_index < 0) in mt_post_parse()
993 struct mt_device *td = hid_get_drvdata(hdev); in mt_input_configured() local
999 if (hi->report->id == td->mt_report_id) { in mt_input_configured()
1064 struct mt_device *td; in mt_probe() local
1104 td = devm_kzalloc(&hdev->dev, sizeof(struct mt_device), GFP_KERNEL); in mt_probe()
1105 if (!td) { in mt_probe()
1109 td->mtclass = *mtclass; in mt_probe()
1110 td->inputmode = -1; in mt_probe()
1111 td->maxcontact_report_id = -1; in mt_probe()
1112 td->inputmode_value = MT_INPUTMODE_TOUCHSCREEN; in mt_probe()
1113 td->cc_index = -1; in mt_probe()
1114 td->mt_report_id = -1; in mt_probe()
1115 hid_set_drvdata(hdev, td); in mt_probe()
1117 td->fields = devm_kzalloc(&hdev->dev, sizeof(struct mt_fields), in mt_probe()
1119 if (!td->fields) { in mt_probe()
1125 td->serial_maybe = true; in mt_probe()
1141 devm_kfree(&hdev->dev, td->fields); in mt_probe()
1142 td->fields = NULL; in mt_probe()