aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/input/mt.h
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2012-08-22 14:43:22 -0400
committerHenrik Rydberg <rydberg@euromail.se>2012-09-19 13:50:19 -0400
commit55e49089f4589908eb688742d2d7eff33b74ac78 (patch)
treeea080c5831e489465378a37480d87c1125143b8c /include/linux/input/mt.h
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/mt.h')
-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 @@
15 15
16#define TRKID_MAX 0xffff 16#define TRKID_MAX 0xffff
17 17
18#define INPUT_MT_POINTER 0x0001 /* pointer device, e.g. trackpad */
19#define INPUT_MT_DIRECT 0x0002 /* direct device, e.g. touchscreen */
20#define INPUT_MT_DROP_UNUSED 0x0004 /* drop contacts not seen in frame */
18/** 21/**
19 * struct input_mt_slot - represents the state of an input MT slot 22 * struct input_mt_slot - represents the state of an input MT slot
20 * @abs: holds current values of ABS_MT axes for this slot 23 * @abs: holds current values of ABS_MT axes for this slot
24 * @frame: last frame at which input_mt_report_slot_state() was called
21 */ 25 */
22struct input_mt_slot { 26struct input_mt_slot {
23 int abs[ABS_MT_LAST - ABS_MT_FIRST + 1]; 27 int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
28 unsigned int frame;
24}; 29};
25 30
26/** 31/**
@@ -29,6 +34,7 @@ struct input_mt_slot {
29 * @num_slots: number of MT slots the device uses 34 * @num_slots: number of MT slots the device uses
30 * @slot: MT slot currently being transmitted 35 * @slot: MT slot currently being transmitted
31 * @flags: input_mt operation flags 36 * @flags: input_mt operation flags
37 * @frame: increases every time input_mt_sync_frame() is called
32 * @slots: array of slots holding current values of tracked contacts 38 * @slots: array of slots holding current values of tracked contacts
33 */ 39 */
34struct input_mt { 40struct input_mt {
@@ -36,6 +42,7 @@ struct input_mt {
36 int num_slots; 42 int num_slots;
37 int slot; 43 int slot;
38 unsigned int flags; 44 unsigned int flags;
45 unsigned int frame;
39 struct input_mt_slot slots[]; 46 struct input_mt_slot slots[];
40}; 47};
41 48
@@ -81,4 +88,6 @@ void input_mt_report_slot_state(struct input_dev *dev,
81void input_mt_report_finger_count(struct input_dev *dev, int count); 88void input_mt_report_finger_count(struct input_dev *dev, int count);
82void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count); 89void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count);
83 90
91void input_mt_sync_frame(struct input_dev *dev);
92
84#endif 93#endif