aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/input.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-04 21:13:17 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-04 21:16:12 -0400
commita3d52136ee8f7399859f9a0824470fd49b1d1a00 (patch)
treeac0fd3d1efc356029cbbc5e413f778f7231cd909 /include/linux/input.h
parent5b339915762d30b21995aa7263e74081f2f1110a (diff)
parent84767d00a8fd54dd97866561f6e2ee246c8e1cdc (diff)
Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/dtor/input: (65 commits) Input: gpio_keys - add support for switches (EV_SW) Input: cobalt_btns - convert to use polldev library Input: add skeleton for simple polled devices Input: update some documentation Input: wistron - fix typo in keymap for Acer TM610 Input: add input_set_capability() helper Input: i8042 - add Fujitsu touchscreen/touchpad PNP IDs Input: i8042 - add Panasonic CF-29 to nomux list Input: lifebook - split into 2 devices Input: lifebook - add signature of Panasonic CF-29 Input: lifebook - activate 6-byte protocol on select models Input: lifebook - work properly on Panasonic CF-18 Input: cobalt buttons - separate device and driver registration Input: ati_remote - make button repeat sensitivity configurable Input: pxa27x - do not use deprecated SA_INTERRUPT flag Input: ucb1400 - make delays configurable Input: misc devices - switch to using input_dev->dev.parent Input: joysticks - switch to using input_dev->dev.parent Input: touchscreens - switch to using input_dev->dev.parent Input: mice - switch to using input_dev->dev.parent ... Fixed up conflicts with core device model removal of "struct subsystem" manually. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/input.h')
-rw-r--r--include/linux/input.h52
1 files changed, 23 insertions, 29 deletions
diff --git a/include/linux/input.h b/include/linux/input.h
index 327122548c4d..439954d09752 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -506,6 +506,7 @@ struct input_absinfo {
506#define KEY_VOICEMAIL 0x1ac 506#define KEY_VOICEMAIL 0x1ac
507#define KEY_ADDRESSBOOK 0x1ad 507#define KEY_ADDRESSBOOK 0x1ad
508#define KEY_MESSENGER 0x1ae 508#define KEY_MESSENGER 0x1ae
509#define KEY_DISPLAYTOGGLE 0x1af /* Turn display (LCD) on and off */
509 510
510#define KEY_DEL_EOL 0x1c0 511#define KEY_DEL_EOL 0x1c0
511#define KEY_DEL_EOS 0x1c1 512#define KEY_DEL_EOS 0x1c1
@@ -914,33 +915,6 @@ struct ff_effect {
914#define BIT(x) (1UL<<((x)%BITS_PER_LONG)) 915#define BIT(x) (1UL<<((x)%BITS_PER_LONG))
915#define LONG(x) ((x)/BITS_PER_LONG) 916#define LONG(x) ((x)/BITS_PER_LONG)
916 917
917#define INPUT_KEYCODE(dev, scancode) ((dev->keycodesize == 1) ? ((u8*)dev->keycode)[scancode] : \
918 ((dev->keycodesize == 2) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode])))
919
920#define SET_INPUT_KEYCODE(dev, scancode, val) \
921 ({ unsigned __old; \
922 switch (dev->keycodesize) { \
923 case 1: { \
924 u8 *k = (u8 *)dev->keycode; \
925 __old = k[scancode]; \
926 k[scancode] = val; \
927 break; \
928 } \
929 case 2: { \
930 u16 *k = (u16 *)dev->keycode; \
931 __old = k[scancode]; \
932 k[scancode] = val; \
933 break; \
934 } \
935 default: { \
936 u32 *k = (u32 *)dev->keycode; \
937 __old = k[scancode]; \
938 k[scancode] = val; \
939 break; \
940 } \
941 } \
942 __old; })
943
944struct input_dev { 918struct input_dev {
945 919
946 void *private; 920 void *private;
@@ -963,6 +937,8 @@ struct input_dev {
963 unsigned int keycodemax; 937 unsigned int keycodemax;
964 unsigned int keycodesize; 938 unsigned int keycodesize;
965 void *keycode; 939 void *keycode;
940 int (*setkeycode)(struct input_dev *dev, int scancode, int keycode);
941 int (*getkeycode)(struct input_dev *dev, int scancode, int *keycode);
966 942
967 struct ff_device *ff; 943 struct ff_device *ff;
968 944
@@ -997,6 +973,9 @@ struct input_dev {
997 unsigned int users; 973 unsigned int users;
998 974
999 struct class_device cdev; 975 struct class_device cdev;
976 union { /* temporarily so while we switching to struct device */
977 struct device *parent;
978 } dev;
1000 979
1001 struct list_head h_list; 980 struct list_head h_list;
1002 struct list_head node; 981 struct list_head node;
@@ -1075,7 +1054,7 @@ struct input_handler {
1075 void *private; 1054 void *private;
1076 1055
1077 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); 1056 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
1078 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); 1057 int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);
1079 void (*disconnect)(struct input_handle *handle); 1058 void (*disconnect)(struct input_handle *handle);
1080 void (*start)(struct input_handle *handle); 1059 void (*start)(struct input_handle *handle);
1081 1060
@@ -1105,7 +1084,7 @@ struct input_handle {
1105}; 1084};
1106 1085
1107#define to_dev(n) container_of(n,struct input_dev,node) 1086#define to_dev(n) container_of(n,struct input_dev,node)
1108#define to_handler(n) container_of(n,struct input_handler,node); 1087#define to_handler(n) container_of(n,struct input_handler,node)
1109#define to_handle(n) container_of(n,struct input_handle,d_node) 1088#define to_handle(n) container_of(n,struct input_handle,d_node)
1110#define to_handle_h(n) container_of(n,struct input_handle,h_node) 1089#define to_handle_h(n) container_of(n,struct input_handle,h_node)
1111 1090
@@ -1122,12 +1101,25 @@ static inline void input_put_device(struct input_dev *dev)
1122 class_device_put(&dev->cdev); 1101 class_device_put(&dev->cdev);
1123} 1102}
1124 1103
1104static inline void *input_get_drvdata(struct input_dev *dev)
1105{
1106 return dev->private;
1107}
1108
1109static inline void input_set_drvdata(struct input_dev *dev, void *data)
1110{
1111 dev->private = data;
1112}
1113
1125int input_register_device(struct input_dev *); 1114int input_register_device(struct input_dev *);
1126void input_unregister_device(struct input_dev *); 1115void input_unregister_device(struct input_dev *);
1127 1116
1128int input_register_handler(struct input_handler *); 1117int input_register_handler(struct input_handler *);
1129void input_unregister_handler(struct input_handler *); 1118void input_unregister_handler(struct input_handler *);
1130 1119
1120int input_register_handle(struct input_handle *);
1121void input_unregister_handle(struct input_handle *);
1122
1131int input_grab_device(struct input_handle *); 1123int input_grab_device(struct input_handle *);
1132void input_release_device(struct input_handle *); 1124void input_release_device(struct input_handle *);
1133 1125
@@ -1169,6 +1161,8 @@ static inline void input_sync(struct input_dev *dev)
1169 input_event(dev, EV_SYN, SYN_REPORT, 0); 1161 input_event(dev, EV_SYN, SYN_REPORT, 0);
1170} 1162}
1171 1163
1164void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
1165
1172static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) 1166static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat)
1173{ 1167{
1174 dev->absmin[axis] = min; 1168 dev->absmin[axis] = min;