Lines Matching +full:abs +full:- +full:fuzz

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (c) 2008-2010 Henrik Rydberg
16 if (dev->absinfo && test_bit(src, dev->absbit)) { in copy_abs()
17 dev->absinfo[dst] = dev->absinfo[src]; in copy_abs()
18 dev->absinfo[dst].fuzz = 0; in copy_abs()
19 __set_bit(dst, dev->absbit); in copy_abs()
24 * input_mt_init_slots() - initialize MT input slots
35 * May be called repeatedly. Returns -EINVAL if attempting to
41 struct input_mt *mt = dev->mt; in input_mt_init_slots()
47 return mt->num_slots != num_slots ? -EINVAL : 0; in input_mt_init_slots()
53 mt->num_slots = num_slots; in input_mt_init_slots()
54 mt->flags = flags; in input_mt_init_slots()
55 input_set_abs_params(dev, ABS_MT_SLOT, 0, num_slots - 1, 0, 0); in input_mt_init_slots()
59 __set_bit(EV_KEY, dev->evbit); in input_mt_init_slots()
60 __set_bit(BTN_TOUCH, dev->keybit); in input_mt_init_slots()
67 __set_bit(BTN_TOOL_FINGER, dev->keybit); in input_mt_init_slots()
68 __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); in input_mt_init_slots()
70 __set_bit(BTN_TOOL_TRIPLETAP, dev->keybit); in input_mt_init_slots()
72 __set_bit(BTN_TOOL_QUADTAP, dev->keybit); in input_mt_init_slots()
74 __set_bit(BTN_TOOL_QUINTTAP, dev->keybit); in input_mt_init_slots()
75 __set_bit(INPUT_PROP_POINTER, dev->propbit); in input_mt_init_slots()
78 __set_bit(INPUT_PROP_DIRECT, dev->propbit); in input_mt_init_slots()
80 __set_bit(INPUT_PROP_SEMI_MT, dev->propbit); in input_mt_init_slots()
83 mt->red = kcalloc(n2, sizeof(*mt->red), GFP_KERNEL); in input_mt_init_slots()
84 if (!mt->red) in input_mt_init_slots()
90 input_mt_set_value(&mt->slots[i], ABS_MT_TRACKING_ID, -1); in input_mt_init_slots()
93 mt->frame = 1; in input_mt_init_slots()
95 dev->mt = mt; in input_mt_init_slots()
99 return -ENOMEM; in input_mt_init_slots()
104 * input_mt_destroy_slots() - frees the MT slots of the input device
112 if (dev->mt) { in input_mt_destroy_slots()
113 kfree(dev->mt->red); in input_mt_destroy_slots()
114 kfree(dev->mt); in input_mt_destroy_slots()
116 dev->mt = NULL; in input_mt_destroy_slots()
121 * input_mt_report_slot_state() - report contact state
137 struct input_mt *mt = dev->mt; in input_mt_report_slot_state()
144 slot = &mt->slots[mt->slot]; in input_mt_report_slot_state()
145 slot->frame = mt->frame; in input_mt_report_slot_state()
148 input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); in input_mt_report_slot_state()
164 * input_mt_report_finger_count() - report contact count
185 * input_mt_report_pointer_emulation() - common pointer emulation
192 * The input core ensures only the KEY and ABS axes already setup for
197 struct input_mt *mt = dev->mt; in input_mt_report_pointer_emulation()
205 oldid = mt->trkid; in input_mt_report_pointer_emulation()
208 for (i = 0; i < mt->num_slots; ++i) { in input_mt_report_pointer_emulation()
209 struct input_mt_slot *ps = &mt->slots[i]; in input_mt_report_pointer_emulation()
214 if ((id - oldid) & TRKID_SGN) { in input_mt_report_pointer_emulation()
225 !test_bit(ABS_MT_DISTANCE, dev->absbit) && in input_mt_report_pointer_emulation()
226 test_bit(ABS_DISTANCE, dev->absbit) && in input_mt_report_pointer_emulation()
230 * only report general hover (and not per-contact in input_mt_report_pointer_emulation()
247 if (test_bit(ABS_MT_PRESSURE, dev->absbit)) { in input_mt_report_pointer_emulation()
252 if (test_bit(ABS_MT_PRESSURE, dev->absbit)) in input_mt_report_pointer_emulation()
262 for (i = 0; i < mt->num_slots; i++) { in __input_mt_drop_unused()
263 if (!input_mt_is_used(mt, &mt->slots[i])) { in __input_mt_drop_unused()
265 input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); in __input_mt_drop_unused()
271 * input_mt_drop_unused() - Inactivate slots not seen in this frame
278 struct input_mt *mt = dev->mt; in input_mt_drop_unused()
282 mt->frame++; in input_mt_drop_unused()
288 * input_mt_sync_frame() - synchronize mt frame
297 struct input_mt *mt = dev->mt; in input_mt_sync_frame()
303 if (mt->flags & INPUT_MT_DROP_UNUSED) in input_mt_sync_frame()
306 if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT)) in input_mt_sync_frame()
311 mt->frame++; in input_mt_sync_frame()
343 *p -= c; in adjust_dual()
369 int *w = mt->red; in input_mt_set_matrix()
372 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { in input_mt_set_matrix()
378 int dx = x - p->x, dy = y - p->y; in input_mt_set_matrix()
379 *w++ = dx * dx + dy * dy - mu; in input_mt_set_matrix()
383 return w - mt->red; in input_mt_set_matrix()
390 int *w = mt->red, j; in input_mt_set_slots()
393 slots[j] = -1; in input_mt_set_slots()
395 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { in input_mt_set_slots()
401 slots[j] = s - mt->slots; in input_mt_set_slots()
409 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { in input_mt_set_slots()
415 slots[j] = s - mt->slots; in input_mt_set_slots()
423 * input_mt_assign_slots() - perform a best-match assignment
444 struct input_mt *mt = dev->mt; in input_mt_assign_slots()
448 if (!mt || !mt->red) in input_mt_assign_slots()
449 return -ENXIO; in input_mt_assign_slots()
450 if (num_pos > mt->num_slots) in input_mt_assign_slots()
451 return -EINVAL; in input_mt_assign_slots()
456 find_reduced_matrix(mt->red, num_pos, nrc / num_pos, nrc, mu); in input_mt_assign_slots()
464 * input_mt_get_slot_by_key() - return slot matching key
471 * If no available slot can be found, -1 is returned.
477 struct input_mt *mt = dev->mt; in input_mt_get_slot_by_key()
481 return -1; in input_mt_get_slot_by_key()
483 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) in input_mt_get_slot_by_key()
484 if (input_mt_is_active(s) && s->key == key) in input_mt_get_slot_by_key()
485 return s - mt->slots; in input_mt_get_slot_by_key()
487 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) in input_mt_get_slot_by_key()
489 s->key = key; in input_mt_get_slot_by_key()
490 return s - mt->slots; in input_mt_get_slot_by_key()
493 return -1; in input_mt_get_slot_by_key()