diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-10-11 03:45:21 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-10-11 03:45:21 -0400 |
| commit | 0cc8d6a9d23d6662da91eeb6bb8e7d1c559850f0 (patch) | |
| tree | 7187a6807ff5bd6e8f8dac7c53e2de28759a8354 /include | |
| parent | dde3ada3d0069855eeb353707b2b0f946191cfd6 (diff) | |
| parent | 7f8d4cad1e4e11a45d02bd6e024cc2812963c38a (diff) | |
Merge branch 'next' into for-linus
Prepare second set of updates for 3.7 merge window (Wacom driver update
and patches extending number of input minors).
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/hid.h | 5 | ||||
| -rw-r--r-- | include/linux/input.h | 45 | ||||
| -rw-r--r-- | include/linux/input/mt.h | 57 |
3 files changed, 88 insertions, 19 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h index 42970de1b40..7e1f37db758 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
| @@ -414,7 +414,7 @@ struct hid_field { | |||
| 414 | __u16 dpad; /* dpad input code */ | 414 | __u16 dpad; /* dpad input code */ |
| 415 | }; | 415 | }; |
| 416 | 416 | ||
| 417 | #define HID_MAX_FIELDS 128 | 417 | #define HID_MAX_FIELDS 256 |
| 418 | 418 | ||
| 419 | struct hid_report { | 419 | struct hid_report { |
| 420 | struct list_head list; | 420 | struct list_head list; |
| @@ -626,6 +626,7 @@ struct hid_usage_id { | |||
| 626 | * @report_fixup: called before report descriptor parsing (NULL means nop) | 626 | * @report_fixup: called before report descriptor parsing (NULL means nop) |
| 627 | * @input_mapping: invoked on input registering before mapping an usage | 627 | * @input_mapping: invoked on input registering before mapping an usage |
| 628 | * @input_mapped: invoked on input registering after mapping an usage | 628 | * @input_mapped: invoked on input registering after mapping an usage |
| 629 | * @input_configured: invoked just before the device is registered | ||
| 629 | * @feature_mapping: invoked on feature registering | 630 | * @feature_mapping: invoked on feature registering |
| 630 | * @suspend: invoked on suspend (NULL means nop) | 631 | * @suspend: invoked on suspend (NULL means nop) |
| 631 | * @resume: invoked on resume if device was not reset (NULL means nop) | 632 | * @resume: invoked on resume if device was not reset (NULL means nop) |
| @@ -670,6 +671,8 @@ struct hid_driver { | |||
| 670 | int (*input_mapped)(struct hid_device *hdev, | 671 | int (*input_mapped)(struct hid_device *hdev, |
| 671 | struct hid_input *hidinput, struct hid_field *field, | 672 | struct hid_input *hidinput, struct hid_field *field, |
| 672 | struct hid_usage *usage, unsigned long **bit, int *max); | 673 | struct hid_usage *usage, unsigned long **bit, int *max); |
| 674 | void (*input_configured)(struct hid_device *hdev, | ||
| 675 | struct hid_input *hidinput); | ||
| 673 | void (*feature_mapping)(struct hid_device *hdev, | 676 | void (*feature_mapping)(struct hid_device *hdev, |
| 674 | struct hid_field *field, | 677 | struct hid_field *field, |
| 675 | struct hid_usage *usage); | 678 | struct hid_usage *usage); |
diff --git a/include/linux/input.h b/include/linux/input.h index 725dcd0f63a..15464ba6bf5 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
| @@ -1169,6 +1169,18 @@ struct ff_effect { | |||
| 1169 | #include <linux/mod_devicetable.h> | 1169 | #include <linux/mod_devicetable.h> |
| 1170 | 1170 | ||
| 1171 | /** | 1171 | /** |
| 1172 | * struct input_value - input value representation | ||
| 1173 | * @type: type of value (EV_KEY, EV_ABS, etc) | ||
| 1174 | * @code: the value code | ||
| 1175 | * @value: the value | ||
| 1176 | */ | ||
| 1177 | struct input_value { | ||
| 1178 | __u16 type; | ||
| 1179 | __u16 code; | ||
| 1180 | __s32 value; | ||
| 1181 | }; | ||
| 1182 | |||
| 1183 | /** | ||
| 1172 | * struct input_dev - represents an input device | 1184 | * struct input_dev - represents an input device |
| 1173 | * @name: name of the device | 1185 | * @name: name of the device |
| 1174 | * @phys: physical path to the device in the system hierarchy | 1186 | * @phys: physical path to the device in the system hierarchy |
| @@ -1203,11 +1215,7 @@ struct ff_effect { | |||
| 1203 | * software autorepeat | 1215 | * software autorepeat |
| 1204 | * @timer: timer for software autorepeat | 1216 | * @timer: timer for software autorepeat |
| 1205 | * @rep: current values for autorepeat parameters (delay, rate) | 1217 | * @rep: current values for autorepeat parameters (delay, rate) |
| 1206 | * @mt: pointer to array of struct input_mt_slot holding current values | 1218 | * @mt: pointer to multitouch state |
| 1207 | * of tracked contacts | ||
| 1208 | * @mtsize: number of MT slots the device uses | ||
| 1209 | * @slot: MT slot currently being transmitted | ||
| 1210 | * @trkid: stores MT tracking ID for the current contact | ||
| 1211 | * @absinfo: array of &struct input_absinfo elements holding information | 1219 | * @absinfo: array of &struct input_absinfo elements holding information |
| 1212 | * about absolute axes (current value, min, max, flat, fuzz, | 1220 | * about absolute axes (current value, min, max, flat, fuzz, |
| 1213 | * resolution) | 1221 | * resolution) |
| @@ -1244,7 +1252,6 @@ struct ff_effect { | |||
| 1244 | * last user closes the device | 1252 | * last user closes the device |
| 1245 | * @going_away: marks devices that are in a middle of unregistering and | 1253 | * @going_away: marks devices that are in a middle of unregistering and |
| 1246 | * causes input_open_device*() fail with -ENODEV. | 1254 | * causes input_open_device*() fail with -ENODEV. |
| 1247 | * @sync: set to %true when there were no new events since last EV_SYN | ||
| 1248 | * @dev: driver model's view of this device | 1255 | * @dev: driver model's view of this device |
| 1249 | * @h_list: list of input handles associated with the device. When | 1256 | * @h_list: list of input handles associated with the device. When |
| 1250 | * accessing the list dev->mutex must be held | 1257 | * accessing the list dev->mutex must be held |
| @@ -1287,10 +1294,7 @@ struct input_dev { | |||
| 1287 | 1294 | ||
| 1288 | int rep[REP_CNT]; | 1295 | int rep[REP_CNT]; |
| 1289 | 1296 | ||
| 1290 | struct input_mt_slot *mt; | 1297 | struct input_mt *mt; |
| 1291 | int mtsize; | ||
| 1292 | int slot; | ||
| 1293 | int trkid; | ||
| 1294 | 1298 | ||
| 1295 | struct input_absinfo *absinfo; | 1299 | struct input_absinfo *absinfo; |
| 1296 | 1300 | ||
| @@ -1312,12 +1316,14 @@ struct input_dev { | |||
| 1312 | unsigned int users; | 1316 | unsigned int users; |
| 1313 | bool going_away; | 1317 | bool going_away; |
| 1314 | 1318 | ||
| 1315 | bool sync; | ||
| 1316 | |||
| 1317 | struct device dev; | 1319 | struct device dev; |
| 1318 | 1320 | ||
| 1319 | struct list_head h_list; | 1321 | struct list_head h_list; |
| 1320 | struct list_head node; | 1322 | struct list_head node; |
| 1323 | |||
| 1324 | unsigned int num_vals; | ||
| 1325 | unsigned int max_vals; | ||
| 1326 | struct input_value *vals; | ||
| 1321 | }; | 1327 | }; |
| 1322 | #define to_input_dev(d) container_of(d, struct input_dev, dev) | 1328 | #define to_input_dev(d) container_of(d, struct input_dev, dev) |
| 1323 | 1329 | ||
| @@ -1378,6 +1384,9 @@ struct input_handle; | |||
| 1378 | * @event: event handler. This method is being called by input core with | 1384 | * @event: event handler. This method is being called by input core with |
| 1379 | * interrupts disabled and dev->event_lock spinlock held and so | 1385 | * interrupts disabled and dev->event_lock spinlock held and so |
| 1380 | * it may not sleep | 1386 | * it may not sleep |
| 1387 | * @events: event sequence handler. This method is being called by | ||
| 1388 | * input core with interrupts disabled and dev->event_lock | ||
| 1389 | * spinlock held and so it may not sleep | ||
| 1381 | * @filter: similar to @event; separates normal event handlers from | 1390 | * @filter: similar to @event; separates normal event handlers from |
| 1382 | * "filters". | 1391 | * "filters". |
| 1383 | * @match: called after comparing device's id with handler's id_table | 1392 | * @match: called after comparing device's id with handler's id_table |
| @@ -1387,8 +1396,8 @@ struct input_handle; | |||
| 1387 | * @start: starts handler for given handle. This function is called by | 1396 | * @start: starts handler for given handle. This function is called by |
| 1388 | * input core right after connect() method and also when a process | 1397 | * input core right after connect() method and also when a process |
| 1389 | * that "grabbed" a device releases it | 1398 | * that "grabbed" a device releases it |
| 1390 | * @fops: file operations this driver implements | 1399 | * @legacy_minors: set to %true by drivers using legacy minor ranges |
| 1391 | * @minor: beginning of range of 32 minors for devices this driver | 1400 | * @minor: beginning of range of 32 legacy minors for devices this driver |
| 1392 | * can provide | 1401 | * can provide |
| 1393 | * @name: name of the handler, to be shown in /proc/bus/input/handlers | 1402 | * @name: name of the handler, to be shown in /proc/bus/input/handlers |
| 1394 | * @id_table: pointer to a table of input_device_ids this driver can | 1403 | * @id_table: pointer to a table of input_device_ids this driver can |
| @@ -1414,13 +1423,15 @@ struct input_handler { | |||
| 1414 | void *private; | 1423 | void *private; |
| 1415 | 1424 | ||
| 1416 | void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); | 1425 | void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); |
| 1426 | void (*events)(struct input_handle *handle, | ||
| 1427 | const struct input_value *vals, unsigned int count); | ||
| 1417 | bool (*filter)(struct input_handle *handle, unsigned int type, unsigned int code, int value); | 1428 | bool (*filter)(struct input_handle *handle, unsigned int type, unsigned int code, int value); |
| 1418 | bool (*match)(struct input_handler *handler, struct input_dev *dev); | 1429 | bool (*match)(struct input_handler *handler, struct input_dev *dev); |
| 1419 | int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); | 1430 | int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); |
| 1420 | void (*disconnect)(struct input_handle *handle); | 1431 | void (*disconnect)(struct input_handle *handle); |
| 1421 | void (*start)(struct input_handle *handle); | 1432 | void (*start)(struct input_handle *handle); |
| 1422 | 1433 | ||
| 1423 | const struct file_operations *fops; | 1434 | bool legacy_minors; |
| 1424 | int minor; | 1435 | int minor; |
| 1425 | const char *name; | 1436 | const char *name; |
| 1426 | 1437 | ||
| @@ -1488,6 +1499,10 @@ void input_reset_device(struct input_dev *); | |||
| 1488 | int __must_check input_register_handler(struct input_handler *); | 1499 | int __must_check input_register_handler(struct input_handler *); |
| 1489 | void input_unregister_handler(struct input_handler *); | 1500 | void input_unregister_handler(struct input_handler *); |
| 1490 | 1501 | ||
| 1502 | int __must_check input_get_new_minor(int legacy_base, unsigned int legacy_num, | ||
| 1503 | bool allow_dynamic); | ||
| 1504 | void input_free_minor(unsigned int minor); | ||
| 1505 | |||
| 1491 | int input_handler_for_each_handle(struct input_handler *, void *data, | 1506 | int input_handler_for_each_handle(struct input_handler *, void *data, |
| 1492 | int (*fn)(struct input_handle *, void *)); | 1507 | int (*fn)(struct input_handle *, void *)); |
| 1493 | 1508 | ||
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h index f86737586e1..cc5cca774ba 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 |
