aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/input.h
diff options
context:
space:
mode:
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 bde65c8a3519..1789ee9df4dd 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
@@ -913,33 +914,6 @@ struct ff_effect {
913#define BIT(x) (1UL<<((x)%BITS_PER_LONG)) 914#define BIT(x) (1UL<<((x)%BITS_PER_LONG))
914#define LONG(x) ((x)/BITS_PER_LONG) 915#define LONG(x) ((x)/BITS_PER_LONG)
915 916
916#define INPUT_KEYCODE(dev, scancode) ((dev->keycodesize == 1) ? ((u8*)dev->keycode)[scancode] : \
917 ((dev->keycodesize == 2) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode])))
918
919#define SET_INPUT_KEYCODE(dev, scancode, val) \
920 ({ unsigned __old; \
921 switch (dev->keycodesize) { \
922 case 1: { \
923 u8 *k = (u8 *)dev->keycode; \
924 __old = k[scancode]; \
925 k[scancode] = val; \
926 break; \
927 } \
928 case 2: { \
929 u16 *k = (u16 *)dev->keycode; \
930 __old = k[scancode]; \
931 k[scancode] = val; \
932 break; \
933 } \
934 default: { \
935 u32 *k = (u32 *)dev->keycode; \
936 __old = k[scancode]; \
937 k[scancode] = val; \
938 break; \
939 } \
940 } \
941 __old; })
942
943struct input_dev { 917struct input_dev {
944 918
945 void *private; 919 void *private;
@@ -962,6 +936,8 @@ struct input_dev {
962 unsigned int keycodemax; 936 unsigned int keycodemax;
963 unsigned int keycodesize; 937 unsigned int keycodesize;
964 void *keycode; 938 void *keycode;
939 int (*setkeycode)(struct input_dev *dev, int scancode, int keycode);
940 int (*getkeycode)(struct input_dev *dev, int scancode, int *keycode);
965 941
966 struct ff_device *ff; 942 struct ff_device *ff;
967 943
@@ -996,6 +972,9 @@ struct input_dev {
996 unsigned int users; 972 unsigned int users;
997 973
998 struct class_device cdev; 974 struct class_device cdev;
975 union { /* temporarily so while we switching to struct device */
976 struct device *parent;
977 } dev;
999 978
1000 struct list_head h_list; 979 struct list_head h_list;
1001 struct list_head node; 980 struct list_head node;
@@ -1074,7 +1053,7 @@ struct input_handler {
1074 void *private; 1053 void *private;
1075 1054
1076 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); 1055 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
1077 struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id); 1056 int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);
1078 void (*disconnect)(struct input_handle *handle); 1057 void (*disconnect)(struct input_handle *handle);
1079 void (*start)(struct input_handle *handle); 1058 void (*start)(struct input_handle *handle);
1080 1059
@@ -1104,7 +1083,7 @@ struct input_handle {
1104}; 1083};
1105 1084
1106#define to_dev(n) container_of(n,struct input_dev,node) 1085#define to_dev(n) container_of(n,struct input_dev,node)
1107#define to_handler(n) container_of(n,struct input_handler,node); 1086#define to_handler(n) container_of(n,struct input_handler,node)
1108#define to_handle(n) container_of(n,struct input_handle,d_node) 1087#define to_handle(n) container_of(n,struct input_handle,d_node)
1109#define to_handle_h(n) container_of(n,struct input_handle,h_node) 1088#define to_handle_h(n) container_of(n,struct input_handle,h_node)
1110 1089
@@ -1121,12 +1100,25 @@ static inline void input_put_device(struct input_dev *dev)
1121 class_device_put(&dev->cdev); 1100 class_device_put(&dev->cdev);
1122} 1101}
1123 1102
1103static inline void *input_get_drvdata(struct input_dev *dev)
1104{
1105 return dev->private;
1106}
1107
1108static inline void input_set_drvdata(struct input_dev *dev, void *data)
1109{
1110 dev->private = data;
1111}
1112
1124int input_register_device(struct input_dev *); 1113int input_register_device(struct input_dev *);
1125void input_unregister_device(struct input_dev *); 1114void input_unregister_device(struct input_dev *);
1126 1115
1127int input_register_handler(struct input_handler *); 1116int input_register_handler(struct input_handler *);
1128void input_unregister_handler(struct input_handler *); 1117void input_unregister_handler(struct input_handler *);
1129 1118
1119int input_register_handle(struct input_handle *);
1120void input_unregister_handle(struct input_handle *);
1121
1130int input_grab_device(struct input_handle *); 1122int input_grab_device(struct input_handle *);
1131void input_release_device(struct input_handle *); 1123void input_release_device(struct input_handle *);
1132 1124
@@ -1168,6 +1160,8 @@ static inline void input_sync(struct input_dev *dev)
1168 input_event(dev, EV_SYN, SYN_REPORT, 0); 1160 input_event(dev, EV_SYN, SYN_REPORT, 0);
1169} 1161}
1170 1162
1163void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
1164
1171static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) 1165static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat)
1172{ 1166{
1173 dev->absmin[axis] = min; 1167 dev->absmin[axis] = min;