fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / linux / input.h
index 6d4cc3c..bde65c8 100644 (file)
 #ifdef __KERNEL__
 #include <linux/time.h>
 #include <linux/list.h>
-#include <linux/device.h>
-#include <linux/mod_devicetable.h>
 #else
 #include <sys/time.h>
 #include <sys/ioctl.h>
+#include <sys/types.h>
 #include <asm/types.h>
 #endif
 
@@ -58,6 +57,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 */
 
@@ -231,7 +232,8 @@ struct input_absinfo {
 #define KEY_PAUSE              119
 
 #define KEY_KPCOMMA            121
-#define KEY_HANGUEL            122
+#define KEY_HANGEUL            122
+#define KEY_HANGUEL            KEY_HANGEUL
 #define KEY_HANJA              123
 #define KEY_YEN                        124
 #define KEY_LEFTMETA           125
@@ -345,6 +347,11 @@ struct input_absinfo {
 #define KEY_SAVE               234
 #define KEY_DOCUMENTS          235
 
+#define KEY_BATTERY            236
+
+#define KEY_BLUETOOTH          237
+#define KEY_WLAN               238
+
 #define KEY_UNKNOWN            240
 
 #define BTN_MISC               0x100
@@ -421,7 +428,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
@@ -484,6 +491,21 @@ struct input_absinfo {
 #define KEY_DIGITS             0x19d
 #define KEY_TEEN               0x19e
 #define KEY_TWEN               0x19f
+#define KEY_VIDEOPHONE         0x1a0
+#define KEY_GAMES              0x1a1
+#define KEY_ZOOMIN             0x1a2
+#define KEY_ZOOMOUT            0x1a3
+#define KEY_ZOOMRESET          0x1a4
+#define KEY_WORDPROCESSOR      0x1a5
+#define KEY_EDITOR             0x1a6
+#define KEY_SPREADSHEET                0x1a7
+#define KEY_GRAPHICSEDITOR     0x1a8
+#define KEY_PRESENTATION       0x1a9
+#define KEY_DATABASE           0x1aa
+#define KEY_NEWS               0x1ab
+#define KEY_VOICEMAIL          0x1ac
+#define KEY_ADDRESSBOOK                0x1ad
+#define KEY_MESSENGER          0x1ae
 
 #define KEY_DEL_EOL            0x1c0
 #define KEY_DEL_EOS            0x1c1
@@ -512,6 +534,15 @@ struct input_absinfo {
 #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
@@ -568,15 +599,10 @@ struct input_absinfo {
  * 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
+#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
@@ -637,6 +663,7 @@ struct input_absinfo {
 #define BUS_USB                        0x03
 #define BUS_HIL                        0x04
 #define BUS_BLUETOOTH          0x05
+#define BUS_VIRTUAL            0x06
 
 #define BUS_ISA                        0x10
 #define BUS_I8042              0x11
@@ -651,7 +678,7 @@ struct input_absinfo {
 #define BUS_GSC                        0x1A
 
 /*
- * Values describing the status of an effect
+ * Values describing the status of a force-feedback effect
  */
 #define FF_STATUS_STOPPED      0x00
 #define FF_STATUS_PLAYING      0x01
@@ -659,98 +686,167 @@ struct input_absinfo {
 
 /*
  * Structures used in ioctls to upload effects to a device
- * The first structures are not passed directly by using ioctls.
- * They are sub-structures of the actually sent structure (called ff_effect)
+ * They are pieces of a bigger structure (called ff_effect)
+ */
+
+/*
+ * All duration values are expressed in ms. Values above 32767 ms (0x7fff)
+ * should not be used and have unspecified results.
  */
 
+/**
+ * struct ff_replay - defines scheduling of the force-feedback effect
+ * @length: duration of the effect
+ * @delay: delay before effect should start playing
+ */
 struct ff_replay {
-       __u16 length; /* Duration of an effect in ms. All other times are also expressed in ms */
-       __u16 delay;  /* Time to wait before to start playing an effect */
+       __u16 length;
+       __u16 delay;
 };
 
+/**
+ * struct ff_trigger - defines what triggers the force-feedback effect
+ * @button: number of the button triggering the effect
+ * @interval: controls how soon the effect can be re-triggered
+ */
 struct ff_trigger {
-       __u16 button;   /* Number of button triggering an effect */
-       __u16 interval; /* Time to wait before an effect can be re-triggered (ms) */
+       __u16 button;
+       __u16 interval;
 };
 
+/**
+ * struct ff_envelope - generic force-feedback effect envelope
+ * @attack_length: duration of the attack (ms)
+ * @attack_level: level at the beginning of the attack
+ * @fade_length: duration of fade (ms)
+ * @fade_level: level at the end of fade
+ *
+ * The @attack_level and @fade_level are absolute values; when applying
+ * envelope force-feedback core will convert to positive/negative
+ * value based on polarity of the default level of the effect.
+ * Valid range for the attack and fade levels is 0x0000 - 0x7fff
+ */
 struct ff_envelope {
-       __u16 attack_length;    /* Duration of attack (ms) */
-       __u16 attack_level;     /* Level at beginning of attack */
-       __u16 fade_length;      /* Duration of fade (ms) */
-       __u16 fade_level;       /* Level at end of fade */
+       __u16 attack_length;
+       __u16 attack_level;
+       __u16 fade_length;
+       __u16 fade_level;
 };
 
-/* FF_CONSTANT */
+/**
+ * struct ff_constant_effect - defines parameters of a constant force-feedback effect
+ * @level: strength of the effect; may be negative
+ * @envelope: envelope data
+ */
 struct ff_constant_effect {
-       __s16 level;        /* Strength of effect. Negative values are OK */
+       __s16 level;
        struct ff_envelope envelope;
 };
 
-/* FF_RAMP */
+/**
+ * struct ff_ramp_effect - defines parameters of a ramp force-feedback effect
+ * @start_level: beginning strength of the effect; may be negative
+ * @end_level: final strength of the effect; may be negative
+ * @envelope: envelope data
+ */
 struct ff_ramp_effect {
        __s16 start_level;
        __s16 end_level;
        struct ff_envelope envelope;
 };
 
-/* FF_SPRING of FF_FRICTION */
+/**
+ * struct ff_condition_effect - defines a spring or friction force-feedback effect
+ * @right_saturation: maximum level when joystick moved all way to the right
+ * @left_saturation: same for the left side
+ * @right_coeff: controls how fast the force grows when the joystick moves
+ *     to the right
+ * @left_coeff: same for the left side
+ * @deadband: size of the dead zone, where no force is produced
+ * @center: position of the dead zone
+ */
 struct ff_condition_effect {
-       __u16 right_saturation; /* Max level when joystick is on the right */
-       __u16 left_saturation;  /* Max level when joystick in on the left */
+       __u16 right_saturation;
+       __u16 left_saturation;
 
-       __s16 right_coeff;      /* Indicates how fast the force grows when the
-                                  joystick moves to the right */
-       __s16 left_coeff;       /* Same for left side */
-
-       __u16 deadband; /* Size of area where no force is produced */
-       __s16 center;   /* Position of dead zone */
+       __s16 right_coeff;
+       __s16 left_coeff;
 
+       __u16 deadband;
+       __s16 center;
 };
 
-/* FF_PERIODIC */
+/**
+ * struct ff_periodic_effect - defines parameters of a periodic force-feedback effect
+ * @waveform: kind of the effect (wave)
+ * @period: period of the wave (ms)
+ * @magnitude: peak value
+ * @offset: mean value of the wave (roughly)
+ * @phase: 'horizontal' shift
+ * @envelope: envelope data
+ * @custom_len: number of samples (FF_CUSTOM only)
+ * @custom_data: buffer of samples (FF_CUSTOM only)
+ *
+ * Known waveforms - FF_SQUARE, FF_TRIANGLE, FF_SINE, FF_SAW_UP,
+ * FF_SAW_DOWN, FF_CUSTOM. The exact syntax FF_CUSTOM is undefined
+ * for the time being as no driver supports it yet.
+ *
+ * Note: the data pointed by custom_data is copied by the driver.
+ * You can therefore dispose of the memory after the upload/update.
+ */
 struct ff_periodic_effect {
-       __u16 waveform; /* Kind of wave (sine, square...) */
-       __u16 period;   /* in ms */
-       __s16 magnitude;        /* Peak value */
-       __s16 offset;   /* Mean value of wave (roughly) */
-       __u16 phase;            /* 'Horizontal' shift */
+       __u16 waveform;
+       __u16 period;
+       __s16 magnitude;
+       __s16 offset;
+       __u16 phase;
 
        struct ff_envelope envelope;
 
-/* Only used if waveform == FF_CUSTOM */
-       __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 */
+       __u32 custom_len;
+       __s16 *custom_data;
 };
 
-/* FF_RUMBLE */
-/* Some rumble pads have two motors of different weight.
-   strong_magnitude represents the magnitude of the vibration generated
-   by the heavy motor.
-*/
+/**
+ * struct ff_rumble_effect - defines parameters of a periodic force-feedback effect
+ * @strong_magnitude: magnitude of the heavy motor
+ * @weak_magnitude: magnitude of the light one
+ *
+ * Some rumble pads have two motors of different weight. Strong_magnitude
+ * represents the magnitude of the vibration generated by the heavy one.
+ */
 struct ff_rumble_effect {
-       __u16 strong_magnitude;  /* Magnitude of the heavy motor */
-       __u16 weak_magnitude;    /* Magnitude of the light one */
+       __u16 strong_magnitude;
+       __u16 weak_magnitude;
 };
 
-/*
- * Structure sent through ioctl from the application to the driver
+/**
+ * struct ff_effect - defines force feedback effect
+ * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING,
+ *     FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, or FF_CUSTOM)
+ * @id: an unique id assigned to an effect
+ * @direction: direction of the effect
+ * @trigger: trigger conditions (struct ff_trigger)
+ * @replay: scheduling of the effect (struct ff_replay)
+ * @u: effect-specific structure (one of ff_constant_effect, ff_ramp_effect,
+ *     ff_periodic_effect, ff_condition_effect, ff_rumble_effect) further
+ *     defining effect parameters
+ *
+ * This structure is sent through ioctl from the application to the driver.
+ * To create a new effect aplication should set its @id to -1; the kernel
+ * will return assigned @id which can later be used to update or delete
+ * this effect.
+ *
+ * Direction of the effect is encoded as follows:
+ *     0 deg -> 0x0000 (down)
+ *     90 deg -> 0x4000 (left)
+ *     180 deg -> 0x8000 (up)
+ *     270 deg -> 0xC000 (right)
  */
 struct ff_effect {
        __u16 type;
-/* Following field denotes the unique id assigned to an effect.
- * If user sets if to -1, a new effect is created, and its id is returned in the same field
- * Else, the user sets it to the effect id it wants to update.
- */
        __s16 id;
-
-       __u16 direction;        /* Direction. 0 deg -> 0x0000 (down)
-                                            90 deg -> 0x4000 (left)
-                                           180 deg -> 0x8000 (up)
-                                           270 deg -> 0xC000 (right)
-                               */
-
+       __u16 direction;
        struct ff_trigger trigger;
        struct ff_replay replay;
 
@@ -776,6 +872,9 @@ struct ff_effect {
 #define FF_INERTIA     0x56
 #define FF_RAMP                0x57
 
+#define FF_EFFECT_MIN  FF_RUMBLE
+#define FF_EFFECT_MAX  FF_RAMP
+
 /*
  * Force feedback periodic effect types
  */
@@ -787,6 +886,9 @@ struct ff_effect {
 #define FF_SAW_DOWN    0x5c
 #define FF_CUSTOM      0x5d
 
+#define FF_WAVEFORM_MIN        FF_SQUARE
+#define FF_WAVEFORM_MAX        FF_CUSTOM
+
 /*
  * Set ff device properties
  */
@@ -796,52 +898,16 @@ struct ff_effect {
 
 #define FF_MAX         0x7f
 
-struct input_device_id {
-
-       kernel_ulong_t flags;
-
-       struct input_id id;
-
-       kernel_ulong_t evbit[EV_MAX/BITS_PER_LONG+1];
-       kernel_ulong_t keybit[KEY_MAX/BITS_PER_LONG+1];
-       kernel_ulong_t relbit[REL_MAX/BITS_PER_LONG+1];
-       kernel_ulong_t absbit[ABS_MAX/BITS_PER_LONG+1];
-       kernel_ulong_t mscbit[MSC_MAX/BITS_PER_LONG+1];
-       kernel_ulong_t ledbit[LED_MAX/BITS_PER_LONG+1];
-       kernel_ulong_t sndbit[SND_MAX/BITS_PER_LONG+1];
-       kernel_ulong_t ffbit[FF_MAX/BITS_PER_LONG+1];
-       kernel_ulong_t swbit[SW_MAX/BITS_PER_LONG+1];
-
-       kernel_ulong_t driver_info;
-};
-
-/*
- * Structure for hotplug & device<->driver matching.
- */
-
-#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_SWBIT    0x1000
-
 #ifdef __KERNEL__
 
 /*
  * In-kernel definitions.
  */
 
+#include <linux/device.h>
 #include <linux/fs.h>
 #include <linux/timer.h>
+#include <linux/mod_devicetable.h>
 
 #define NBITS(x) (((x)/BITS_PER_LONG)+1)
 #define BIT(x) (1UL<<((x)%BITS_PER_LONG))
@@ -892,16 +958,16 @@ struct input_dev {
        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;
        unsigned int keycodesize;
        void *keycode;
 
+       struct ff_device *ff;
+
        unsigned int repeat_key;
        struct timer_list timer;
 
-       struct pt_regs *regs;
        int state;
 
        int sync;
@@ -921,48 +987,103 @@ struct input_dev {
 
        int (*open)(struct input_dev *dev);
        void (*close)(struct input_dev *dev);
-       int (*accept)(struct input_dev *dev, struct file *file);
        int (*flush)(struct input_dev *dev, struct file *file);
        int (*event)(struct input_dev *dev, unsigned int type, unsigned int code, int value);
-       int (*upload_effect)(struct input_dev *dev, struct ff_effect *effect);
-       int (*erase_effect)(struct input_dev *dev, int effect_id);
 
        struct input_handle *grab;
 
-       struct semaphore sem;   /* serializes open and close operations */
+       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)
 
-#define INPUT_DEVICE_ID_MATCH_DEVICE\
+/*
+ * Verify that we are in sync with input_device_id mod_devicetable.h #defines
+ */
+
+#if EV_MAX != INPUT_DEVICE_ID_EV_MAX
+#error "EV_MAX and INPUT_DEVICE_ID_EV_MAX do not match"
+#endif
+
+#if KEY_MAX != INPUT_DEVICE_ID_KEY_MAX
+#error "KEY_MAX and INPUT_DEVICE_ID_KEY_MAX do not match"
+#endif
+
+#if REL_MAX != INPUT_DEVICE_ID_REL_MAX
+#error "REL_MAX and INPUT_DEVICE_ID_REL_MAX do not match"
+#endif
+
+#if ABS_MAX != INPUT_DEVICE_ID_ABS_MAX
+#error "ABS_MAX and INPUT_DEVICE_ID_ABS_MAX do not match"
+#endif
+
+#if MSC_MAX != INPUT_DEVICE_ID_MSC_MAX
+#error "MSC_MAX and INPUT_DEVICE_ID_MSC_MAX do not match"
+#endif
+
+#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\
+#define INPUT_DEVICE_ID_MATCH_DEVICE_AND_VERSION \
        (INPUT_DEVICE_ID_MATCH_DEVICE | INPUT_DEVICE_ID_MATCH_VERSION)
 
 struct input_handle;
 
+/**
+ * struct input_handler - implements one of interfaces for input devices
+ * @private: driver-specific data
+ * @event: event handler
+ * @connect: called when attaching a handler to an input device
+ * @disconnect: disconnects a handler from input device
+ * @start: starts handler for given handle. This function is called by
+ *     input core right after connect() method and also when a process
+ *     that "grabbed" a device releases it
+ * @fops: file operations this driver implements
+ * @minor: beginning of range of 32 minors for devices this driver
+ *     can provide
+ * @name: name of the handler, to be shown in /proc/bus/input/handlers
+ * @id_table: pointer to a table of input_device_ids this driver can
+ *     handle
+ * @blacklist: prointer to a table of input_device_ids this driver should
+ *     ignore even if they match @id_table
+ * @h_list: list of input handles associated with the handler
+ * @node: for placing the driver onto input_handler_list
+ */
 struct input_handler {
 
        void *private;
 
        void (*event)(struct input_handle *handle, unsigned int type, unsigned int code, int value);
-       struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, struct input_device_id *id);
+       struct input_handle* (*connect)(struct input_handler *handler, struct input_dev *dev, const struct input_device_id *id);
        void (*disconnect)(struct input_handle *handle);
+       void (*start)(struct input_handle *handle);
 
-       struct file_operations *fops;
+       const struct file_operations *fops;
        int minor;
-       char *name;
+       const char *name;
 
-       struct input_device_id *id_table;
-       struct input_device_id *blacklist;
+       const struct input_device_id *id_table;
+       const struct input_device_id *blacklist;
 
        struct list_head        h_list;
        struct list_head        node;
@@ -973,7 +1094,7 @@ struct input_handle {
        void *private;
 
        int open;
-       char *name;
+       const char *name;
 
        struct input_dev *dev;
        struct input_handler *handler;
@@ -987,18 +1108,8 @@ 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)
 
-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 void input_free_device(struct input_dev *dev)
-{
-       kfree(dev);
-}
+void input_free_device(struct input_dev *dev);
 
 static inline struct input_dev *input_get_device(struct input_dev *dev)
 {
@@ -1013,7 +1124,7 @@ static inline void input_put_device(struct input_dev *dev)
 int input_register_device(struct input_dev *);
 void input_unregister_device(struct input_dev *);
 
-void input_register_handler(struct input_handler *);
+int input_register_handler(struct input_handler *);
 void input_unregister_handler(struct input_handler *);
 
 int input_grab_device(struct input_handle *);
@@ -1022,10 +1133,10 @@ void input_release_device(struct input_handle *);
 int input_open_device(struct input_handle *);
 void input_close_device(struct input_handle *);
 
-int input_accept_process(struct input_handle *handle, struct file *file);
 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);
+void input_inject_event(struct input_handle *handle, unsigned int type, unsigned int code, int value);
 
 static inline void input_report_key(struct input_dev *dev, unsigned int code, int value)
 {
@@ -1042,11 +1153,6 @@ static inline void input_report_abs(struct input_dev *dev, unsigned int code, in
        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);
@@ -1057,15 +1163,9 @@ static inline void input_report_switch(struct input_dev *dev, unsigned int code,
        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)
@@ -1080,5 +1180,61 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min
 
 extern struct class input_class;
 
+/**
+ * struct ff_device - force-feedback part of an input device
+ * @upload: Called to upload an new effect into device
+ * @erase: Called to erase an effect from device
+ * @playback: Called to request device to start playing specified effect
+ * @set_gain: Called to set specified gain
+ * @set_autocenter: Called to auto-center device
+ * @destroy: called by input core when parent input device is being
+ *     destroyed
+ * @private: driver-specific data, will be freed automatically
+ * @ffbit: bitmap of force feedback capabilities truly supported by
+ *     device (not emulated like ones in input_dev->ffbit)
+ * @mutex: mutex for serializing access to the device
+ * @max_effects: maximum number of effects supported by device
+ * @effects: pointer to an array of effects currently loaded into device
+ * @effect_owners: array of effect owners; when file handle owning
+ *     an effect gets closed the effcet is automatically erased
+ *
+ * Every force-feedback device must implement upload() and playback()
+ * methods; erase() is optional. set_gain() and set_autocenter() need
+ * only be implemented if driver sets up FF_GAIN and FF_AUTOCENTER
+ * bits.
+ */
+struct ff_device {
+       int (*upload)(struct input_dev *dev, struct ff_effect *effect,
+                     struct ff_effect *old);
+       int (*erase)(struct input_dev *dev, int effect_id);
+
+       int (*playback)(struct input_dev *dev, int effect_id, int value);
+       void (*set_gain)(struct input_dev *dev, u16 gain);
+       void (*set_autocenter)(struct input_dev *dev, u16 magnitude);
+
+       void (*destroy)(struct ff_device *);
+
+       void *private;
+
+       unsigned long ffbit[NBITS(FF_MAX)];
+
+       struct mutex mutex;
+
+       int max_effects;
+       struct ff_effect *effects;
+       struct file *effect_owners[];
+};
+
+int input_ff_create(struct input_dev *dev, int max_effects);
+void input_ff_destroy(struct input_dev *dev);
+
+int input_ff_event(struct input_dev *dev, unsigned int type, unsigned int code, int value);
+
+int input_ff_upload(struct input_dev *dev, struct ff_effect *effect, struct file *file);
+int input_ff_erase(struct input_dev *dev, int effect_id, struct file *file);
+
+int input_ff_create_memless(struct input_dev *dev, void *data,
+               int (*play_effect)(struct input_dev *, void *, struct ff_effect *));
+
 #endif
 #endif