aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-05-02 19:35:45 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-05-02 19:35:45 -0400
commit8c0c3f7ff0daa119f0bb109148f6f0e39573b429 (patch)
treed3baacfe2e2b194584866d711ea4078d629b6561 /drivers/input/mouse
parentf75e6745aa3084124ae1434fd7629853bdaf6798 (diff)
parenteacaad01b4e67336b5b3f4db6dc15ef92c64b47d (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: document the multi-touch (MT) protocol Input: add detailed multi-touch finger data report protocol Input: allow certain EV_ABS events to bypass all filtering Input: bcm5974 - add documentation for the driver Input: bcm5974 - augment debug information Input: bcm5974 - Add support for the Macbook 5 (Unibody) Input: bcm5974 - add quad-finger tapping Input: bcm5974 - prepare for a new trackpad header type Input: appletouch - fix DMA to/from stack buffer Input: wacom - fix TabletPC touch bug Input: lifebook - add DMI entry for Fujitsu B-2130 Input: ALPS - add signature for Toshiba Satellite Pro M10 Input: elantech - make sure touchpad is really in absolute mode Input: elantech - provide a workaround for jumpy cursor on firmware 2.34 Input: ucb1400 - use disable_irq_nosync() in irq handler Input: tsc2007 - use disable_irq_nosync() in irq handler Input: sa1111ps2 - use disable_irq_nosync() in irq handlers Input: omap-keypad - use disable_irq_nosync() in irq handler
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r--drivers/input/mouse/alps.c1
-rw-r--r--drivers/input/mouse/appletouch.c24
-rw-r--r--drivers/input/mouse/bcm5974.c108
-rw-r--r--drivers/input/mouse/elantech.c48
-rw-r--r--drivers/input/mouse/elantech.h5
-rw-r--r--drivers/input/mouse/lifebook.c6
6 files changed, 150 insertions, 42 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index cbedf957cc58..daecc75c72e6 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -37,6 +37,7 @@
37#define ALPS_FW_BK_2 0x40 37#define ALPS_FW_BK_2 0x40
38 38
39static const struct alps_model_info alps_model_data[] = { 39static const struct alps_model_info alps_model_data[] = {
40 { { 0x32, 0x02, 0x14 }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Toshiba Salellite Pro M10 */
40 { { 0x33, 0x02, 0x0a }, 0x88, 0xf8, ALPS_OLDPROTO }, /* UMAX-530T */ 41 { { 0x33, 0x02, 0x0a }, 0x88, 0xf8, ALPS_OLDPROTO }, /* UMAX-530T */
41 { { 0x53, 0x02, 0x0a }, 0xf8, 0xf8, 0 }, 42 { { 0x53, 0x02, 0x0a }, 0xf8, 0xf8, 0 },
42 { { 0x53, 0x02, 0x14 }, 0xf8, 0xf8, 0 }, 43 { { 0x53, 0x02, 0x14 }, 0xf8, 0xf8, 0 },
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index 454b96112f03..e0140fdc02a5 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -255,15 +255,22 @@ MODULE_PARM_DESC(debug, "Activate debugging output");
255 */ 255 */
256static int atp_geyser_init(struct usb_device *udev) 256static int atp_geyser_init(struct usb_device *udev)
257{ 257{
258 char data[8]; 258 char *data;
259 int size; 259 int size;
260 int i; 260 int i;
261 int ret;
262
263 data = kmalloc(8, GFP_KERNEL);
264 if (!data) {
265 err("Out of memory");
266 return -ENOMEM;
267 }
261 268
262 size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 269 size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
263 ATP_GEYSER_MODE_READ_REQUEST_ID, 270 ATP_GEYSER_MODE_READ_REQUEST_ID,
264 USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 271 USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
265 ATP_GEYSER_MODE_REQUEST_VALUE, 272 ATP_GEYSER_MODE_REQUEST_VALUE,
266 ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000); 273 ATP_GEYSER_MODE_REQUEST_INDEX, data, 8, 5000);
267 274
268 if (size != 8) { 275 if (size != 8) {
269 dprintk("atp_geyser_init: read error\n"); 276 dprintk("atp_geyser_init: read error\n");
@@ -271,7 +278,8 @@ static int atp_geyser_init(struct usb_device *udev)
271 dprintk("appletouch[%d]: %d\n", i, data[i]); 278 dprintk("appletouch[%d]: %d\n", i, data[i]);
272 279
273 err("Failed to read mode from device."); 280 err("Failed to read mode from device.");
274 return -EIO; 281 ret = -EIO;
282 goto out_free;
275 } 283 }
276 284
277 /* Apply the mode switch */ 285 /* Apply the mode switch */
@@ -281,7 +289,7 @@ static int atp_geyser_init(struct usb_device *udev)
281 ATP_GEYSER_MODE_WRITE_REQUEST_ID, 289 ATP_GEYSER_MODE_WRITE_REQUEST_ID,
282 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 290 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
283 ATP_GEYSER_MODE_REQUEST_VALUE, 291 ATP_GEYSER_MODE_REQUEST_VALUE,
284 ATP_GEYSER_MODE_REQUEST_INDEX, &data, 8, 5000); 292 ATP_GEYSER_MODE_REQUEST_INDEX, data, 8, 5000);
285 293
286 if (size != 8) { 294 if (size != 8) {
287 dprintk("atp_geyser_init: write error\n"); 295 dprintk("atp_geyser_init: write error\n");
@@ -289,9 +297,13 @@ static int atp_geyser_init(struct usb_device *udev)
289 dprintk("appletouch[%d]: %d\n", i, data[i]); 297 dprintk("appletouch[%d]: %d\n", i, data[i]);
290 298
291 err("Failed to request geyser raw mode"); 299 err("Failed to request geyser raw mode");
292 return -EIO; 300 ret = -EIO;
301 goto out_free;
293 } 302 }
294 return 0; 303 ret = 0;
304out_free:
305 kfree(data);
306 return ret;
295} 307}
296 308
297/* 309/*
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index 2998a6ac9ae4..2d8fc0bf6923 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -51,6 +51,10 @@
51#define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230 51#define USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI 0x0230
52#define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231 52#define USB_DEVICE_ID_APPLE_WELLSPRING2_ISO 0x0231
53#define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232 53#define USB_DEVICE_ID_APPLE_WELLSPRING2_JIS 0x0232
54/* Macbook5,1 (unibody), aka wellspring3 */
55#define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236
56#define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237
57#define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238
54 58
55#define BCM5974_DEVICE(prod) { \ 59#define BCM5974_DEVICE(prod) { \
56 .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ 60 .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \
@@ -72,6 +76,10 @@ static const struct usb_device_id bcm5974_table[] = {
72 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI), 76 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI),
73 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING2_ISO), 77 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING2_ISO),
74 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING2_JIS), 78 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING2_JIS),
79 /* Macbook5,1 */
80 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI),
81 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_ISO),
82 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING3_JIS),
75 /* Terminating entry */ 83 /* Terminating entry */
76 {} 84 {}
77}; 85};
@@ -96,14 +104,23 @@ struct bt_data {
96 u8 rel_y; /* relative y coordinate */ 104 u8 rel_y; /* relative y coordinate */
97}; 105};
98 106
99/* trackpad header structure */ 107/* trackpad header types */
100struct tp_header { 108enum tp_type {
101 u8 unknown1[16]; /* constants, timers, etc */ 109 TYPE1, /* plain trackpad */
102 u8 fingers; /* number of fingers on trackpad */ 110 TYPE2 /* button integrated in trackpad */
103 u8 unknown2[9]; /* constants, timers, etc */
104}; 111};
105 112
106/* trackpad finger structure */ 113/* trackpad finger data offsets, le16-aligned */
114#define FINGER_TYPE1 (13 * sizeof(__le16))
115#define FINGER_TYPE2 (15 * sizeof(__le16))
116
117/* trackpad button data offsets */
118#define BUTTON_TYPE2 15
119
120/* list of device capability bits */
121#define HAS_INTEGRATED_BUTTON 1
122
123/* trackpad finger structure, le16-aligned */
107struct tp_finger { 124struct tp_finger {
108 __le16 origin; /* zero when switching track finger */ 125 __le16 origin; /* zero when switching track finger */
109 __le16 abs_x; /* absolute x coodinate */ 126 __le16 abs_x; /* absolute x coodinate */
@@ -117,13 +134,11 @@ struct tp_finger {
117 __le16 force_minor; /* trackpad force, minor axis? */ 134 __le16 force_minor; /* trackpad force, minor axis? */
118 __le16 unused[3]; /* zeros */ 135 __le16 unused[3]; /* zeros */
119 __le16 multi; /* one finger: varies, more fingers: constant */ 136 __le16 multi; /* one finger: varies, more fingers: constant */
120}; 137} __attribute__((packed,aligned(2)));
121 138
122/* trackpad data structure, empirically at least ten fingers */ 139/* trackpad finger data size, empirically at least ten fingers */
123struct tp_data { 140#define SIZEOF_FINGER sizeof(struct tp_finger)
124 struct tp_header header; 141#define SIZEOF_ALL_FINGERS (16 * SIZEOF_FINGER)
125 struct tp_finger finger[16];
126};
127 142
128/* device-specific parameters */ 143/* device-specific parameters */
129struct bcm5974_param { 144struct bcm5974_param {
@@ -136,9 +151,12 @@ struct bcm5974_param {
136/* device-specific configuration */ 151/* device-specific configuration */
137struct bcm5974_config { 152struct bcm5974_config {
138 int ansi, iso, jis; /* the product id of this device */ 153 int ansi, iso, jis; /* the product id of this device */
154 int caps; /* device capability bitmask */
139 int bt_ep; /* the endpoint of the button interface */ 155 int bt_ep; /* the endpoint of the button interface */
140 int bt_datalen; /* data length of the button interface */ 156 int bt_datalen; /* data length of the button interface */
141 int tp_ep; /* the endpoint of the trackpad interface */ 157 int tp_ep; /* the endpoint of the trackpad interface */
158 enum tp_type tp_type; /* type of trackpad interface */
159 int tp_offset; /* offset to trackpad finger data */
142 int tp_datalen; /* data length of the trackpad interface */ 160 int tp_datalen; /* data length of the trackpad interface */
143 struct bcm5974_param p; /* finger pressure limits */ 161 struct bcm5974_param p; /* finger pressure limits */
144 struct bcm5974_param w; /* finger width limits */ 162 struct bcm5974_param w; /* finger width limits */
@@ -158,7 +176,7 @@ struct bcm5974 {
158 struct urb *bt_urb; /* button usb request block */ 176 struct urb *bt_urb; /* button usb request block */
159 struct bt_data *bt_data; /* button transferred data */ 177 struct bt_data *bt_data; /* button transferred data */
160 struct urb *tp_urb; /* trackpad usb request block */ 178 struct urb *tp_urb; /* trackpad usb request block */
161 struct tp_data *tp_data; /* trackpad transferred data */ 179 u8 *tp_data; /* trackpad transferred data */
162 int fingers; /* number of fingers on trackpad */ 180 int fingers; /* number of fingers on trackpad */
163}; 181};
164 182
@@ -183,8 +201,9 @@ static const struct bcm5974_config bcm5974_config_table[] = {
183 USB_DEVICE_ID_APPLE_WELLSPRING_ANSI, 201 USB_DEVICE_ID_APPLE_WELLSPRING_ANSI,
184 USB_DEVICE_ID_APPLE_WELLSPRING_ISO, 202 USB_DEVICE_ID_APPLE_WELLSPRING_ISO,
185 USB_DEVICE_ID_APPLE_WELLSPRING_JIS, 203 USB_DEVICE_ID_APPLE_WELLSPRING_JIS,
204 0,
186 0x84, sizeof(struct bt_data), 205 0x84, sizeof(struct bt_data),
187 0x81, sizeof(struct tp_data), 206 0x81, TYPE1, FINGER_TYPE1, FINGER_TYPE1 + SIZEOF_ALL_FINGERS,
188 { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 256 }, 207 { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 256 },
189 { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 }, 208 { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 },
190 { DIM_X, DIM_X / SN_COORD, -4824, 5342 }, 209 { DIM_X, DIM_X / SN_COORD, -4824, 5342 },
@@ -194,13 +213,26 @@ static const struct bcm5974_config bcm5974_config_table[] = {
194 USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI, 213 USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI,
195 USB_DEVICE_ID_APPLE_WELLSPRING2_ISO, 214 USB_DEVICE_ID_APPLE_WELLSPRING2_ISO,
196 USB_DEVICE_ID_APPLE_WELLSPRING2_JIS, 215 USB_DEVICE_ID_APPLE_WELLSPRING2_JIS,
216 0,
197 0x84, sizeof(struct bt_data), 217 0x84, sizeof(struct bt_data),
198 0x81, sizeof(struct tp_data), 218 0x81, TYPE1, FINGER_TYPE1, FINGER_TYPE1 + SIZEOF_ALL_FINGERS,
199 { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 256 }, 219 { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 256 },
200 { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 }, 220 { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 },
201 { DIM_X, DIM_X / SN_COORD, -4824, 4824 }, 221 { DIM_X, DIM_X / SN_COORD, -4824, 4824 },
202 { DIM_Y, DIM_Y / SN_COORD, -172, 4290 } 222 { DIM_Y, DIM_Y / SN_COORD, -172, 4290 }
203 }, 223 },
224 {
225 USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI,
226 USB_DEVICE_ID_APPLE_WELLSPRING3_ISO,
227 USB_DEVICE_ID_APPLE_WELLSPRING3_JIS,
228 HAS_INTEGRATED_BUTTON,
229 0x84, sizeof(struct bt_data),
230 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
231 { DIM_PRESSURE, DIM_PRESSURE / SN_PRESSURE, 0, 300 },
232 { DIM_WIDTH, DIM_WIDTH / SN_WIDTH, 0, 2048 },
233 { DIM_X, DIM_X / SN_COORD, -4460, 5166 },
234 { DIM_Y, DIM_Y / SN_COORD, -75, 6700 }
235 },
204 {} 236 {}
205}; 237};
206 238
@@ -257,6 +289,7 @@ static void setup_events_to_report(struct input_dev *input_dev,
257 __set_bit(BTN_TOOL_FINGER, input_dev->keybit); 289 __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
258 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); 290 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit);
259 __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); 291 __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit);
292 __set_bit(BTN_TOOL_QUADTAP, input_dev->keybit);
260 __set_bit(BTN_LEFT, input_dev->keybit); 293 __set_bit(BTN_LEFT, input_dev->keybit);
261} 294}
262 295
@@ -266,6 +299,11 @@ static int report_bt_state(struct bcm5974 *dev, int size)
266 if (size != sizeof(struct bt_data)) 299 if (size != sizeof(struct bt_data))
267 return -EIO; 300 return -EIO;
268 301
302 dprintk(7,
303 "bcm5974: button data: %x %x %x %x\n",
304 dev->bt_data->unknown1, dev->bt_data->button,
305 dev->bt_data->rel_x, dev->bt_data->rel_y);
306
269 input_report_key(dev->input, BTN_LEFT, dev->bt_data->button); 307 input_report_key(dev->input, BTN_LEFT, dev->bt_data->button);
270 input_sync(dev->input); 308 input_sync(dev->input);
271 309
@@ -276,29 +314,37 @@ static int report_bt_state(struct bcm5974 *dev, int size)
276static int report_tp_state(struct bcm5974 *dev, int size) 314static int report_tp_state(struct bcm5974 *dev, int size)
277{ 315{
278 const struct bcm5974_config *c = &dev->cfg; 316 const struct bcm5974_config *c = &dev->cfg;
279 const struct tp_finger *f = dev->tp_data->finger; 317 const struct tp_finger *f;
280 struct input_dev *input = dev->input; 318 struct input_dev *input = dev->input;
281 const int fingers = (size - 26) / 28; 319 int raw_p, raw_w, raw_x, raw_y, raw_n;
282 int raw_p, raw_w, raw_x, raw_y; 320 int ptest = 0, origin = 0, ibt = 0, nmin = 0, nmax = 0;
283 int ptest = 0, origin = 0, nmin = 0, nmax = 0;
284 int abs_p = 0, abs_w = 0, abs_x = 0, abs_y = 0; 321 int abs_p = 0, abs_w = 0, abs_x = 0, abs_y = 0;
285 322
286 if (size < 26 || (size - 26) % 28 != 0) 323 if (size < c->tp_offset || (size - c->tp_offset) % SIZEOF_FINGER != 0)
287 return -EIO; 324 return -EIO;
288 325
326 /* finger data, le16-aligned */
327 f = (const struct tp_finger *)(dev->tp_data + c->tp_offset);
328 raw_n = (size - c->tp_offset) / SIZEOF_FINGER;
329
289 /* always track the first finger; when detached, start over */ 330 /* always track the first finger; when detached, start over */
290 if (fingers) { 331 if (raw_n) {
291 raw_p = raw2int(f->force_major); 332 raw_p = raw2int(f->force_major);
292 raw_w = raw2int(f->size_major); 333 raw_w = raw2int(f->size_major);
293 raw_x = raw2int(f->abs_x); 334 raw_x = raw2int(f->abs_x);
294 raw_y = raw2int(f->abs_y); 335 raw_y = raw2int(f->abs_y);
295 336
296 dprintk(9, 337 dprintk(9,
297 "bcm5974: raw: p: %+05d w: %+05d x: %+05d y: %+05d\n", 338 "bcm5974: "
298 raw_p, raw_w, raw_x, raw_y); 339 "raw: p: %+05d w: %+05d x: %+05d y: %+05d n: %d\n",
340 raw_p, raw_w, raw_x, raw_y, raw_n);
299 341
300 ptest = int2bound(&c->p, raw_p); 342 ptest = int2bound(&c->p, raw_p);
301 origin = raw2int(f->origin); 343 origin = raw2int(f->origin);
344
345 /* set the integrated button if applicable */
346 if (c->tp_type == TYPE2)
347 ibt = raw2int(dev->tp_data[BUTTON_TYPE2]);
302 } 348 }
303 349
304 /* while tracking finger still valid, count all fingers */ 350 /* while tracking finger still valid, count all fingers */
@@ -307,12 +353,13 @@ static int report_tp_state(struct bcm5974 *dev, int size)
307 abs_w = int2bound(&c->w, raw_w); 353 abs_w = int2bound(&c->w, raw_w);
308 abs_x = int2bound(&c->x, raw_x - c->x.devmin); 354 abs_x = int2bound(&c->x, raw_x - c->x.devmin);
309 abs_y = int2bound(&c->y, c->y.devmax - raw_y); 355 abs_y = int2bound(&c->y, c->y.devmax - raw_y);
310 for (; f != dev->tp_data->finger + fingers; f++) { 356 while (raw_n--) {
311 ptest = int2bound(&c->p, raw2int(f->force_major)); 357 ptest = int2bound(&c->p, raw2int(f->force_major));
312 if (ptest > PRESSURE_LOW) 358 if (ptest > PRESSURE_LOW)
313 nmax++; 359 nmax++;
314 if (ptest > PRESSURE_HIGH) 360 if (ptest > PRESSURE_HIGH)
315 nmin++; 361 nmin++;
362 f++;
316 } 363 }
317 } 364 }
318 365
@@ -324,7 +371,8 @@ static int report_tp_state(struct bcm5974 *dev, int size)
324 input_report_key(input, BTN_TOUCH, dev->fingers > 0); 371 input_report_key(input, BTN_TOUCH, dev->fingers > 0);
325 input_report_key(input, BTN_TOOL_FINGER, dev->fingers == 1); 372 input_report_key(input, BTN_TOOL_FINGER, dev->fingers == 1);
326 input_report_key(input, BTN_TOOL_DOUBLETAP, dev->fingers == 2); 373 input_report_key(input, BTN_TOOL_DOUBLETAP, dev->fingers == 2);
327 input_report_key(input, BTN_TOOL_TRIPLETAP, dev->fingers > 2); 374 input_report_key(input, BTN_TOOL_TRIPLETAP, dev->fingers == 3);
375 input_report_key(input, BTN_TOOL_QUADTAP, dev->fingers > 3);
328 376
329 input_report_abs(input, ABS_PRESSURE, abs_p); 377 input_report_abs(input, ABS_PRESSURE, abs_p);
330 input_report_abs(input, ABS_TOOL_WIDTH, abs_w); 378 input_report_abs(input, ABS_TOOL_WIDTH, abs_w);
@@ -335,11 +383,15 @@ static int report_tp_state(struct bcm5974 *dev, int size)
335 383
336 dprintk(8, 384 dprintk(8,
337 "bcm5974: abs: p: %+05d w: %+05d x: %+05d y: %+05d " 385 "bcm5974: abs: p: %+05d w: %+05d x: %+05d y: %+05d "
338 "nmin: %d nmax: %d n: %d\n", 386 "nmin: %d nmax: %d n: %d ibt: %d\n", abs_p, abs_w,
339 abs_p, abs_w, abs_x, abs_y, nmin, nmax, dev->fingers); 387 abs_x, abs_y, nmin, nmax, dev->fingers, ibt);
340 388
341 } 389 }
342 390
391 /* type 2 reports button events via ibt only */
392 if (c->tp_type == TYPE2)
393 input_report_key(input, BTN_LEFT, ibt);
394
343 input_sync(input); 395 input_sync(input);
344 396
345 return 0; 397 return 0;
@@ -649,6 +701,8 @@ static int bcm5974_probe(struct usb_interface *iface,
649 input_dev->name = "bcm5974"; 701 input_dev->name = "bcm5974";
650 input_dev->phys = dev->phys; 702 input_dev->phys = dev->phys;
651 usb_to_input_id(dev->udev, &input_dev->id); 703 usb_to_input_id(dev->udev, &input_dev->id);
704 /* report driver capabilities via the version field */
705 input_dev->id.version = cfg->caps;
652 input_dev->dev.parent = &iface->dev; 706 input_dev->dev.parent = &iface->dev;
653 707
654 input_set_drvdata(input_dev, dev); 708 input_set_drvdata(input_dev, dev);
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 6ab0eb1ada1c..4bc78892ba91 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Elantech Touchpad driver (v5) 2 * Elantech Touchpad driver (v6)
3 * 3 *
4 * Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net> 4 * Copyright (C) 2007-2009 Arjan Opmeer <arjan@opmeer.net>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published 7 * under the terms of the GNU General Public License version 2 as published
@@ -178,6 +178,7 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
178 struct elantech_data *etd = psmouse->private; 178 struct elantech_data *etd = psmouse->private;
179 unsigned char *packet = psmouse->packet; 179 unsigned char *packet = psmouse->packet;
180 int fingers; 180 int fingers;
181 static int old_fingers;
181 182
182 if (etd->fw_version_maj == 0x01) { 183 if (etd->fw_version_maj == 0x01) {
183 /* byte 0: D U p1 p2 1 p3 R L 184 /* byte 0: D U p1 p2 1 p3 R L
@@ -190,6 +191,14 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
190 fingers = (packet[0] & 0xc0) >> 6; 191 fingers = (packet[0] & 0xc0) >> 6;
191 } 192 }
192 193
194 if (etd->jumpy_cursor) {
195 /* Discard packets that are likely to have bogus coordinates */
196 if (fingers > old_fingers) {
197 elantech_debug("elantech.c: discarding packet\n");
198 goto discard_packet_v1;
199 }
200 }
201
193 input_report_key(dev, BTN_TOUCH, fingers != 0); 202 input_report_key(dev, BTN_TOUCH, fingers != 0);
194 203
195 /* byte 2: x7 x6 x5 x4 x3 x2 x1 x0 204 /* byte 2: x7 x6 x5 x4 x3 x2 x1 x0
@@ -216,6 +225,9 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
216 } 225 }
217 226
218 input_sync(dev); 227 input_sync(dev);
228
229 discard_packet_v1:
230 old_fingers = fingers;
219} 231}
220 232
221/* 233/*
@@ -363,9 +375,14 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
363 rc = -1; 375 rc = -1;
364 break; 376 break;
365 } 377 }
378 }
379
380 if (rc == 0) {
366 /* 381 /*
367 * Read back reg 0x10. The touchpad is probably initalising 382 * Read back reg 0x10. For hardware version 1 we must make
368 * and not ready until we read back the value we just wrote. 383 * sure the absolute mode bit is set. For hardware version 2
384 * the touchpad is probably initalising and not ready until
385 * we read back the value we just wrote.
369 */ 386 */
370 do { 387 do {
371 rc = elantech_read_reg(psmouse, 0x10, &val); 388 rc = elantech_read_reg(psmouse, 0x10, &val);
@@ -373,12 +390,18 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
373 break; 390 break;
374 tries--; 391 tries--;
375 elantech_debug("elantech.c: retrying read (%d).\n", 392 elantech_debug("elantech.c: retrying read (%d).\n",
376 tries); 393 tries);
377 msleep(ETP_READ_BACK_DELAY); 394 msleep(ETP_READ_BACK_DELAY);
378 } while (tries > 0); 395 } while (tries > 0);
379 if (rc) 396
397 if (rc) {
380 pr_err("elantech.c: failed to read back register 0x10.\n"); 398 pr_err("elantech.c: failed to read back register 0x10.\n");
381 break; 399 } else if (etd->hw_version == 1 &&
400 !(val & ETP_R10_ABSOLUTE_MODE)) {
401 pr_err("elantech.c: touchpad refuses "
402 "to switch to absolute mode.\n");
403 rc = -1;
404 }
382 } 405 }
383 406
384 if (rc) 407 if (rc)
@@ -662,6 +685,17 @@ int elantech_init(struct psmouse *psmouse)
662 param[0], param[1], param[2]); 685 param[0], param[1], param[2]);
663 etd->capabilities = param[0]; 686 etd->capabilities = param[0];
664 687
688 /*
689 * This firmware seems to suffer from misreporting coordinates when
690 * a touch action starts causing the mouse cursor or scrolled page
691 * to jump. Enable a workaround.
692 */
693 if (etd->fw_version_maj == 0x02 && etd->fw_version_min == 0x22) {
694 pr_info("elantech.c: firmware version 2.34 detected, "
695 "enabling jumpy cursor workaround\n");
696 etd->jumpy_cursor = 1;
697 }
698
665 if (elantech_set_absolute_mode(psmouse)) { 699 if (elantech_set_absolute_mode(psmouse)) {
666 pr_err("elantech.c: failed to put touchpad into absolute mode.\n"); 700 pr_err("elantech.c: failed to put touchpad into absolute mode.\n");
667 goto init_fail; 701 goto init_fail;
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
index bee282b540bc..ed848cc80814 100644
--- a/drivers/input/mouse/elantech.h
+++ b/drivers/input/mouse/elantech.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Elantech Touchpad driver (v5) 2 * Elantech Touchpad driver (v6)
3 * 3 *
4 * Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net> 4 * Copyright (C) 2007-2009 Arjan Opmeer <arjan@opmeer.net>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published 7 * under the terms of the GNU General Public License version 2 as published
@@ -104,6 +104,7 @@ struct elantech_data {
104 unsigned char fw_version_min; 104 unsigned char fw_version_min;
105 unsigned char hw_version; 105 unsigned char hw_version;
106 unsigned char paritycheck; 106 unsigned char paritycheck;
107 unsigned char jumpy_cursor;
107 unsigned char parity[256]; 108 unsigned char parity[256];
108}; 109};
109 110
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index df81b0aaa9f8..15ac3205ac05 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -61,6 +61,12 @@ static const struct dmi_system_id lifebook_dmi_table[] = {
61 }, 61 },
62 }, 62 },
63 { 63 {
64 .ident = "Lifebook B-2130",
65 .matches = {
66 DMI_MATCH(DMI_BOARD_NAME, "ZEPHYR"),
67 },
68 },
69 {
64 .ident = "Lifebook B213x/B2150", 70 .ident = "Lifebook B213x/B2150",
65 .matches = { 71 .matches = {
66 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"), 72 DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"),