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.h57
1 files changed, 28 insertions, 29 deletions
diff --git a/include/linux/input.h b/include/linux/input.h
index bde65c8a3519..be2bf3a2b031 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
@@ -676,6 +677,7 @@ struct input_absinfo {
676#define BUS_I2C 0x18 677#define BUS_I2C 0x18
677#define BUS_HOST 0x19 678#define BUS_HOST 0x19
678#define BUS_GSC 0x1A 679#define BUS_GSC 0x1A
680#define BUS_ATARI 0x1B
679 681
680/* 682/*
681 * Values describing the status of a force-feedback effect 683 * Values describing the status of a force-feedback effect
@@ -913,33 +915,6 @@ struct ff_effect {
913#define BIT(x) (1UL<<((x)%BITS_PER_LONG)) 915#define BIT(x) (1UL<<((x)%BITS_PER_LONG))
914#define LONG(x) ((x)/BITS_PER_LONG) 916#define LONG(x) ((x)/BITS_PER_LONG)
915 917
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 { 918struct input_dev {
944 919
945 void *private; 920 void *private;
@@ -962,6 +937,8 @@ struct input_dev {
962 unsigned int keycodemax; 937 unsigned int keycodemax;
963 unsigned int keycodesize; 938 unsigned int keycodesize;
964 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);
965 942
966 struct ff_device *ff; 943 struct ff_device *ff;
967 944
@@ -996,6 +973,9 @@ struct input_dev {
996 unsigned int users; 973 unsigned int users;
997 974
998 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;
999 979
1000 struct list_head h_list; 980 struct list_head h_list;
1001 struct list_head node; 981 struct list_head node;
@@ -1010,6 +990,10 @@ struct input_dev {
1010#error "EV_MAX and INPUT_DEVICE_ID_EV_MAX do not match" 990#error "EV_MAX and INPUT_DEVICE_ID_EV_MAX do not match"
1011#endif 991#endif
1012 992
993#if KEY_MIN_INTERESTING != INPUT_DEVICE_ID_KEY_MIN_INTERESTING
994#error "KEY_MIN_INTERESTING and INPUT_DEVICE_ID_KEY_MIN_INTERESTING do not match"
995#endif
996
1013#if KEY_MAX != INPUT_DEVICE_ID_KEY_MAX 997#if KEY_MAX != INPUT_DEVICE_ID_KEY_MAX
1014#error "KEY_MAX and INPUT_DEVICE_ID_KEY_MAX do not match" 998#error "KEY_MAX and INPUT_DEVICE_ID_KEY_MAX do not match"
1015#endif 999#endif
@@ -1074,7 +1058,7 @@ struct input_handler {
1074 void *private; 1058 void *private;
1075 1059
1076 void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value); 1060 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); 1061 int (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);
1078 void (*disconnect)(struct input_handle *handle); 1062 void (*disconnect)(struct input_handle *handle);
1079 void (*start)(struct input_handle *handle); 1063 void (*start)(struct input_handle *handle);
1080 1064
@@ -1104,7 +1088,7 @@ struct input_handle {
1104}; 1088};
1105 1089
1106#define to_dev(n) container_of(n,struct input_dev,node) 1090#define to_dev(n) container_of(n,struct input_dev,node)
1107#define to_handler(n) container_of(n,struct input_handler,node); 1091#define to_handler(n) container_of(n,struct input_handler,node)
1108#define to_handle(n) container_of(n,struct input_handle,d_node) 1092#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) 1093#define to_handle_h(n) container_of(n,struct input_handle,h_node)
1110 1094
@@ -1121,12 +1105,25 @@ static inline void input_put_device(struct input_dev *dev)
1121 class_device_put(&dev->cdev); 1105 class_device_put(&dev->cdev);
1122} 1106}
1123 1107
1108static inline void *input_get_drvdata(struct input_dev *dev)
1109{
1110 return dev->private;
1111}
1112
1113static inline void input_set_drvdata(struct input_dev *dev, void *data)
1114{
1115 dev->private = data;
1116}
1117
1124int input_register_device(struct input_dev *); 1118int input_register_device(struct input_dev *);
1125void input_unregister_device(struct input_dev *); 1119void input_unregister_device(struct input_dev *);
1126 1120
1127int input_register_handler(struct input_handler *); 1121int input_register_handler(struct input_handler *);
1128void input_unregister_handler(struct input_handler *); 1122void input_unregister_handler(struct input_handler *);
1129 1123
1124int input_register_handle(struct input_handle *);
1125void input_unregister_handle(struct input_handle *);
1126
1130int input_grab_device(struct input_handle *); 1127int input_grab_device(struct input_handle *);
1131void input_release_device(struct input_handle *); 1128void input_release_device(struct input_handle *);
1132 1129
@@ -1168,6 +1165,8 @@ static inline void input_sync(struct input_dev *dev)
1168 input_event(dev, EV_SYN, SYN_REPORT, 0); 1165 input_event(dev, EV_SYN, SYN_REPORT, 0);
1169} 1166}
1170 1167
1168void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
1169
1171static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) 1170static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat)
1172{ 1171{
1173 dev->absmin[axis] = min; 1172 dev->absmin[axis] = min;