Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input fixes from Dmitry Torokhov:
"The main change is support for keyboards and touchpads found in 2015
editions of Macbooks"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Revert "Input: zforce - don't overwrite the stack"
Input: bcm5974 - add support for the 2015 Macbook Pro
HID: apple: Add support for the 2015 Macbook Pro
Input: bcm5974 - prepare for a new trackpad generation
Input: synaptics - dump ext10 capabilities as well

+130 -56
+6
drivers/hid/hid-apple.c
··· 546 546 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, 547 547 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS), 548 548 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, 549 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI), 550 + .driver_data = APPLE_HAS_FN }, 551 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ISO), 552 + .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, 553 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_JIS), 554 + .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, 549 555 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), 550 556 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, 551 557 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
+6
drivers/hid/hid-core.c
··· 1782 1782 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) }, 1783 1783 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) }, 1784 1784 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) }, 1785 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI) }, 1786 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ISO) }, 1787 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_JIS) }, 1785 1788 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, 1786 1789 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, 1787 1790 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, ··· 2466 2463 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI) }, 2467 2464 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_ISO) }, 2468 2465 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING8_JIS) }, 2466 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI) }, 2467 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_ISO) }, 2468 + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING9_JIS) }, 2469 2469 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 2470 2470 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 2471 2471 { }
+3
drivers/hid/hid-ids.h
··· 142 142 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290 143 143 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291 144 144 #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292 145 + #define USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI 0x0272 146 + #define USB_DEVICE_ID_APPLE_WELLSPRING9_ISO 0x0273 147 + #define USB_DEVICE_ID_APPLE_WELLSPRING9_JIS 0x0274 145 148 #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a 146 149 #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b 147 150 #define USB_DEVICE_ID_APPLE_IRCONTROL 0x8240
+112 -53
drivers/input/mouse/bcm5974.c
··· 2 2 * Apple USB BCM5974 (Macbook Air and Penryn Macbook Pro) multitouch driver 3 3 * 4 4 * Copyright (C) 2008 Henrik Rydberg (rydberg@euromail.se) 5 + * Copyright (C) 2015 John Horan (knasher@gmail.com) 5 6 * 6 7 * The USB initialization and package decoding was made by 7 8 * Scott Shawcroft as part of the touchd user-space driver project: ··· 92 91 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI 0x0290 93 92 #define USB_DEVICE_ID_APPLE_WELLSPRING8_ISO 0x0291 94 93 #define USB_DEVICE_ID_APPLE_WELLSPRING8_JIS 0x0292 94 + /* MacbookPro12,1 (2015) */ 95 + #define USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI 0x0272 96 + #define USB_DEVICE_ID_APPLE_WELLSPRING9_ISO 0x0273 97 + #define USB_DEVICE_ID_APPLE_WELLSPRING9_JIS 0x0274 95 98 96 99 #define BCM5974_DEVICE(prod) { \ 97 100 .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ ··· 157 152 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ANSI), 158 153 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_ISO), 159 154 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING8_JIS), 155 + /* MacbookPro12,1 */ 156 + BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI), 157 + BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING9_ISO), 158 + BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING9_JIS), 160 159 /* Terminating entry */ 161 160 {} 162 161 }; ··· 189 180 enum tp_type { 190 181 TYPE1, /* plain trackpad */ 191 182 TYPE2, /* button integrated in trackpad */ 192 - TYPE3 /* additional header fields since June 2013 */ 183 + TYPE3, /* additional header fields since June 2013 */ 184 + TYPE4 /* additional header field for pressure data */ 193 185 }; 194 186 195 187 /* trackpad finger data offsets, le16-aligned */ 196 - #define FINGER_TYPE1 (13 * sizeof(__le16)) 197 - #define FINGER_TYPE2 (15 * sizeof(__le16)) 198 - #define FINGER_TYPE3 (19 * sizeof(__le16)) 188 + #define HEADER_TYPE1 (13 * sizeof(__le16)) 189 + #define HEADER_TYPE2 (15 * sizeof(__le16)) 190 + #define HEADER_TYPE3 (19 * sizeof(__le16)) 191 + #define HEADER_TYPE4 (23 * sizeof(__le16)) 199 192 200 193 /* trackpad button data offsets */ 194 + #define BUTTON_TYPE1 0 201 195 #define BUTTON_TYPE2 15 202 196 #define BUTTON_TYPE3 23 197 + #define BUTTON_TYPE4 31 203 198 204 199 /* list of device capability bits */ 205 200 #define HAS_INTEGRATED_BUTTON 1 201 + 202 + /* trackpad finger data block size */ 203 + #define FSIZE_TYPE1 (14 * sizeof(__le16)) 204 + #define FSIZE_TYPE2 (14 * sizeof(__le16)) 205 + #define FSIZE_TYPE3 (14 * sizeof(__le16)) 206 + #define FSIZE_TYPE4 (15 * sizeof(__le16)) 207 + 208 + /* offset from header to finger struct */ 209 + #define DELTA_TYPE1 (0 * sizeof(__le16)) 210 + #define DELTA_TYPE2 (0 * sizeof(__le16)) 211 + #define DELTA_TYPE3 (0 * sizeof(__le16)) 212 + #define DELTA_TYPE4 (1 * sizeof(__le16)) 213 + 214 + /* usb control message mode switch data */ 215 + #define USBMSG_TYPE1 8, 0x300, 0, 0, 0x1, 0x8 216 + #define USBMSG_TYPE2 8, 0x300, 0, 0, 0x1, 0x8 217 + #define USBMSG_TYPE3 8, 0x300, 0, 0, 0x1, 0x8 218 + #define USBMSG_TYPE4 2, 0x302, 2, 1, 0x1, 0x0 219 + 220 + /* Wellspring initialization constants */ 221 + #define BCM5974_WELLSPRING_MODE_READ_REQUEST_ID 1 222 + #define BCM5974_WELLSPRING_MODE_WRITE_REQUEST_ID 9 206 223 207 224 /* trackpad finger structure, le16-aligned */ 208 225 struct tp_finger { ··· 242 207 __le16 orientation; /* 16384 when point, else 15 bit angle */ 243 208 __le16 touch_major; /* touch area, major axis */ 244 209 __le16 touch_minor; /* touch area, minor axis */ 245 - __le16 unused[3]; /* zeros */ 210 + __le16 unused[2]; /* zeros */ 211 + __le16 pressure; /* pressure on forcetouch touchpad */ 246 212 __le16 multi; /* one finger: varies, more fingers: constant */ 247 213 } __attribute__((packed,aligned(2))); 248 214 249 215 /* trackpad finger data size, empirically at least ten fingers */ 250 216 #define MAX_FINGERS 16 251 - #define SIZEOF_FINGER sizeof(struct tp_finger) 252 - #define SIZEOF_ALL_FINGERS (MAX_FINGERS * SIZEOF_FINGER) 253 217 #define MAX_FINGER_ORIENTATION 16384 254 218 255 219 /* device-specific parameters */ ··· 266 232 int bt_datalen; /* data length of the button interface */ 267 233 int tp_ep; /* the endpoint of the trackpad interface */ 268 234 enum tp_type tp_type; /* type of trackpad interface */ 269 - int tp_offset; /* offset to trackpad finger data */ 235 + int tp_header; /* bytes in header block */ 270 236 int tp_datalen; /* data length of the trackpad interface */ 237 + int tp_button; /* offset to button data */ 238 + int tp_fsize; /* bytes in single finger block */ 239 + int tp_delta; /* offset from header to finger struct */ 240 + int um_size; /* usb control message length */ 241 + int um_req_val; /* usb control message value */ 242 + int um_req_idx; /* usb control message index */ 243 + int um_switch_idx; /* usb control message mode switch index */ 244 + int um_switch_on; /* usb control message mode switch on */ 245 + int um_switch_off; /* usb control message mode switch off */ 271 246 struct bcm5974_param p; /* finger pressure limits */ 272 247 struct bcm5974_param w; /* finger width limits */ 273 248 struct bcm5974_param x; /* horizontal limits */ ··· 302 259 int slots[MAX_FINGERS]; /* slot assignments */ 303 260 }; 304 261 262 + /* trackpad finger block data, le16-aligned */ 263 + static const struct tp_finger *get_tp_finger(const struct bcm5974 *dev, int i) 264 + { 265 + const struct bcm5974_config *c = &dev->cfg; 266 + u8 *f_base = dev->tp_data + c->tp_header + c->tp_delta; 267 + 268 + return (const struct tp_finger *)(f_base + i * c->tp_fsize); 269 + } 270 + 271 + #define DATAFORMAT(type) \ 272 + type, \ 273 + HEADER_##type, \ 274 + HEADER_##type + (MAX_FINGERS) * (FSIZE_##type), \ 275 + BUTTON_##type, \ 276 + FSIZE_##type, \ 277 + DELTA_##type, \ 278 + USBMSG_##type 279 + 305 280 /* logical signal quality */ 306 281 #define SN_PRESSURE 45 /* pressure signal-to-noise ratio */ 307 282 #define SN_WIDTH 25 /* width signal-to-noise ratio */ ··· 334 273 USB_DEVICE_ID_APPLE_WELLSPRING_JIS, 335 274 0, 336 275 0x84, sizeof(struct bt_data), 337 - 0x81, TYPE1, FINGER_TYPE1, FINGER_TYPE1 + SIZEOF_ALL_FINGERS, 276 + 0x81, DATAFORMAT(TYPE1), 338 277 { SN_PRESSURE, 0, 256 }, 339 278 { SN_WIDTH, 0, 2048 }, 340 279 { SN_COORD, -4824, 5342 }, ··· 347 286 USB_DEVICE_ID_APPLE_WELLSPRING2_JIS, 348 287 0, 349 288 0x84, sizeof(struct bt_data), 350 - 0x81, TYPE1, FINGER_TYPE1, FINGER_TYPE1 + SIZEOF_ALL_FINGERS, 289 + 0x81, DATAFORMAT(TYPE1), 351 290 { SN_PRESSURE, 0, 256 }, 352 291 { SN_WIDTH, 0, 2048 }, 353 292 { SN_COORD, -4824, 4824 }, ··· 360 299 USB_DEVICE_ID_APPLE_WELLSPRING3_JIS, 361 300 HAS_INTEGRATED_BUTTON, 362 301 0x84, sizeof(struct bt_data), 363 - 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, 302 + 0x81, DATAFORMAT(TYPE2), 364 303 { SN_PRESSURE, 0, 300 }, 365 304 { SN_WIDTH, 0, 2048 }, 366 305 { SN_COORD, -4460, 5166 }, ··· 373 312 USB_DEVICE_ID_APPLE_WELLSPRING4_JIS, 374 313 HAS_INTEGRATED_BUTTON, 375 314 0x84, sizeof(struct bt_data), 376 - 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, 315 + 0x81, DATAFORMAT(TYPE2), 377 316 { SN_PRESSURE, 0, 300 }, 378 317 { SN_WIDTH, 0, 2048 }, 379 318 { SN_COORD, -4620, 5140 }, ··· 386 325 USB_DEVICE_ID_APPLE_WELLSPRING4A_JIS, 387 326 HAS_INTEGRATED_BUTTON, 388 327 0x84, sizeof(struct bt_data), 389 - 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, 328 + 0x81, DATAFORMAT(TYPE2), 390 329 { SN_PRESSURE, 0, 300 }, 391 330 { SN_WIDTH, 0, 2048 }, 392 331 { SN_COORD, -4616, 5112 }, ··· 399 338 USB_DEVICE_ID_APPLE_WELLSPRING5_JIS, 400 339 HAS_INTEGRATED_BUTTON, 401 340 0x84, sizeof(struct bt_data), 402 - 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, 341 + 0x81, DATAFORMAT(TYPE2), 403 342 { SN_PRESSURE, 0, 300 }, 404 343 { SN_WIDTH, 0, 2048 }, 405 344 { SN_COORD, -4415, 5050 }, ··· 412 351 USB_DEVICE_ID_APPLE_WELLSPRING6_JIS, 413 352 HAS_INTEGRATED_BUTTON, 414 353 0x84, sizeof(struct bt_data), 415 - 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, 354 + 0x81, DATAFORMAT(TYPE2), 416 355 { SN_PRESSURE, 0, 300 }, 417 356 { SN_WIDTH, 0, 2048 }, 418 357 { SN_COORD, -4620, 5140 }, ··· 425 364 USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS, 426 365 HAS_INTEGRATED_BUTTON, 427 366 0x84, sizeof(struct bt_data), 428 - 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, 367 + 0x81, DATAFORMAT(TYPE2), 429 368 { SN_PRESSURE, 0, 300 }, 430 369 { SN_WIDTH, 0, 2048 }, 431 370 { SN_COORD, -4750, 5280 }, ··· 438 377 USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS, 439 378 HAS_INTEGRATED_BUTTON, 440 379 0x84, sizeof(struct bt_data), 441 - 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, 380 + 0x81, DATAFORMAT(TYPE2), 442 381 { SN_PRESSURE, 0, 300 }, 443 382 { SN_WIDTH, 0, 2048 }, 444 383 { SN_COORD, -4620, 5140 }, ··· 451 390 USB_DEVICE_ID_APPLE_WELLSPRING7_JIS, 452 391 HAS_INTEGRATED_BUTTON, 453 392 0x84, sizeof(struct bt_data), 454 - 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, 393 + 0x81, DATAFORMAT(TYPE2), 455 394 { SN_PRESSURE, 0, 300 }, 456 395 { SN_WIDTH, 0, 2048 }, 457 396 { SN_COORD, -4750, 5280 }, ··· 464 403 USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS, 465 404 HAS_INTEGRATED_BUTTON, 466 405 0x84, sizeof(struct bt_data), 467 - 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, 406 + 0x81, DATAFORMAT(TYPE2), 468 407 { SN_PRESSURE, 0, 300 }, 469 408 { SN_WIDTH, 0, 2048 }, 470 409 { SN_COORD, -4750, 5280 }, ··· 477 416 USB_DEVICE_ID_APPLE_WELLSPRING8_JIS, 478 417 HAS_INTEGRATED_BUTTON, 479 418 0, sizeof(struct bt_data), 480 - 0x83, TYPE3, FINGER_TYPE3, FINGER_TYPE3 + SIZEOF_ALL_FINGERS, 419 + 0x83, DATAFORMAT(TYPE3), 481 420 { SN_PRESSURE, 0, 300 }, 482 421 { SN_WIDTH, 0, 2048 }, 483 422 { SN_COORD, -4620, 5140 }, 484 423 { SN_COORD, -150, 6600 }, 424 + { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } 425 + }, 426 + { 427 + USB_DEVICE_ID_APPLE_WELLSPRING9_ANSI, 428 + USB_DEVICE_ID_APPLE_WELLSPRING9_ISO, 429 + USB_DEVICE_ID_APPLE_WELLSPRING9_JIS, 430 + HAS_INTEGRATED_BUTTON, 431 + 0, sizeof(struct bt_data), 432 + 0x83, DATAFORMAT(TYPE4), 433 + { SN_PRESSURE, 0, 300 }, 434 + { SN_WIDTH, 0, 2048 }, 435 + { SN_COORD, -4828, 5345 }, 436 + { SN_COORD, -203, 6803 }, 485 437 { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } 486 438 }, 487 439 {} ··· 623 549 struct input_dev *input = dev->input; 624 550 int raw_n, i, n = 0; 625 551 626 - if (size < c->tp_offset || (size - c->tp_offset) % SIZEOF_FINGER != 0) 552 + if (size < c->tp_header || (size - c->tp_header) % c->tp_fsize != 0) 627 553 return -EIO; 628 554 629 - /* finger data, le16-aligned */ 630 - f = (const struct tp_finger *)(dev->tp_data + c->tp_offset); 631 - raw_n = (size - c->tp_offset) / SIZEOF_FINGER; 555 + raw_n = (size - c->tp_header) / c->tp_fsize; 632 556 633 557 for (i = 0; i < raw_n; i++) { 634 - if (raw2int(f[i].touch_major) == 0) 558 + f = get_tp_finger(dev, i); 559 + if (raw2int(f->touch_major) == 0) 635 560 continue; 636 - dev->pos[n].x = raw2int(f[i].abs_x); 637 - dev->pos[n].y = c->y.min + c->y.max - raw2int(f[i].abs_y); 638 - dev->index[n++] = &f[i]; 561 + dev->pos[n].x = raw2int(f->abs_x); 562 + dev->pos[n].y = c->y.min + c->y.max - raw2int(f->abs_y); 563 + dev->index[n++] = f; 639 564 } 640 565 641 566 input_mt_assign_slots(input, dev->slots, dev->pos, n, 0); ··· 645 572 646 573 input_mt_sync_frame(input); 647 574 648 - report_synaptics_data(input, c, f, raw_n); 575 + report_synaptics_data(input, c, get_tp_finger(dev, 0), raw_n); 649 576 650 - /* type 2 reports button events via ibt only */ 651 - if (c->tp_type == TYPE2) { 652 - int ibt = raw2int(dev->tp_data[BUTTON_TYPE2]); 577 + /* later types report button events via integrated button only */ 578 + if (c->caps & HAS_INTEGRATED_BUTTON) { 579 + int ibt = raw2int(dev->tp_data[c->tp_button]); 653 580 input_report_key(input, BTN_LEFT, ibt); 654 581 } 655 - 656 - if (c->tp_type == TYPE3) 657 - input_report_key(input, BTN_LEFT, dev->tp_data[BUTTON_TYPE3]); 658 582 659 583 input_sync(input); 660 584 661 585 return 0; 662 586 } 663 587 664 - /* Wellspring initialization constants */ 665 - #define BCM5974_WELLSPRING_MODE_READ_REQUEST_ID 1 666 - #define BCM5974_WELLSPRING_MODE_WRITE_REQUEST_ID 9 667 - #define BCM5974_WELLSPRING_MODE_REQUEST_VALUE 0x300 668 - #define BCM5974_WELLSPRING_MODE_REQUEST_INDEX 0 669 - #define BCM5974_WELLSPRING_MODE_VENDOR_VALUE 0x01 670 - #define BCM5974_WELLSPRING_MODE_NORMAL_VALUE 0x08 671 - 672 588 static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) 673 589 { 590 + const struct bcm5974_config *c = &dev->cfg; 674 591 int retval = 0, size; 675 592 char *data; 676 593 ··· 668 605 if (dev->cfg.tp_type == TYPE3) 669 606 return 0; 670 607 671 - data = kmalloc(8, GFP_KERNEL); 608 + data = kmalloc(c->um_size, GFP_KERNEL); 672 609 if (!data) { 673 610 dev_err(&dev->intf->dev, "out of memory\n"); 674 611 retval = -ENOMEM; ··· 679 616 size = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0), 680 617 BCM5974_WELLSPRING_MODE_READ_REQUEST_ID, 681 618 USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 682 - BCM5974_WELLSPRING_MODE_REQUEST_VALUE, 683 - BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); 619 + c->um_req_val, c->um_req_idx, data, c->um_size, 5000); 684 620 685 - if (size != 8) { 621 + if (size != c->um_size) { 686 622 dev_err(&dev->intf->dev, "could not read from device\n"); 687 623 retval = -EIO; 688 624 goto out; 689 625 } 690 626 691 627 /* apply the mode switch */ 692 - data[0] = on ? 693 - BCM5974_WELLSPRING_MODE_VENDOR_VALUE : 694 - BCM5974_WELLSPRING_MODE_NORMAL_VALUE; 628 + data[c->um_switch_idx] = on ? c->um_switch_on : c->um_switch_off; 695 629 696 630 /* write configuration */ 697 631 size = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), 698 632 BCM5974_WELLSPRING_MODE_WRITE_REQUEST_ID, 699 633 USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, 700 - BCM5974_WELLSPRING_MODE_REQUEST_VALUE, 701 - BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); 634 + c->um_req_val, c->um_req_idx, data, c->um_size, 5000); 702 635 703 - if (size != 8) { 636 + if (size != c->um_size) { 704 637 dev_err(&dev->intf->dev, "could not write to device\n"); 705 638 retval = -EIO; 706 639 goto out;
+2 -2
drivers/input/mouse/synaptics.c
··· 1484 1484 priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; 1485 1485 1486 1486 psmouse_info(psmouse, 1487 - "Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx, board id: %lu, fw id: %lu\n", 1487 + "Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx/%#lx, board id: %lu, fw id: %lu\n", 1488 1488 SYN_ID_MODEL(priv->identity), 1489 1489 SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), 1490 1490 priv->model_id, 1491 1491 priv->capabilities, priv->ext_cap, priv->ext_cap_0c, 1492 - priv->board_id, priv->firmware_id); 1492 + priv->ext_cap_10, priv->board_id, priv->firmware_id); 1493 1493 1494 1494 set_input_params(psmouse, priv); 1495 1495
+1 -1
drivers/input/touchscreen/zforce_ts.c
··· 429 429 goto unlock; 430 430 } 431 431 432 - if (buf[PAYLOAD_LENGTH] == 0 || buf[PAYLOAD_LENGTH] > FRAME_MAXSIZE) { 432 + if (buf[PAYLOAD_LENGTH] == 0) { 433 433 dev_err(&client->dev, "invalid payload length: %d\n", 434 434 buf[PAYLOAD_LENGTH]); 435 435 ret = -EIO;