diff options
Diffstat (limited to 'drivers/input/input-mt.c')
-rw-r--r-- | drivers/input/input-mt.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index d398f1321f14..c30204f2fa30 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c | |||
@@ -237,6 +237,31 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count) | |||
237 | EXPORT_SYMBOL(input_mt_report_pointer_emulation); | 237 | EXPORT_SYMBOL(input_mt_report_pointer_emulation); |
238 | 238 | ||
239 | /** | 239 | /** |
240 | * input_mt_drop_unused() - Inactivate slots not seen in this frame | ||
241 | * @dev: input device with allocated MT slots | ||
242 | * | ||
243 | * Lift all slots not seen since the last call to this function. | ||
244 | */ | ||
245 | void input_mt_drop_unused(struct input_dev *dev) | ||
246 | { | ||
247 | struct input_mt *mt = dev->mt; | ||
248 | int i; | ||
249 | |||
250 | if (!mt) | ||
251 | return; | ||
252 | |||
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 | } | ||
259 | |||
260 | mt->frame++; | ||
261 | } | ||
262 | EXPORT_SYMBOL(input_mt_drop_unused); | ||
263 | |||
264 | /** | ||
240 | * input_mt_sync_frame() - synchronize mt frame | 265 | * input_mt_sync_frame() - synchronize mt frame |
241 | * @dev: input device with allocated MT slots | 266 | * @dev: input device with allocated MT slots |
242 | * | 267 | * |
@@ -247,27 +272,18 @@ EXPORT_SYMBOL(input_mt_report_pointer_emulation); | |||
247 | void input_mt_sync_frame(struct input_dev *dev) | 272 | void input_mt_sync_frame(struct input_dev *dev) |
248 | { | 273 | { |
249 | struct input_mt *mt = dev->mt; | 274 | struct input_mt *mt = dev->mt; |
250 | struct input_mt_slot *s; | ||
251 | bool use_count = false; | 275 | bool use_count = false; |
252 | 276 | ||
253 | if (!mt) | 277 | if (!mt) |
254 | return; | 278 | return; |
255 | 279 | ||
256 | if (mt->flags & INPUT_MT_DROP_UNUSED) { | 280 | if (mt->flags & INPUT_MT_DROP_UNUSED) |
257 | for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { | 281 | input_mt_drop_unused(dev); |
258 | if (input_mt_is_used(mt, s)) | ||
259 | continue; | ||
260 | input_mt_slot(dev, s - mt->slots); | ||
261 | input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1); | ||
262 | } | ||
263 | } | ||
264 | 282 | ||
265 | if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT)) | 283 | if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT)) |
266 | use_count = true; | 284 | use_count = true; |
267 | 285 | ||
268 | input_mt_report_pointer_emulation(dev, use_count); | 286 | input_mt_report_pointer_emulation(dev, use_count); |
269 | |||
270 | mt->frame++; | ||
271 | } | 287 | } |
272 | EXPORT_SYMBOL(input_mt_sync_frame); | 288 | EXPORT_SYMBOL(input_mt_sync_frame); |
273 | 289 | ||