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.h53
1 files changed, 24 insertions, 29 deletions
diff --git a/include/linux/input.h b/include/linux/input.h
index 13d510c3a5aa..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;
@@ -1078,7 +1058,7 @@ struct input_handler {
1078 void *private; 1058 void *private;
1079 1059
1080 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);
1081 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);
1082 void (*disconnect)(struct input_handle *handle); 1062 void (*disconnect)(struct input_handle *handle);
1083 void (*start)(struct input_handle *handle); 1063 void (*start)(struct input_handle *handle);
1084 1064
@@ -1108,7 +1088,7 @@ struct input_handle {
1108}; 1088};
1109 1089
1110#define to_dev(n) container_of(n,struct input_dev,node) 1090#define to_dev(n) container_of(n,struct input_dev,node)
1111#define to_handler(n) container_of(n,struct input_handler,node); 1091#define to_handler(n) container_of(n,struct input_handler,node)
1112#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)
1113#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)
1114 1094
@@ -1125,12 +1105,25 @@ static inline void input_put_device(struct input_dev *dev)
1125 class_device_put(&dev->cdev); 1105 class_device_put(&dev->cdev);
1126} 1106}
1127 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
1128int input_register_device(struct input_dev *); 1118int input_register_device(struct input_dev *);
1129void input_unregister_device(struct input_dev *); 1119void input_unregister_device(struct input_dev *);
1130 1120
1131int input_register_handler(struct input_handler *); 1121int input_register_handler(struct input_handler *);
1132void input_unregister_handler(struct input_handler *); 1122void input_unregister_handler(struct input_handler *);
1133 1123
1124int input_register_handle(struct input_handle *);
1125void input_unregister_handle(struct input_handle *);
1126
1134int input_grab_device(struct input_handle *); 1127int input_grab_device(struct input_handle *);
1135void input_release_device(struct input_handle *); 1128void input_release_device(struct input_handle *);
1136 1129
@@ -1172,6 +1165,8 @@ static inline void input_sync(struct input_dev *dev)
1172 input_event(dev, EV_SYN, SYN_REPORT, 0); 1165 input_event(dev, EV_SYN, SYN_REPORT, 0);
1173} 1166}
1174 1167
1168void input_set_capability(struct input_dev *dev, unsigned int type, unsigned int code);
1169
1175static 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)
1176{ 1171{
1177 dev->absmin[axis] = min; 1172 dev->absmin[axis] = min;