Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / include / linux / input.h
index 77ba731..ce1a756 100644 (file)
@@ -56,6 +56,8 @@ struct input_absinfo {
 
 #define EVIOCGVERSION          _IOR('E', 0x01, int)                    /* get driver version */
 #define EVIOCGID               _IOR('E', 0x02, struct input_id)        /* get device ID */
+#define EVIOCGREP              _IOR('E', 0x03, int[2])                 /* get repeat settings */
+#define EVIOCSREP              _IOW('E', 0x03, int[2])                 /* set repeat settings */
 #define EVIOCGKEYCODE          _IOR('E', 0x04, int[2])                 /* get keycode */
 #define EVIOCSKEYCODE          _IOW('E', 0x04, int[2])                 /* set keycode */
 
@@ -66,6 +68,7 @@ struct input_absinfo {
 #define EVIOCGKEY(len)         _IOC(_IOC_READ, 'E', 0x18, len)         /* get global keystate */
 #define EVIOCGLED(len)         _IOC(_IOC_READ, 'E', 0x19, len)         /* get all LEDs */
 #define EVIOCGSND(len)         _IOC(_IOC_READ, 'E', 0x1a, len)         /* get all sounds status */
+#define EVIOCGSW(len)          _IOC(_IOC_READ, 'E', 0x1b, len)         /* get all switch states */
 
 #define EVIOCGBIT(ev,len)      _IOC(_IOC_READ, 'E', 0x20 + ev, len)    /* get event bits */
 #define EVIOCGABS(abs)         _IOR('E', 0x40 + abs, struct input_absinfo)             /* get abs value/limits */
@@ -86,6 +89,7 @@ struct input_absinfo {
 #define EV_REL                 0x02
 #define EV_ABS                 0x03
 #define EV_MSC                 0x04
+#define EV_SW                  0x05
 #define EV_LED                 0x11
 #define EV_SND                 0x12
 #define EV_REP                 0x14
@@ -287,6 +291,8 @@ struct input_absinfo {
 #define KEY_SCROLLDOWN         178
 #define KEY_KPLEFTPAREN                179
 #define KEY_KPRIGHTPAREN       180
+#define KEY_NEW                        181
+#define KEY_REDO               182
 
 #define KEY_F13                        183
 #define KEY_F14                        184
@@ -328,6 +334,19 @@ struct input_absinfo {
 #define KEY_BRIGHTNESSUP       225
 #define KEY_MEDIA              226
 
+#define KEY_SWITCHVIDEOMODE    227
+#define KEY_KBDILLUMTOGGLE     228
+#define KEY_KBDILLUMDOWN       229
+#define KEY_KBDILLUMUP         230
+
+#define KEY_SEND               231
+#define KEY_REPLY              232
+#define KEY_FORWARDMAIL                233
+#define KEY_SAVE               234
+#define KEY_DOCUMENTS          235
+
+#define KEY_BATTERY            236
+
 #define KEY_UNKNOWN            240
 
 #define BTN_MISC               0x100
@@ -404,7 +423,7 @@ struct input_absinfo {
 #define BTN_GEAR_UP            0x151
 
 #define KEY_OK                 0x160
-#define KEY_SELECT             0x161
+#define KEY_SELECT             0x161
 #define KEY_GOTO               0x162
 #define KEY_CLEAR              0x163
 #define KEY_POWER2             0x164
@@ -473,6 +492,39 @@ struct input_absinfo {
 #define KEY_INS_LINE           0x1c2
 #define KEY_DEL_LINE           0x1c3
 
+#define KEY_FN                 0x1d0
+#define KEY_FN_ESC             0x1d1
+#define KEY_FN_F1              0x1d2
+#define KEY_FN_F2              0x1d3
+#define KEY_FN_F3              0x1d4
+#define KEY_FN_F4              0x1d5
+#define KEY_FN_F5              0x1d6
+#define KEY_FN_F6              0x1d7
+#define KEY_FN_F7              0x1d8
+#define KEY_FN_F8              0x1d9
+#define KEY_FN_F9              0x1da
+#define KEY_FN_F10             0x1db
+#define KEY_FN_F11             0x1dc
+#define KEY_FN_F12             0x1dd
+#define KEY_FN_1               0x1de
+#define KEY_FN_2               0x1df
+#define KEY_FN_D               0x1e0
+#define KEY_FN_E               0x1e1
+#define KEY_FN_F               0x1e2
+#define KEY_FN_S               0x1e3
+#define KEY_FN_B               0x1e4
+
+#define KEY_BRL_DOT1           0x1f1
+#define KEY_BRL_DOT2           0x1f2
+#define KEY_BRL_DOT3           0x1f3
+#define KEY_BRL_DOT4           0x1f4
+#define KEY_BRL_DOT5           0x1f5
+#define KEY_BRL_DOT6           0x1f6
+#define KEY_BRL_DOT7           0x1f7
+#define KEY_BRL_DOT8           0x1f8
+
+/* We avoid low common keys in module aliases so they don't get huge. */
+#define KEY_MIN_INTERESTING    KEY_MUTE
 #define KEY_MAX                        0x1ff
 
 /*
@@ -482,6 +534,9 @@ struct input_absinfo {
 #define REL_X                  0x00
 #define REL_Y                  0x01
 #define REL_Z                  0x02
+#define REL_RX                 0x03
+#define REL_RY                 0x04
+#define REL_RZ                 0x05
 #define REL_HWHEEL             0x06
 #define REL_DIAL               0x07
 #define REL_WHEEL              0x08
@@ -520,6 +575,15 @@ struct input_absinfo {
 #define ABS_MISC               0x28
 #define ABS_MAX                        0x3f
 
+/*
+ * Switch events
+ */
+
+#define SW_LID                 0x00  /* set = lid shut */
+#define SW_TABLET_MODE         0x01  /* set = tablet mode */
+#define SW_HEADPHONE_INSERT    0x02  /* set = inserted */
+#define SW_MAX                 0x0f
+
 /*
  * Misc events
  */
@@ -527,6 +591,8 @@ struct input_absinfo {
 #define MSC_SERIAL             0x00
 #define MSC_PULSELED           0x01
 #define MSC_GESTURE            0x02
+#define MSC_RAW                        0x03
+#define MSC_SCAN               0x04
 #define MSC_MAX                        0x07
 
 /*
@@ -542,6 +608,8 @@ struct input_absinfo {
 #define LED_SUSPEND            0x06
 #define LED_MUTE               0x07
 #define LED_MISC               0x08
+#define LED_MAIL               0x09
+#define LED_CHARGING           0x0a
 #define LED_MAX                        0x0f
 
 /*
@@ -586,6 +654,7 @@ struct input_absinfo {
 #define BUS_ADB                        0x17
 #define BUS_I2C                        0x18
 #define BUS_HOST               0x19
+#define BUS_GSC                        0x1A
 
 /*
  * Values describing the status of an effect
@@ -655,7 +724,7 @@ struct ff_periodic_effect {
        struct ff_envelope envelope;
 
 /* Only used if waveform == FF_CUSTOM */
-       __u32 custom_len;       /* Number of samples  */        
+       __u32 custom_len;       /* Number of samples */
        __s16 *custom_data;     /* Buffer of samples */
 /* Note: the data pointed by custom_data is copied by the driver. You can
  * therefore dispose of the memory after the upload/update */
@@ -739,18 +808,18 @@ struct ff_effect {
  * In-kernel definitions.
  */
 
+#include <linux/device.h>
 #include <linux/fs.h>
 #include <linux/timer.h>
+#include <linux/mod_devicetable.h>
 
-#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
+#define NBITS(x) (((x)/BITS_PER_LONG)+1)
 #define BIT(x) (1UL<<((x)%BITS_PER_LONG))
 #define LONG(x) ((x)/BITS_PER_LONG)
 
 #define INPUT_KEYCODE(dev, scancode) ((dev->keycodesize == 1) ? ((u8*)dev->keycode)[scancode] : \
        ((dev->keycodesize == 2) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode])))
 
-#define init_input_dev(dev)    do { INIT_LIST_HEAD(&((dev)->h_list)); INIT_LIST_HEAD(&((dev)->node)); } while (0)
-
 #define SET_INPUT_KEYCODE(dev, scancode, val)                  \
                ({      unsigned __old;                         \
                switch (dev->keycodesize) {                     \
@@ -779,9 +848,9 @@ struct input_dev {
 
        void *private;
 
-       char *name;
-       char *phys;
-       char *uniq;
+       const char *name;
+       const char *phys;
+       const char *uniq;
        struct input_id id;
 
        unsigned long evbit[NBITS(EV_MAX)];
@@ -792,6 +861,7 @@ struct input_dev {
        unsigned long ledbit[NBITS(LED_MAX)];
        unsigned long sndbit[NBITS(SND_MAX)];
        unsigned long ffbit[NBITS(FF_MAX)];
+       unsigned long swbit[NBITS(SW_MAX)];
        int ff_effects_max;
 
        unsigned int keycodemax;
@@ -801,7 +871,6 @@ struct input_dev {
        unsigned int repeat_key;
        struct timer_list timer;
 
-       struct pm_dev *pm_dev;
        struct pt_regs *regs;
        int state;
 
@@ -813,6 +882,7 @@ struct input_dev {
        unsigned long key[NBITS(KEY_MAX)];
        unsigned long led[NBITS(LED_MAX)];
        unsigned long snd[NBITS(SND_MAX)];
+       unsigned long sw[NBITS(SW_MAX)];
 
        int absmax[ABS_MAX + 1];
        int absmin[ABS_MAX + 1];
@@ -828,52 +898,64 @@ struct input_dev {
        int (*erase_effect)(struct input_dev *dev, int effect_id);
 
        struct input_handle *grab;
-       struct device *dev;
+
+       struct mutex mutex;     /* serializes open and close operations */
+       unsigned int users;
+
+       struct class_device cdev;
+       struct device *dev;     /* will be removed soon */
+
+       int dynalloc;   /* temporarily */
 
        struct list_head        h_list;
        struct list_head        node;
 };
+#define to_input_dev(d) container_of(d, struct input_dev, cdev)
 
 /*
- * Structure for hotplug & device<->driver matching.
+ * Verify that we are in sync with input_device_id mod_devicetable.h #defines
  */
 
-#define INPUT_DEVICE_ID_MATCH_BUS      1
-#define INPUT_DEVICE_ID_MATCH_VENDOR   2
-#define INPUT_DEVICE_ID_MATCH_PRODUCT  4
-#define INPUT_DEVICE_ID_MATCH_VERSION  8
-
-#define INPUT_DEVICE_ID_MATCH_EVBIT    0x010
-#define INPUT_DEVICE_ID_MATCH_KEYBIT   0x020
-#define INPUT_DEVICE_ID_MATCH_RELBIT   0x040
-#define INPUT_DEVICE_ID_MATCH_ABSBIT   0x080
-#define INPUT_DEVICE_ID_MATCH_MSCIT    0x100
-#define INPUT_DEVICE_ID_MATCH_LEDBIT   0x200
-#define INPUT_DEVICE_ID_MATCH_SNDBIT   0x400
-#define INPUT_DEVICE_ID_MATCH_FFBIT    0x800
-
-#define INPUT_DEVICE_ID_MATCH_DEVICE\
-       (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
-#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION\
-       (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)
+#if EV_MAX != INPUT_DEVICE_ID_EV_MAX
+#error "EV_MAX and INPUT_DEVICE_ID_EV_MAX do not match"
+#endif
 
-struct input_device_id {
+#if KEY_MAX != INPUT_DEVICE_ID_KEY_MAX
+#error "KEY_MAX and INPUT_DEVICE_ID_KEY_MAX do not match"
+#endif
 
-       unsigned long flags;
+#if REL_MAX != INPUT_DEVICE_ID_REL_MAX
+#error "REL_MAX and INPUT_DEVICE_ID_REL_MAX do not match"
+#endif
 
-       struct input_id id;
+#if ABS_MAX != INPUT_DEVICE_ID_ABS_MAX
+#error "ABS_MAX and INPUT_DEVICE_ID_ABS_MAX do not match"
+#endif
 
-       unsigned long evbit[NBITS(EV_MAX)];
-       unsigned long keybit[NBITS(KEY_MAX)];
-       unsigned long relbit[NBITS(REL_MAX)];
-       unsigned long absbit[NBITS(ABS_MAX)];
-       unsigned long mscbit[NBITS(MSC_MAX)];
-       unsigned long ledbit[NBITS(LED_MAX)];
-       unsigned long sndbit[NBITS(SND_MAX)];
-       unsigned long ffbit[NBITS(FF_MAX)];
+#if MSC_MAX != INPUT_DEVICE_ID_MSC_MAX
+#error "MSC_MAX and INPUT_DEVICE_ID_MSC_MAX do not match"
+#endif
 
-       unsigned long driver_info;
-};
+#if LED_MAX != INPUT_DEVICE_ID_LED_MAX
+#error "LED_MAX and INPUT_DEVICE_ID_LED_MAX do not match"
+#endif
+
+#if SND_MAX != INPUT_DEVICE_ID_SND_MAX
+#error "SND_MAX and INPUT_DEVICE_ID_SND_MAX do not match"
+#endif
+
+#if FF_MAX != INPUT_DEVICE_ID_FF_MAX
+#error "FF_MAX and INPUT_DEVICE_ID_FF_MAX do not match"
+#endif
+
+#if SW_MAX != INPUT_DEVICE_ID_SW_MAX
+#error "SW_MAX and INPUT_DEVICE_ID_SW_MAX do not match"
+#endif
+
+#define INPUT_DEVICE_ID_MATCH_DEVICE \
+       (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
+#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION \
+       (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)
 
 struct input_handle;
 
@@ -885,7 +967,7 @@ struct input_handler {
        struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id);
        void (*disconnect)(struct input_handle *handle);
 
-       struct file_operations *fops;
+       const struct file_operations *fops;
        int minor;
        char *name;
 
@@ -915,7 +997,31 @@ struct input_handle {
 #define to_handle(n) container_of(n,struct input_handle,d_node)
 #define to_handle_h(n) container_of(n,struct input_handle,h_node)
 
-void input_register_device(struct input_dev *);
+static inline void init_input_dev(struct input_dev *dev)
+{
+       INIT_LIST_HEAD(&dev->h_list);
+       INIT_LIST_HEAD(&dev->node);
+}
+
+struct input_dev *input_allocate_device(void);
+
+static inline struct input_dev *input_get_device(struct input_dev *dev)
+{
+       return to_input_dev(class_device_get(&dev->cdev));
+}
+
+static inline void input_put_device(struct input_dev *dev)
+{
+       class_device_put(&dev->cdev);
+}
+
+static inline void input_free_device(struct input_dev *dev)
+{
+       if (dev)
+               input_put_device(dev);
+}
+
+int input_register_device(struct input_dev *);
 void input_unregister_device(struct input_dev *);
 
 void input_register_handler(struct input_handler *);
@@ -932,16 +1038,58 @@ int input_flush_device(struct input_handle* handle, struct file* file);
 
 void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
 
-#define input_report_key(a,b,c) input_event(a, EV_KEY, b, !!(c))
-#define input_report_rel(a,b,c) input_event(a, EV_REL, b, c)
-#define input_report_abs(a,b,c) input_event(a, EV_ABS, b, c)
-#define input_report_ff(a,b,c) input_event(a, EV_FF, b, c)
-#define input_report_ff_status(a,b,c)  input_event(a, EV_FF_STATUS, b, c)
-
-#define input_regs(a,b)                do { (a)->regs = (b); } while (0)
-#define input_sync(a)          do { input_event(a, EV_SYN, SYN_REPORT, 0); (a)->regs = NULL; } while (0)
-
-extern struct class_simple *input_class;
+static inline void input_report_key(struct input_dev *dev, unsigned int code, int value)
+{
+       input_event(dev, EV_KEY, code, !!value);
+}
+
+static inline void input_report_rel(struct input_dev *dev, unsigned int code, int value)
+{
+       input_event(dev, EV_REL, code, value);
+}
+
+static inline void input_report_abs(struct input_dev *dev, unsigned int code, int value)
+{
+       input_event(dev, EV_ABS, code, value);
+}
+
+static inline void input_report_ff(struct input_dev *dev, unsigned int code, int value)
+{
+       input_event(dev, EV_FF, code, value);
+}
+
+static inline void input_report_ff_status(struct input_dev *dev, unsigned int code, int value)
+{
+       input_event(dev, EV_FF_STATUS, code, value);
+}
+
+static inline void input_report_switch(struct input_dev *dev, unsigned int code, int value)
+{
+       input_event(dev, EV_SW, code, !!value);
+}
+
+static inline void input_regs(struct input_dev *dev, struct pt_regs *regs)
+{
+       dev->regs = regs;
+}
+
+static inline void input_sync(struct input_dev *dev)
+{
+       input_event(dev, EV_SYN, SYN_REPORT, 0);
+       dev->regs = NULL;
+}
+
+static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat)
+{
+       dev->absmin[axis] = min;
+       dev->absmax[axis] = max;
+       dev->absfuzz[axis] = fuzz;
+       dev->absflat[axis] = flat;
+
+       dev->absbit[LONG(axis)] |= BIT(axis);
+}
+
+extern struct class input_class;
 
 #endif
 #endif