Revert "[PATCH] paravirt: Add startup infrastructure for paravirtualization"
[pv_ops_mirror.git] / drivers / input / mouse / psmouse.h
blob3964e8acbc54da1b96c2f67fd12bc9f13ca61151
1 #ifndef _PSMOUSE_H
2 #define _PSMOUSE_H
4 #define PSMOUSE_CMD_SETSCALE11 0x00e6
5 #define PSMOUSE_CMD_SETSCALE21 0x00e7
6 #define PSMOUSE_CMD_SETRES 0x10e8
7 #define PSMOUSE_CMD_GETINFO 0x03e9
8 #define PSMOUSE_CMD_SETSTREAM 0x00ea
9 #define PSMOUSE_CMD_SETPOLL 0x00f0
10 #define PSMOUSE_CMD_POLL 0x00eb /* caller sets number of bytes to receive */
11 #define PSMOUSE_CMD_GETID 0x02f2
12 #define PSMOUSE_CMD_SETRATE 0x10f3
13 #define PSMOUSE_CMD_ENABLE 0x00f4
14 #define PSMOUSE_CMD_DISABLE 0x00f5
15 #define PSMOUSE_CMD_RESET_DIS 0x00f6
16 #define PSMOUSE_CMD_RESET_BAT 0x02ff
18 #define PSMOUSE_RET_BAT 0xaa
19 #define PSMOUSE_RET_ID 0x00
20 #define PSMOUSE_RET_ACK 0xfa
21 #define PSMOUSE_RET_NAK 0xfe
23 enum psmouse_state {
24 PSMOUSE_IGNORE,
25 PSMOUSE_INITIALIZING,
26 PSMOUSE_RESYNCING,
27 PSMOUSE_CMD_MODE,
28 PSMOUSE_ACTIVATED,
31 /* psmouse protocol handler return codes */
32 typedef enum {
33 PSMOUSE_BAD_DATA,
34 PSMOUSE_GOOD_DATA,
35 PSMOUSE_FULL_PACKET
36 } psmouse_ret_t;
38 struct psmouse {
39 void *private;
40 struct input_dev *dev;
41 struct ps2dev ps2dev;
42 struct work_struct resync_work;
43 char *vendor;
44 char *name;
45 unsigned char packet[8];
46 unsigned char badbyte;
47 unsigned char pktcnt;
48 unsigned char pktsize;
49 unsigned char type;
50 unsigned char acks_disable_command;
51 unsigned int model;
52 unsigned long last;
53 unsigned long out_of_sync;
54 unsigned long num_resyncs;
55 enum psmouse_state state;
56 char devname[64];
57 char phys[32];
59 unsigned int rate;
60 unsigned int resolution;
61 unsigned int resetafter;
62 unsigned int resync_time;
63 unsigned int smartscroll; /* Logitech only */
65 psmouse_ret_t (*protocol_handler)(struct psmouse *psmouse);
66 void (*set_rate)(struct psmouse *psmouse, unsigned int rate);
67 void (*set_resolution)(struct psmouse *psmouse, unsigned int resolution);
69 int (*reconnect)(struct psmouse *psmouse);
70 void (*disconnect)(struct psmouse *psmouse);
71 void (*cleanup)(struct psmouse *psmouse);
72 int (*poll)(struct psmouse *psmouse);
74 void (*pt_activate)(struct psmouse *psmouse);
75 void (*pt_deactivate)(struct psmouse *psmouse);
78 enum psmouse_type {
79 PSMOUSE_NONE,
80 PSMOUSE_PS2,
81 PSMOUSE_PS2PP,
82 PSMOUSE_THINKPS,
83 PSMOUSE_GENPS,
84 PSMOUSE_IMPS,
85 PSMOUSE_IMEX,
86 PSMOUSE_SYNAPTICS,
87 PSMOUSE_ALPS,
88 PSMOUSE_LIFEBOOK,
89 PSMOUSE_TRACKPOINT,
90 PSMOUSE_TOUCHKIT_PS2,
91 PSMOUSE_AUTO /* This one should always be last */
94 int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command);
95 int psmouse_reset(struct psmouse *psmouse);
96 void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution);
99 struct psmouse_attribute {
100 struct device_attribute dattr;
101 void *data;
102 ssize_t (*show)(struct psmouse *psmouse, void *data, char *buf);
103 ssize_t (*set)(struct psmouse *psmouse, void *data,
104 const char *buf, size_t count);
106 #define to_psmouse_attr(a) container_of((a), struct psmouse_attribute, dattr)
108 ssize_t psmouse_attr_show_helper(struct device *dev, struct device_attribute *attr,
109 char *buf);
110 ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *attr,
111 const char *buf, size_t count);
113 #define PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set) \
114 static ssize_t _show(struct psmouse *, void *data, char *); \
115 static ssize_t _set(struct psmouse *, void *data, const char *, size_t); \
116 static struct psmouse_attribute psmouse_attr_##_name = { \
117 .dattr = { \
118 .attr = { \
119 .name = __stringify(_name), \
120 .mode = _mode, \
121 .owner = THIS_MODULE, \
122 }, \
123 .show = psmouse_attr_show_helper, \
124 .store = psmouse_attr_set_helper, \
125 }, \
126 .data = _data, \
127 .show = _show, \
128 .set = _set, \
131 #endif /* _PSMOUSE_H */