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()
315 struct mt_device *td = hid_get_drvdata(hdev); in mt_feature_mapping() local
325 if (td->inputmode < 0) { in mt_feature_mapping()
326 td->inputmode = field->report->id; in mt_feature_mapping()
327 td->inputmode_index = usage->usage_index; in mt_feature_mapping()
341 td->maxcontact_report_id = field->report->id; in mt_feature_mapping()
342 td->maxcontacts = field->value[0]; in mt_feature_mapping()
343 if (!td->maxcontacts && in mt_feature_mapping()
345 td->maxcontacts = field->logical_maximum; in mt_feature_mapping()
346 if (td->mtclass.maxcontacts) in mt_feature_mapping()
348 td->maxcontacts = td->mtclass.maxcontacts; in mt_feature_mapping()
358 td->is_buttonpad = true; in mt_feature_mapping()
374 static void mt_store_field(struct hid_usage *usage, struct mt_device *td, in mt_store_field() argument
377 struct mt_fields *f = td->fields; in mt_store_field()
389 struct mt_device *td = hid_get_drvdata(hdev); in mt_touch_input_mapping() local
390 struct mt_class *cls = &td->mtclass; in mt_touch_input_mapping()
395 td->mt_flags |= INPUT_MT_DIRECT; in mt_touch_input_mapping()
402 td->mt_flags |= INPUT_MT_POINTER; in mt_touch_input_mapping()
403 td->inputmode_value = MT_INPUTMODE_TOUCHPAD; in mt_touch_input_mapping()
408 td->buttons_count++; in mt_touch_input_mapping()
430 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
445 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
459 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
462 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
467 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
470 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
471 td->touches_by_report++; in mt_touch_input_mapping()
472 td->mt_report_id = field->report->id; in mt_touch_input_mapping()
480 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
491 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
498 mt_store_field(usage, td, hi); in mt_touch_input_mapping()
505 td->cc_index = field->index; in mt_touch_input_mapping()
506 td->cc_value_index = usage->usage_index; in mt_touch_input_mapping()
544 static int mt_compute_slot(struct mt_device *td, struct input_dev *input) in mt_compute_slot() argument
546 __s32 quirks = td->mtclass.quirks; in mt_compute_slot()
549 return td->curdata.contactid; in mt_compute_slot()
552 return cypress_compute_slot(td); in mt_compute_slot()
555 return td->num_received; in mt_compute_slot()
558 return td->curdata.contactid - 1; in mt_compute_slot()
560 return input_mt_get_slot_by_key(input, td->curdata.contactid); in mt_compute_slot()
567 static void mt_complete_slot(struct mt_device *td, struct input_dev *input) in mt_complete_slot() argument
569 if ((td->mtclass.quirks & MT_QUIRK_CONTACT_CNT_ACCURATE) && in mt_complete_slot()
570 td->num_received >= td->num_expected) in mt_complete_slot()
573 if (td->curvalid || (td->mtclass.quirks & MT_QUIRK_ALWAYS_VALID)) { in mt_complete_slot()
574 int slotnum = mt_compute_slot(td, input); in mt_complete_slot()
575 struct mt_slot *s = &td->curdata; in mt_complete_slot()
578 if (slotnum < 0 || slotnum >= td->maxcontacts) in mt_complete_slot()
581 if ((td->mtclass.quirks & MT_QUIRK_IGNORE_DUPLICATES) && mt) { in mt_complete_slot()
611 td->num_received++; in mt_complete_slot()
618 static void mt_sync_frame(struct mt_device *td, struct input_dev *input) in mt_sync_frame() argument
622 td->num_received = 0; in mt_sync_frame()
638 struct mt_device *td = hid_get_drvdata(hid); in mt_process_mt_event() local
639 __s32 quirks = td->mtclass.quirks; in mt_process_mt_event()
646 td->curvalid = value; in mt_process_mt_event()
648 td->curdata.inrange_state = value; in mt_process_mt_event()
652 td->curvalid = value; in mt_process_mt_event()
653 td->curdata.touch_state = value; in mt_process_mt_event()
657 td->curvalid = value; in mt_process_mt_event()
660 td->curdata.contactid = value; in mt_process_mt_event()
663 td->curdata.p = value; in mt_process_mt_event()
667 td->curdata.cx = value; in mt_process_mt_event()
669 td->curdata.x = value; in mt_process_mt_event()
673 td->curdata.cy = value; in mt_process_mt_event()
675 td->curdata.y = value; in mt_process_mt_event()
678 td->curdata.w = value; in mt_process_mt_event()
681 td->curdata.h = value; in mt_process_mt_event()
698 if (usage->hid == td->last_slot_field) in mt_process_mt_event()
699 mt_complete_slot(td, field->hidinput->input); in mt_process_mt_event()
707 struct mt_device *td = hid_get_drvdata(hid); in mt_touch_report() local
716 if (td->cc_index >= 0) { in mt_touch_report()
717 struct hid_field *field = report->field[td->cc_index]; in mt_touch_report()
718 int value = field->value[td->cc_value_index]; in mt_touch_report()
720 td->num_expected = value; in mt_touch_report()
735 if (td->num_received >= td->num_expected) in mt_touch_report()
736 mt_sync_frame(td, report->field[0]->hidinput->input); in mt_touch_report()
742 struct mt_device *td = hid_get_drvdata(hdev); in mt_touch_input_configured() local
743 struct mt_class *cls = &td->mtclass; in mt_touch_input_configured()
746 if (!td->maxcontacts) in mt_touch_input_configured()
747 td->maxcontacts = MT_DEFAULT_MAXCONTACT; in mt_touch_input_configured()
749 mt_post_parse(td); in mt_touch_input_configured()
750 if (td->serial_maybe) in mt_touch_input_configured()
751 mt_post_parse_default_settings(td); in mt_touch_input_configured()
754 td->mt_flags |= INPUT_MT_POINTER; in mt_touch_input_configured()
757 td->mt_flags |= INPUT_MT_DROP_UNUSED; in mt_touch_input_configured()
760 if ((td->mt_flags & INPUT_MT_POINTER) && (td->buttons_count == 1)) in mt_touch_input_configured()
761 td->is_buttonpad = true; in mt_touch_input_configured()
763 if (td->is_buttonpad) in mt_touch_input_configured()
766 input_mt_init_slots(input, td->maxcontacts, td->mt_flags); in mt_touch_input_configured()
768 td->mt_flags = 0; in mt_touch_input_configured()
775 struct mt_device *td = hid_get_drvdata(hdev); in mt_input_mapping() local
783 if (!td->mtclass.export_all_inputs && in mt_input_mapping()
826 struct mt_device *td = hid_get_drvdata(hid); in mt_event() local
828 if (field->report->id == td->mt_report_id) in mt_event()
836 struct mt_device *td = hid_get_drvdata(hid); in mt_report() local
842 if (report->id == td->mt_report_id) in mt_report()
851 struct mt_device *td = hid_get_drvdata(hdev); in mt_set_input_mode() local
854 struct mt_class *cls = &td->mtclass; in mt_set_input_mode()
858 if (td->inputmode < 0) in mt_set_input_mode()
862 r = re->report_id_hash[td->inputmode]; in mt_set_input_mode()
876 r->field[0]->value[td->inputmode_index] = td->inputmode_value; in mt_set_input_mode()
883 struct mt_device *td = hid_get_drvdata(hdev); in mt_set_maxcontacts() local
888 if (td->maxcontact_report_id < 0) in mt_set_maxcontacts()
891 if (!td->mtclass.maxcontacts) in mt_set_maxcontacts()
895 r = re->report_id_hash[td->maxcontact_report_id]; in mt_set_maxcontacts()
897 max = td->mtclass.maxcontacts; in mt_set_maxcontacts()
907 static void mt_post_parse_default_settings(struct mt_device *td) in mt_post_parse_default_settings() argument
909 __s32 quirks = td->mtclass.quirks; in mt_post_parse_default_settings()
912 if (td->touches_by_report == 1) { in mt_post_parse_default_settings()
920 td->mtclass.quirks = quirks; in mt_post_parse_default_settings()
923 static void mt_post_parse(struct mt_device *td) in mt_post_parse() argument
925 struct mt_fields *f = td->fields; in mt_post_parse()
926 struct mt_class *cls = &td->mtclass; in mt_post_parse()
928 if (td->touches_by_report > 0) { in mt_post_parse()
929 int field_count_per_touch = f->length / td->touches_by_report; in mt_post_parse()
930 td->last_slot_field = f->usages[field_count_per_touch - 1]; in mt_post_parse()
933 if (td->cc_index < 0) in mt_post_parse()
939 struct mt_device *td = hid_get_drvdata(hdev); in mt_input_configured() local
944 if (hi->report->id == td->mt_report_id) in mt_input_configured()
1001 struct mt_device *td; in mt_probe() local
1036 td = devm_kzalloc(&hdev->dev, sizeof(struct mt_device), GFP_KERNEL); in mt_probe()
1037 if (!td) { in mt_probe()
1041 td->mtclass = *mtclass; in mt_probe()
1042 td->inputmode = -1; in mt_probe()
1043 td->maxcontact_report_id = -1; in mt_probe()
1044 td->inputmode_value = MT_INPUTMODE_TOUCHSCREEN; in mt_probe()
1045 td->cc_index = -1; in mt_probe()
1046 td->mt_report_id = -1; in mt_probe()
1047 hid_set_drvdata(hdev, td); in mt_probe()
1049 td->fields = devm_kzalloc(&hdev->dev, sizeof(struct mt_fields), in mt_probe()
1051 if (!td->fields) { in mt_probe()
1057 td->serial_maybe = true; in mt_probe()
1073 devm_kfree(&hdev->dev, td->fields); in mt_probe()
1074 td->fields = NULL; in mt_probe()