Merge branch 'master'
[sfrench/cifs-2.6.git] / include / linux / input.h
index bdc53c6cc962ad78989fbbb0cfbac2a68cb57aa2..3c5823368ddb4e680f0bf702e75efd4eed4e8d97 100644 (file)
@@ -12,6 +12,7 @@
 #ifdef __KERNEL__
 #include <linux/time.h>
 #include <linux/list.h>
+#include <linux/device.h>
 #else
 #include <sys/time.h>
 #include <sys/ioctl.h>
@@ -66,6 +67,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 +88,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 +290,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
@@ -333,6 +338,12 @@ struct input_absinfo {
 #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_UNKNOWN            240
 
 #define BTN_MISC               0x100
@@ -550,6 +561,20 @@ struct input_absinfo {
 #define ABS_MISC               0x28
 #define ABS_MAX                        0x3f
 
+/*
+ * Switch events
+ */
+
+#define SW_0           0x00
+#define SW_1           0x01
+#define SW_2           0x02
+#define SW_3           0x03
+#define SW_4           0x04
+#define SW_5           0x05
+#define SW_6           0x06
+#define SW_7           0x07
+#define SW_MAX         0x0f
+
 /*
  * Misc events
  */
@@ -620,6 +645,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
@@ -824,6 +850,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;
@@ -844,6 +871,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];
@@ -863,11 +891,15 @@ struct input_dev {
        struct semaphore sem;   /* serializes open and close operations */
        unsigned int users;
 
-       struct device *dev;
+       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.
@@ -886,6 +918,7 @@ struct input_dev {
 #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_SWBIT    0x1000
 
 #define INPUT_DEVICE_ID_MATCH_DEVICE\
        (INPUT_DEVICE_ID_MATCH_BUS | INPUT_DEVICE_ID_MATCH_VENDOR | INPUT_DEVICE_ID_MATCH_PRODUCT)
@@ -906,6 +939,7 @@ struct input_device_id {
        unsigned long ledbit[NBITS(LED_MAX)];
        unsigned long sndbit[NBITS(SND_MAX)];
        unsigned long ffbit[NBITS(FF_MAX)];
+       unsigned long swbit[NBITS(SW_MAX)];
 
        unsigned long driver_info;
 };
@@ -956,7 +990,24 @@ static inline void init_input_dev(struct input_dev *dev)
        INIT_LIST_HEAD(&dev->node);
 }
 
-void input_register_device(struct input_dev *);
+struct input_dev *input_allocate_device(void);
+
+static inline void input_free_device(struct input_dev *dev)
+{
+       kfree(dev);
+}
+
+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);
+}
+
+int input_register_device(struct input_dev *);
 void input_unregister_device(struct input_dev *);
 
 void input_register_handler(struct input_handler *);
@@ -998,6 +1049,11 @@ static inline void input_report_ff_status(struct input_dev *dev, unsigned int co
        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;
@@ -1019,7 +1075,7 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min
        dev->absbit[LONG(axis)] |= BIT(axis);
 }
 
-extern struct class *input_class;
+extern struct class input_class;
 
 #endif
 #endif