aboutsummaryrefslogtreecommitdiff
path: root/include/linux/input
diff options
context:
space:
mode:
authorHenrik Rydberg2012-08-22 20:43:22 +0200
committerHenrik Rydberg2012-09-19 19:50:19 +0200
commit55e49089f4589908eb688742d2d7eff33b74ac78 (patch)
treeea080c5831e489465378a37480d87c1125143b8c /include/linux/input
parentb4adbbefc2099476a4f1020041c99f52cf3cd67d (diff)
Input: MT - Handle frame synchronization in core
Most MT drivers perform the same actions on frame synchronization. Some actions, like dropping unseen contacts, are also unnecessarily complex. Collect common frame synchronization tasks in a new function, input_mt_sync_frame(). Depending on the flags set, it drops unseen contacts and performs pointer emulation. With init flags and frame synchronization in place, most MT drivers can be simplified. First out are the bcm5974 and hid-multitouch drivers, following this patch. Reviewed-and-tested-by: Benjamin Tissoires <benjamin.tissoires@enac.fr> Tested-by: Ping Cheng <pingc@wacom.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'include/linux/input')
-rw-r--r--include/linux/input/mt.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
index 53f5bf168ff9..94989189878d 100644
--- a/include/linux/input/mt.h
+++ b/include/linux/input/mt.h
@@ -15,12 +15,17 @@
#define TRKID_MAX 0xffff
+#define INPUT_MT_POINTER 0x0001 /* pointer device, e.g. trackpad */
+#define INPUT_MT_DIRECT 0x0002 /* direct device, e.g. touchscreen */
+#define INPUT_MT_DROP_UNUSED 0x0004 /* drop contacts not seen in frame */
/**
* struct input_mt_slot - represents the state of an input MT slot
* @abs: holds current values of ABS_MT axes for this slot
+ * @frame: last frame at which input_mt_report_slot_state() was called
*/
struct input_mt_slot {
int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
+ unsigned int frame;
};
/**
@@ -29,6 +34,7 @@ struct input_mt_slot {
* @num_slots: number of MT slots the device uses
* @slot: MT slot currently being transmitted
* @flags: input_mt operation flags
+ * @frame: increases every time input_mt_sync_frame() is called
* @slots: array of slots holding current values of tracked contacts
*/
struct input_mt {
@@ -36,6 +42,7 @@ struct input_mt {
int num_slots;
int slot;
unsigned int flags;
+ unsigned int frame;
struct input_mt_slot slots[];
};
@@ -81,4 +88,6 @@ 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_pointer_emulation(struct input_dev *dev, bool use_count);
+void input_mt_sync_frame(struct input_dev *dev);
+
#endif