Lines Matching full:mt
8 #include <linux/input/mt.h>
24 * input_mt_init_slots() - initialize MT input slots
25 * @dev: input device supporting MT events and finger tracking
27 * @flags: mt tasks to handle in core
29 * This function allocates all necessary memory for MT slot handling
41 struct input_mt *mt = dev->mt; in input_mt_init_slots() local
46 if (mt) in input_mt_init_slots()
47 return mt->num_slots != num_slots ? -EINVAL : 0; in input_mt_init_slots()
49 mt = kzalloc(struct_size(mt, slots, num_slots), GFP_KERNEL); in input_mt_init_slots()
50 if (!mt) 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()
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()
98 kfree(mt); in input_mt_init_slots()
104 * input_mt_destroy_slots() - frees the MT slots of the input device
105 * @dev: input device with allocated MT slots
108 * automatically free the MT slots when the device is destroyed.
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()
122 * @dev: input device with allocated MT slots
137 struct input_mt *mt = dev->mt; in input_mt_report_slot_state() local
141 if (!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()
154 id = input_mt_new_trkid(mt); in input_mt_report_slot_state()
165 * @dev: input device with allocated MT slots
186 * @dev: input device with allocated MT slots
197 struct input_mt *mt = dev->mt; in input_mt_report_pointer_emulation() local
201 if (!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()
258 static void __input_mt_drop_unused(struct input_dev *dev, struct input_mt *mt) in __input_mt_drop_unused() argument
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()
272 * @dev: input device with allocated MT slots
278 struct input_mt *mt = dev->mt; in input_mt_drop_unused() local
280 if (mt) { in input_mt_drop_unused()
281 __input_mt_drop_unused(dev, mt); in input_mt_drop_unused()
282 mt->frame++; in input_mt_drop_unused()
288 * input_mt_sync_frame() - synchronize mt frame
289 * @dev: input device with allocated MT slots
297 struct input_mt *mt = dev->mt; in input_mt_sync_frame() local
300 if (!mt) in input_mt_sync_frame()
303 if (mt->flags & INPUT_MT_DROP_UNUSED) in input_mt_sync_frame()
304 __input_mt_drop_unused(dev, mt); 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()
363 static int input_mt_set_matrix(struct input_mt *mt, in input_mt_set_matrix() argument
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()
383 return w - mt->red; in input_mt_set_matrix()
386 static void input_mt_set_slots(struct input_mt *mt, in input_mt_set_slots() argument
390 int *w = mt->red, j; 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()
424 * @dev: input device with allocated MT slots
444 struct input_mt *mt = dev->mt; in input_mt_assign_slots() local
448 if (!mt || !mt->red) in input_mt_assign_slots()
450 if (num_pos > mt->num_slots) in input_mt_assign_slots()
455 nrc = input_mt_set_matrix(mt, pos, num_pos, mu); in input_mt_assign_slots()
456 find_reduced_matrix(mt->red, num_pos, nrc / num_pos, nrc, mu); in input_mt_assign_slots()
457 input_mt_set_slots(mt, slots, num_pos); in input_mt_assign_slots()
465 * @dev: input device with allocated MT slots
477 struct input_mt *mt = dev->mt; in input_mt_get_slot_by_key() local
480 if (!mt) 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()
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()
488 if (!input_mt_is_active(s) && !input_mt_is_used(mt, s)) { in input_mt_get_slot_by_key()
490 return s - mt->slots; in input_mt_get_slot_by_key()