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: i8042 - make Lenovo 3000 N100 blacklist entry more specific
Input: bcm5974 - add BTN_TOUCH event for mousedev benefit
Input: bcm5974 - improve finger tracking and counting
Input: bcm5974 - small formatting cleanup
Input: bcm5974 - add maintainer entry

+58 -18
+57 -17
drivers/input/mouse/bcm5974.c
··· 63 63 } 64 64 65 65 /* table of devices that work with this driver */ 66 - static const struct usb_device_id bcm5974_table [] = { 66 + static const struct usb_device_id bcm5974_table[] = { 67 67 /* MacbookAir1.1 */ 68 68 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING_ANSI), 69 69 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING_ISO), ··· 105 105 106 106 /* trackpad finger structure */ 107 107 struct tp_finger { 108 - __le16 origin; /* left/right origin? */ 108 + __le16 origin; /* zero when switching track finger */ 109 109 __le16 abs_x; /* absolute x coodinate */ 110 110 __le16 abs_y; /* absolute y coodinate */ 111 111 __le16 rel_x; /* relative x coodinate */ ··· 159 159 struct bt_data *bt_data; /* button transferred data */ 160 160 struct urb *tp_urb; /* trackpad usb request block */ 161 161 struct tp_data *tp_data; /* trackpad transferred data */ 162 + int fingers; /* number of fingers on trackpad */ 162 163 }; 163 164 164 165 /* logical dimensions */ ··· 172 171 #define SN_PRESSURE 45 /* pressure signal-to-noise ratio */ 173 172 #define SN_WIDTH 100 /* width signal-to-noise ratio */ 174 173 #define SN_COORD 250 /* coordinate signal-to-noise ratio */ 174 + 175 + /* pressure thresholds */ 176 + #define PRESSURE_LOW (2 * DIM_PRESSURE / SN_PRESSURE) 177 + #define PRESSURE_HIGH (3 * PRESSURE_LOW) 175 178 176 179 /* device constants */ 177 180 static const struct bcm5974_config bcm5974_config_table[] = { ··· 253 248 0, cfg->y.dim, cfg->y.fuzz, 0); 254 249 255 250 __set_bit(EV_KEY, input_dev->evbit); 251 + __set_bit(BTN_TOUCH, input_dev->keybit); 256 252 __set_bit(BTN_TOOL_FINGER, input_dev->keybit); 257 253 __set_bit(BTN_TOOL_DOUBLETAP, input_dev->keybit); 258 254 __set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); ··· 279 273 const struct tp_finger *f = dev->tp_data->finger; 280 274 struct input_dev *input = dev->input; 281 275 const int fingers = (size - 26) / 28; 282 - int p = 0, w, x, y, n = 0; 276 + int raw_p, raw_w, raw_x, raw_y; 277 + int ptest = 0, origin = 0, nmin = 0, nmax = 0; 278 + int abs_p = 0, abs_w = 0, abs_x = 0, abs_y = 0; 283 279 284 280 if (size < 26 || (size - 26) % 28 != 0) 285 281 return -EIO; 286 282 283 + /* always track the first finger; when detached, start over */ 287 284 if (fingers) { 288 - p = raw2int(f->force_major); 289 - w = raw2int(f->size_major); 290 - x = raw2int(f->abs_x); 291 - y = raw2int(f->abs_y); 292 - n = p > 0 ? fingers : 0; 285 + raw_p = raw2int(f->force_major); 286 + raw_w = raw2int(f->size_major); 287 + raw_x = raw2int(f->abs_x); 288 + raw_y = raw2int(f->abs_y); 293 289 294 290 dprintk(9, 295 - "bcm5974: p: %+05d w: %+05d x: %+05d y: %+05d n: %d\n", 296 - p, w, x, y, n); 291 + "bcm5974: raw: p: %+05d w: %+05d x: %+05d y: %+05d\n", 292 + raw_p, raw_w, raw_x, raw_y); 297 293 298 - input_report_abs(input, ABS_TOOL_WIDTH, int2bound(&c->w, w)); 299 - input_report_abs(input, ABS_X, int2bound(&c->x, x - c->x.devmin)); 300 - input_report_abs(input, ABS_Y, int2bound(&c->y, c->y.devmax - y)); 294 + ptest = int2bound(&c->p, raw_p); 295 + origin = raw2int(f->origin); 301 296 } 302 297 303 - input_report_abs(input, ABS_PRESSURE, int2bound(&c->p, p)); 298 + /* while tracking finger still valid, count all fingers */ 299 + if (ptest > PRESSURE_LOW && origin) { 300 + abs_p = ptest; 301 + abs_w = int2bound(&c->w, raw_w); 302 + abs_x = int2bound(&c->x, raw_x - c->x.devmin); 303 + abs_y = int2bound(&c->y, c->y.devmax - raw_y); 304 + for (; f != dev->tp_data->finger + fingers; f++) { 305 + ptest = int2bound(&c->p, raw2int(f->force_major)); 306 + if (ptest > PRESSURE_LOW) 307 + nmax++; 308 + if (ptest > PRESSURE_HIGH) 309 + nmin++; 310 + } 311 + } 304 312 305 - input_report_key(input, BTN_TOOL_FINGER, n == 1); 306 - input_report_key(input, BTN_TOOL_DOUBLETAP, n == 2); 307 - input_report_key(input, BTN_TOOL_TRIPLETAP, n > 2); 313 + if (dev->fingers < nmin) 314 + dev->fingers = nmin; 315 + if (dev->fingers > nmax) 316 + dev->fingers = nmax; 317 + 318 + input_report_key(input, BTN_TOUCH, dev->fingers > 0); 319 + input_report_key(input, BTN_TOOL_FINGER, dev->fingers == 1); 320 + input_report_key(input, BTN_TOOL_DOUBLETAP, dev->fingers == 2); 321 + input_report_key(input, BTN_TOOL_TRIPLETAP, dev->fingers > 2); 322 + 323 + input_report_abs(input, ABS_PRESSURE, abs_p); 324 + input_report_abs(input, ABS_TOOL_WIDTH, abs_w); 325 + 326 + if (abs_p) { 327 + input_report_abs(input, ABS_X, abs_x); 328 + input_report_abs(input, ABS_Y, abs_y); 329 + 330 + dprintk(8, 331 + "bcm5974: abs: p: %+05d w: %+05d x: %+05d y: %+05d " 332 + "nmin: %d nmax: %d n: %d\n", 333 + abs_p, abs_w, abs_x, abs_y, nmin, nmax, dev->fingers); 334 + 335 + } 308 336 309 337 input_sync(input); 310 338
+1 -1
drivers/input/serio/i8042-x86ia64io.h
··· 305 305 .ident = "Lenovo 3000 n100", 306 306 .matches = { 307 307 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 308 - DMI_MATCH(DMI_PRODUCT_VERSION, "3000 N100"), 308 + DMI_MATCH(DMI_PRODUCT_NAME, "076804U"), 309 309 }, 310 310 }, 311 311 {