Lines Matching full:mt
8 #include <linux/input/mt.h>
25 * input_mt_init_slots() - initialize MT input slots
26 * @dev: input device supporting MT events and finger tracking
28 * @flags: mt tasks to handle in core
30 * This function allocates all necessary memory for MT slot handling
45 if (dev->mt) in input_mt_init_slots()
46 return dev->mt->num_slots != num_slots ? -EINVAL : 0; in input_mt_init_slots()
52 struct input_mt *mt __free(kfree) = in input_mt_init_slots()
53 kzalloc_flex(*mt, slots, num_slots); in input_mt_init_slots()
54 if (!mt) in input_mt_init_slots()
57 mt->num_slots = num_slots; in input_mt_init_slots()
58 mt->flags = flags; in input_mt_init_slots()
87 mt->red = kzalloc_objs(*mt->red, n2); in input_mt_init_slots()
88 if (!mt->red) in input_mt_init_slots()
94 input_mt_set_value(&mt->slots[i], ABS_MT_TRACKING_ID, -1); in input_mt_init_slots()
97 mt->frame = 1; in input_mt_init_slots()
99 dev->mt = no_free_ptr(mt); in input_mt_init_slots()
105 * input_mt_destroy_slots() - frees the MT slots of the input device
106 * @dev: input device with allocated MT slots
109 * automatically free the MT slots when the device is destroyed.
113 if (dev->mt) { in input_mt_destroy_slots()
114 kfree(dev->mt->red); in input_mt_destroy_slots()
115 kfree(dev->mt); in input_mt_destroy_slots()
117 dev->mt = NULL; in input_mt_destroy_slots()
123 * @dev: input device with allocated MT slots
138 struct input_mt *mt = dev->mt; in input_mt_report_slot_state() local
142 if (!mt) in input_mt_report_slot_state()
145 slot = &mt->slots[mt->slot]; in input_mt_report_slot_state()
146 slot->frame = mt->frame; in input_mt_report_slot_state()
155 id = input_mt_new_trkid(mt); in input_mt_report_slot_state()
166 * @dev: input device with allocated MT slots
187 * @dev: input device with allocated MT slots
198 struct input_mt *mt = dev->mt; in input_mt_report_pointer_emulation() local
203 if (!mt) in input_mt_report_pointer_emulation()
207 oldid = mt->trkid; in input_mt_report_pointer_emulation()
210 for (i = 0; i < mt->num_slots; ++i) { in input_mt_report_pointer_emulation()
211 struct input_mt_slot *ps = &mt->slots[i]; in input_mt_report_pointer_emulation()
222 if (mt->flags & INPUT_MT_TOTAL_FORCE) in input_mt_report_pointer_emulation()
265 static void __input_mt_drop_unused(struct input_dev *dev, struct input_mt *mt) in __input_mt_drop_unused() argument
271 for (i = 0; i < mt->num_slots; i++) { in __input_mt_drop_unused()
272 if (input_mt_is_active(&mt->slots[i]) && in __input_mt_drop_unused()
273 !input_mt_is_used(mt, &mt->slots[i])) { in __input_mt_drop_unused()
282 * @dev: input device with allocated MT slots
288 struct input_mt *mt = dev->mt; in input_mt_drop_unused() local
290 if (mt) { in input_mt_drop_unused()
293 __input_mt_drop_unused(dev, mt); in input_mt_drop_unused()
294 mt->frame++; in input_mt_drop_unused()
301 * @dev: input device with allocated MT slots
307 struct input_mt *mt = dev->mt; in input_mt_release_slots() local
311 if (mt) { in input_mt_release_slots()
313 mt->frame++; in input_mt_release_slots()
315 __input_mt_drop_unused(dev, mt); in input_mt_release_slots()
320 mt->frame++; in input_mt_release_slots()
325 * input_mt_sync_frame() - synchronize mt frame
326 * @dev: input device with allocated MT slots
334 struct input_mt *mt = dev->mt; in input_mt_sync_frame() local
337 if (!mt) in input_mt_sync_frame()
340 if (mt->flags & INPUT_MT_DROP_UNUSED) { in input_mt_sync_frame()
342 __input_mt_drop_unused(dev, mt); in input_mt_sync_frame()
345 if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT)) in input_mt_sync_frame()
350 mt->frame++; in input_mt_sync_frame()
402 static int input_mt_set_matrix(struct input_mt *mt, in input_mt_set_matrix() argument
408 int *w = mt->red; in input_mt_set_matrix()
411 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { in input_mt_set_matrix()
422 return w - mt->red; in input_mt_set_matrix()
425 static void input_mt_set_slots(struct input_mt *mt, in input_mt_set_slots() argument
429 int *w = mt->red, j; in input_mt_set_slots()
434 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { in input_mt_set_slots()
440 slots[j] = s - mt->slots; in input_mt_set_slots()
448 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { in input_mt_set_slots()
454 slots[j] = s - mt->slots; in input_mt_set_slots()
463 * @dev: input device with allocated MT slots
483 struct input_mt *mt = dev->mt; in input_mt_assign_slots() local
487 if (!mt || !mt->red) in input_mt_assign_slots()
489 if (num_pos > mt->num_slots) in input_mt_assign_slots()
494 nrc = input_mt_set_matrix(mt, pos, num_pos, mu); in input_mt_assign_slots()
495 find_reduced_matrix(mt->red, num_pos, nrc / num_pos, nrc, mu); in input_mt_assign_slots()
496 input_mt_set_slots(mt, slots, num_pos); in input_mt_assign_slots()
504 * @dev: input device with allocated MT slots
516 struct input_mt *mt = dev->mt; in input_mt_get_slot_by_key() local
519 if (!mt) in input_mt_get_slot_by_key()
522 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) in input_mt_get_slot_by_key()
524 return s - mt->slots; in input_mt_get_slot_by_key()
526 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) in input_mt_get_slot_by_key()
527 if (!input_mt_is_active(s) && !input_mt_is_used(mt, s)) { in input_mt_get_slot_by_key()
529 return s - mt->slots; in input_mt_get_slot_by_key()