Commit f8ec8949 authored by Henrik Rydberg's avatar Henrik Rydberg Committed by Dmitry Torokhov

Input: MT - make slot cleanup callable outside mt_sync_frame()

Some semi-mt drivers use the slots in a manual way, but may still
want to call parts of the frame synchronization logic. This patch
makes input_mt_drop_unused callable from those drivers.
Signed-off-by: default avatarHenrik Rydberg <rydberg@euromail.se>
Reviewed-by: default avatarBenson Leung <bleung@chromium.org>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 437d4f37
...@@ -236,6 +236,31 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count) ...@@ -236,6 +236,31 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count)
} }
EXPORT_SYMBOL(input_mt_report_pointer_emulation); EXPORT_SYMBOL(input_mt_report_pointer_emulation);
/**
* input_mt_drop_unused() - Inactivate slots not seen in this frame
* @dev: input device with allocated MT slots
*
* Lift all slots not seen since the last call to this function.
*/
void input_mt_drop_unused(struct input_dev *dev)
{
struct input_mt *mt = dev->mt;
int i;
if (!mt)
return;
for (i = 0; i < mt->num_slots; i++) {
if (!input_mt_is_used(mt, &mt->slots[i])) {
input_mt_slot(dev, i);
input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
}
}
mt->frame++;
}
EXPORT_SYMBOL(input_mt_drop_unused);
/** /**
* input_mt_sync_frame() - synchronize mt frame * input_mt_sync_frame() - synchronize mt frame
* @dev: input device with allocated MT slots * @dev: input device with allocated MT slots
...@@ -247,27 +272,18 @@ EXPORT_SYMBOL(input_mt_report_pointer_emulation); ...@@ -247,27 +272,18 @@ EXPORT_SYMBOL(input_mt_report_pointer_emulation);
void input_mt_sync_frame(struct input_dev *dev) void input_mt_sync_frame(struct input_dev *dev)
{ {
struct input_mt *mt = dev->mt; struct input_mt *mt = dev->mt;
struct input_mt_slot *s;
bool use_count = false; bool use_count = false;
if (!mt) if (!mt)
return; return;
if (mt->flags & INPUT_MT_DROP_UNUSED) { if (mt->flags & INPUT_MT_DROP_UNUSED)
for (s = mt->slots; s != mt->slots + mt->num_slots; s++) { input_mt_drop_unused(dev);
if (input_mt_is_used(mt, s))
continue;
input_mt_slot(dev, s - mt->slots);
input_event(dev, EV_ABS, ABS_MT_TRACKING_ID, -1);
}
}
if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT)) if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT))
use_count = true; use_count = true;
input_mt_report_pointer_emulation(dev, use_count); input_mt_report_pointer_emulation(dev, use_count);
mt->frame++;
} }
EXPORT_SYMBOL(input_mt_sync_frame); EXPORT_SYMBOL(input_mt_sync_frame);
......
...@@ -105,6 +105,7 @@ void input_mt_report_slot_state(struct input_dev *dev, ...@@ -105,6 +105,7 @@ void input_mt_report_slot_state(struct input_dev *dev,
void input_mt_report_finger_count(struct input_dev *dev, int count); void input_mt_report_finger_count(struct input_dev *dev, int count);
void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count); void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count);
void input_mt_drop_unused(struct input_dev *dev);
void input_mt_sync_frame(struct input_dev *dev); void input_mt_sync_frame(struct input_dev *dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment