aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/input-mt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/input-mt.c')
-rw-r--r--drivers/input/input-mt.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c
index c30204f2fa30..fbe29fcb15c5 100644
--- a/drivers/input/input-mt.c
+++ b/drivers/input/input-mt.c
@@ -236,6 +236,18 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count)
236} 236}
237EXPORT_SYMBOL(input_mt_report_pointer_emulation); 237EXPORT_SYMBOL(input_mt_report_pointer_emulation);
238 238
239static void __input_mt_drop_unused(struct input_dev *dev, struct input_mt *mt)
240{
241 int i;
242
243 for (i = 0; i < mt->num_slots; i++) {
244 if (!input_mt_is_used(mt, &mt->slots[i])) {
245 input_mt_slot(dev, i);
246 input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
247 }
248 }
249}
250
239/** 251/**
240 * input_mt_drop_unused() - Inactivate slots not seen in this frame 252 * input_mt_drop_unused() - Inactivate slots not seen in this frame
241 * @dev: input device with allocated MT slots 253 * @dev: input device with allocated MT slots
@@ -245,19 +257,11 @@ EXPORT_SYMBOL(input_mt_report_pointer_emulation);
245void input_mt_drop_unused(struct input_dev *dev) 257void input_mt_drop_unused(struct input_dev *dev)
246{ 258{
247 struct input_mt *mt = dev->mt; 259 struct input_mt *mt = dev->mt;
248 int i;
249 260
250 if (!mt) 261 if (mt) {
251 return; 262 __input_mt_drop_unused(dev, mt);
252 263 mt->frame++;
253 for (i = 0; i < mt->num_slots; i++) {
254 if (!input_mt_is_used(mt, &mt->slots[i])) {
255 input_mt_slot(dev, i);
256 input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
257 }
258 } 264 }
259
260 mt->frame++;
261} 265}
262EXPORT_SYMBOL(input_mt_drop_unused); 266EXPORT_SYMBOL(input_mt_drop_unused);
263 267
@@ -278,12 +282,14 @@ void input_mt_sync_frame(struct input_dev *dev)
278 return; 282 return;
279 283
280 if (mt->flags & INPUT_MT_DROP_UNUSED) 284 if (mt->flags & INPUT_MT_DROP_UNUSED)
281 input_mt_drop_unused(dev); 285 __input_mt_drop_unused(dev, mt);
282 286
283 if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT)) 287 if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT))
284 use_count = true; 288 use_count = true;
285 289
286 input_mt_report_pointer_emulation(dev, use_count); 290 input_mt_report_pointer_emulation(dev, use_count);
291
292 mt->frame++;
287} 293}
288EXPORT_SYMBOL(input_mt_sync_frame); 294EXPORT_SYMBOL(input_mt_sync_frame);
289 295