aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-12-16 12:17:48 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-12-16 12:17:48 -0500
commit67b989a0c17e34a7c2c095e58a2f3d1b4408e3cb (patch)
treec076d2f0b5d4ae8726a50206042d3e3a41620fe4 /include
parent56a8bd6dcf81693e61a712097216904f3a4ab536 (diff)
parent69479f8da68f1930b2078b2ebf6533fb00339918 (diff)
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rydberg/input-mt into next
Conflicts: drivers/input/Makefile
Diffstat (limited to 'include')
-rw-r--r--include/linux/input.h22
-rw-r--r--include/linux/input/mt.h57
2 files changed, 62 insertions, 17 deletions
diff --git a/include/linux/input.h b/include/linux/input.h
index 6ef44465db8d..53f873e8556c 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -733,11 +733,12 @@ struct input_keymap_entry {
733#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */ 733#define ABS_MT_BLOB_ID 0x38 /* Group a set of packets as a blob */
734#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */ 734#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
735#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */ 735#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
736#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */
736 737
737#ifdef __KERNEL__ 738#ifdef __KERNEL__
738/* Implementation details, userspace should not care about these */ 739/* Implementation details, userspace should not care about these */
739#define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR 740#define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR
740#define ABS_MT_LAST ABS_MT_PRESSURE 741#define ABS_MT_LAST ABS_MT_DISTANCE
741#endif 742#endif
742 743
743#define ABS_MAX 0x3f 744#define ABS_MAX 0x3f
@@ -848,6 +849,7 @@ struct input_keymap_entry {
848 */ 849 */
849#define MT_TOOL_FINGER 0 850#define MT_TOOL_FINGER 0
850#define MT_TOOL_PEN 1 851#define MT_TOOL_PEN 1
852#define MT_TOOL_MAX 1
851 853
852/* 854/*
853 * Values describing the status of a force-feedback effect 855 * Values describing the status of a force-feedback effect
@@ -1083,14 +1085,6 @@ struct ff_effect {
1083#include <linux/mod_devicetable.h> 1085#include <linux/mod_devicetable.h>
1084 1086
1085/** 1087/**
1086 * struct input_mt_slot - represents the state of an input MT slot
1087 * @abs: holds current values of ABS_MT axes for this slot
1088 */
1089struct input_mt_slot {
1090 int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
1091};
1092
1093/**
1094 * struct input_dev - represents an input device 1088 * struct input_dev - represents an input device
1095 * @name: name of the device 1089 * @name: name of the device
1096 * @phys: physical path to the device in the system hierarchy 1090 * @phys: physical path to the device in the system hierarchy
@@ -1130,6 +1124,7 @@ struct input_mt_slot {
1130 * of tracked contacts 1124 * of tracked contacts
1131 * @mtsize: number of MT slots the device uses 1125 * @mtsize: number of MT slots the device uses
1132 * @slot: MT slot currently being transmitted 1126 * @slot: MT slot currently being transmitted
1127 * @trkid: stores MT tracking ID for the current contact
1133 * @absinfo: array of &struct absinfo elements holding information 1128 * @absinfo: array of &struct absinfo elements holding information
1134 * about absolute axes (current value, min, max, flat, fuzz, 1129 * about absolute axes (current value, min, max, flat, fuzz,
1135 * resolution) 1130 * resolution)
@@ -1214,6 +1209,7 @@ struct input_dev {
1214 struct input_mt_slot *mt; 1209 struct input_mt_slot *mt;
1215 int mtsize; 1210 int mtsize;
1216 int slot; 1211 int slot;
1212 int trkid;
1217 1213
1218 struct input_absinfo *absinfo; 1214 struct input_absinfo *absinfo;
1219 1215
@@ -1463,11 +1459,6 @@ static inline void input_mt_sync(struct input_dev *dev)
1463 input_event(dev, EV_SYN, SYN_MT_REPORT, 0); 1459 input_event(dev, EV_SYN, SYN_MT_REPORT, 0);
1464} 1460}
1465 1461
1466static inline void input_mt_slot(struct input_dev *dev, int slot)
1467{
1468 input_event(dev, EV_ABS, ABS_MT_SLOT, slot);
1469}
1470
1471void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code); 1462void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
1472 1463
1473/** 1464/**
@@ -1580,8 +1571,5 @@ int input_ff_erase(struct input_dev *dev, int effect_id, struct file *file);
1580int input_ff_create_memless(struct input_dev *dev, void *data, 1571int input_ff_create_memless(struct input_dev *dev, void *data,
1581 int (*play_effect)(struct input_dev *, void *, struct ff_effect *)); 1572 int (*play_effect)(struct input_dev *, void *, struct ff_effect *));
1582 1573
1583int input_mt_create_slots(struct input_dev *dev, unsigned int num_slots);
1584void input_mt_destroy_slots(struct input_dev *dev);
1585
1586#endif 1574#endif
1587#endif 1575#endif
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
new file mode 100644
index 000000000000..b3ac06a4435d
--- /dev/null
+++ b/include/linux/input/mt.h
@@ -0,0 +1,57 @@
1#ifndef _INPUT_MT_H
2#define _INPUT_MT_H
3
4/*
5 * Input Multitouch Library
6 *
7 * Copyright (c) 2010 Henrik Rydberg
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License version 2 as published by
11 * the Free Software Foundation.
12 */
13
14#include <linux/input.h>
15
16#define TRKID_MAX 0xffff
17
18/**
19 * struct input_mt_slot - represents the state of an input MT slot
20 * @abs: holds current values of ABS_MT axes for this slot
21 */
22struct input_mt_slot {
23 int abs[ABS_MT_LAST - ABS_MT_FIRST + 1];
24};
25
26static inline void input_mt_set_value(struct input_mt_slot *slot,
27 unsigned code, int value)
28{
29 slot->abs[code - ABS_MT_FIRST] = value;
30}
31
32static inline int input_mt_get_value(const struct input_mt_slot *slot,
33 unsigned code)
34{
35 return slot->abs[code - ABS_MT_FIRST];
36}
37
38int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots);
39void input_mt_destroy_slots(struct input_dev *dev);
40
41static inline int input_mt_new_trkid(struct input_dev *dev)
42{
43 return dev->trkid++ & TRKID_MAX;
44}
45
46static inline void input_mt_slot(struct input_dev *dev, int slot)
47{
48 input_event(dev, EV_ABS, ABS_MT_SLOT, slot);
49}
50
51void input_mt_report_slot_state(struct input_dev *dev,
52 unsigned int tool_type, bool active);
53
54void input_mt_report_finger_count(struct input_dev *dev, int count);
55void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count);
56
57#endif