Lines Matching refs:mt

8 #include <linux/input/mt.h>
27 * @flags: mt tasks to handle in core
41 struct input_mt *mt = dev->mt;
46 if (mt)
47 return mt->num_slots != num_slots ? -EINVAL : 0;
49 mt = kzalloc(struct_size(mt, slots, num_slots), GFP_KERNEL);
50 if (!mt)
53 mt->num_slots = num_slots;
54 mt->flags = flags;
83 mt->red = kcalloc(n2, sizeof(*mt->red), GFP_KERNEL);
84 if (!mt->red)
90 input_mt_set_value(&mt->slots[i], ABS_MT_TRACKING_ID, -1);
93 mt->frame = 1;
95 dev->mt = mt;
98 kfree(mt);
112 if (dev->mt) {
113 kfree(dev->mt->red);
114 kfree(dev->mt);
116 dev->mt = NULL;
137 struct input_mt *mt = dev->mt;
141 if (!mt)
144 slot = &mt->slots[mt->slot];
145 slot->frame = mt->frame;
154 id = input_mt_new_trkid(mt);
197 struct input_mt *mt = dev->mt;
201 if (!mt)
205 oldid = mt->trkid;
208 for (i = 0; i < mt->num_slots; ++i) {
209 struct input_mt_slot *ps = &mt->slots[i];
258 static void __input_mt_drop_unused(struct input_dev *dev, struct input_mt *mt)
262 for (i = 0; i < mt->num_slots; i++) {
263 if (!input_mt_is_used(mt, &mt->slots[i])) {
278 struct input_mt *mt = dev->mt;
280 if (mt) {
281 __input_mt_drop_unused(dev, mt);
282 mt->frame++;
288 * input_mt_sync_frame() - synchronize mt frame
297 struct input_mt *mt = dev->mt;
300 if (!mt)
303 if (mt->flags & INPUT_MT_DROP_UNUSED)
304 __input_mt_drop_unused(dev, mt);
306 if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT))
311 mt->frame++;
363 static int input_mt_set_matrix(struct input_mt *mt,
369 int *w = mt->red;
372 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) {
383 return w - mt->red;
386 static void input_mt_set_slots(struct input_mt *mt,
390 int *w = mt->red, j;
395 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) {
401 slots[j] = s - mt->slots;
409 for (s = mt->slots; s != mt->slots + mt->num_slots; s++) {
415 slots[j] = s - mt->slots;
444 struct input_mt *mt = dev->mt;
448 if (!mt || !mt->red)
450 if (num_pos > mt->num_slots)
455 nrc = input_mt_set_matrix(mt, pos, num_pos, mu);
456 find_reduced_matrix(mt->red, num_pos, nrc / num_pos, nrc, mu);
457 input_mt_set_slots(mt, slots, num_pos);
477 struct input_mt *mt = dev->mt;
480 if (!mt)
483 for (s = mt->slots; s != mt->slots + mt->num_slots; s++)
485 return s - mt->slots;
487 for (s = mt->slots; s != mt->slots + mt->num_slots; s++)
488 if (!input_mt_is_active(s) && !input_mt_is_used(mt, s)) {
490 return s - mt->slots;