diff options
Diffstat (limited to 'include/linux/input/mt.h')
| -rw-r--r-- | include/linux/input/mt.h | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h index f86737586e19..cc5cca774bab 100644 --- a/include/linux/input/mt.h +++ b/include/linux/input/mt.h | |||
| @@ -15,12 +15,41 @@ | |||
| 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 */ | ||
| 21 | #define INPUT_MT_TRACK 0x0008 /* use in-kernel tracking */ | ||
| 22 | |||
| 18 | /** | 23 | /** |
| 19 | * struct input_mt_slot - represents the state of an input MT slot | 24 | * struct input_mt_slot - represents the state of an input MT slot |
| 20 | * @abs: holds current values of ABS_MT axes for this slot | 25 | * @abs: holds current values of ABS_MT axes for this slot |
| 26 | * @frame: last frame at which input_mt_report_slot_state() was called | ||
| 27 | * @key: optional driver designation of this slot | ||
| 21 | */ | 28 | */ |
| 22 | struct input_mt_slot { | 29 | struct input_mt_slot { |
| 23 | int abs[ABS_MT_LAST - ABS_MT_FIRST + 1]; | 30 | int abs[ABS_MT_LAST - ABS_MT_FIRST + 1]; |
| 31 | unsigned int frame; | ||
| 32 | unsigned int key; | ||
| 33 | }; | ||
| 34 | |||
| 35 | /** | ||
| 36 | * struct input_mt - state of tracked contacts | ||
| 37 | * @trkid: stores MT tracking ID for the next contact | ||
| 38 | * @num_slots: number of MT slots the device uses | ||
| 39 | * @slot: MT slot currently being transmitted | ||
| 40 | * @flags: input_mt operation flags | ||
| 41 | * @frame: increases every time input_mt_sync_frame() is called | ||
| 42 | * @red: reduced cost matrix for in-kernel tracking | ||
| 43 | * @slots: array of slots holding current values of tracked contacts | ||
| 44 | */ | ||
| 45 | struct input_mt { | ||
| 46 | int trkid; | ||
| 47 | int num_slots; | ||
| 48 | int slot; | ||
| 49 | unsigned int flags; | ||
| 50 | unsigned int frame; | ||
| 51 | int *red; | ||
| 52 | struct input_mt_slot slots[]; | ||
| 24 | }; | 53 | }; |
| 25 | 54 | ||
| 26 | static inline void input_mt_set_value(struct input_mt_slot *slot, | 55 | static inline void input_mt_set_value(struct input_mt_slot *slot, |
| @@ -35,12 +64,18 @@ static inline int input_mt_get_value(const struct input_mt_slot *slot, | |||
| 35 | return slot->abs[code - ABS_MT_FIRST]; | 64 | return slot->abs[code - ABS_MT_FIRST]; |
| 36 | } | 65 | } |
| 37 | 66 | ||
| 38 | int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots); | 67 | static inline bool input_mt_is_active(const struct input_mt_slot *slot) |
| 68 | { | ||
| 69 | return input_mt_get_value(slot, ABS_MT_TRACKING_ID) >= 0; | ||
| 70 | } | ||
| 71 | |||
| 72 | int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots, | ||
| 73 | unsigned int flags); | ||
| 39 | void input_mt_destroy_slots(struct input_dev *dev); | 74 | void input_mt_destroy_slots(struct input_dev *dev); |
| 40 | 75 | ||
| 41 | static inline int input_mt_new_trkid(struct input_dev *dev) | 76 | static inline int input_mt_new_trkid(struct input_mt *mt) |
| 42 | { | 77 | { |
| 43 | return dev->trkid++ & TRKID_MAX; | 78 | return mt->trkid++ & TRKID_MAX; |
| 44 | } | 79 | } |
| 45 | 80 | ||
| 46 | static inline void input_mt_slot(struct input_dev *dev, int slot) | 81 | static inline void input_mt_slot(struct input_dev *dev, int slot) |
| @@ -64,4 +99,20 @@ void input_mt_report_slot_state(struct input_dev *dev, | |||
| 64 | void input_mt_report_finger_count(struct input_dev *dev, int count); | 99 | void input_mt_report_finger_count(struct input_dev *dev, int count); |
| 65 | void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count); | 100 | void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count); |
| 66 | 101 | ||
| 102 | void input_mt_sync_frame(struct input_dev *dev); | ||
| 103 | |||
| 104 | /** | ||
| 105 | * struct input_mt_pos - contact position | ||
| 106 | * @x: horizontal coordinate | ||
| 107 | * @y: vertical coordinate | ||
| 108 | */ | ||
| 109 | struct input_mt_pos { | ||
| 110 | s16 x, y; | ||
| 111 | }; | ||
| 112 | |||
| 113 | int input_mt_assign_slots(struct input_dev *dev, int *slots, | ||
| 114 | const struct input_mt_pos *pos, int num_pos); | ||
| 115 | |||
| 116 | int input_mt_get_slot_by_key(struct input_dev *dev, int key); | ||
| 117 | |||
| 67 | #endif | 118 | #endif |
