diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-20 12:16:07 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-20 12:16:07 -0400 |
| commit | d638d4990bfb99998420e78e8fd4607bca5cf8d0 (patch) | |
| tree | 8f09b50e65a32403ae0348c2768bc466a9c8b764 | |
| parent | 8c6b065b792061c2e471d530127f2348fd9d243d (diff) | |
| parent | 5a6eb676d3bc4d7a6feab200a92437b62ad298da (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: appletouch - improve powersaving for Geyser3 devices
Input: lifebook - fix an oops on Panasonic CF-18
Input: document intended meaning of KEY_SWITCHVIDEOMODE
Input: switch to using seq_list_xxx helpers
Input: i8042 - give more trust to PNP data on i386
Input: add driver for Fujitsu serial touchscreens
Input: ads7846 - re-check pendown status before reporting events
Input: ads7846 - introduce sample settling delay
Input: xpad - add support for leds on xbox 360 pad
| -rw-r--r-- | drivers/input/input.c | 29 | ||||
| -rw-r--r-- | drivers/input/joystick/Kconfig | 7 | ||||
| -rw-r--r-- | drivers/input/joystick/xpad.c | 190 | ||||
| -rw-r--r-- | drivers/input/mouse/appletouch.c | 111 | ||||
| -rw-r--r-- | drivers/input/mouse/lifebook.c | 2 | ||||
| -rw-r--r-- | drivers/input/serio/i8042-x86ia64io.h | 36 | ||||
| -rw-r--r-- | drivers/input/touchscreen/Kconfig | 13 | ||||
| -rw-r--r-- | drivers/input/touchscreen/Makefile | 1 | ||||
| -rw-r--r-- | drivers/input/touchscreen/ads7846.c | 80 | ||||
| -rw-r--r-- | drivers/input/touchscreen/fujitsu_ts.c | 189 | ||||
| -rw-r--r-- | include/linux/input.h | 3 | ||||
| -rw-r--r-- | include/linux/serio.h | 1 | ||||
| -rw-r--r-- | include/linux/spi/ads7846.h | 14 |
13 files changed, 562 insertions, 114 deletions
diff --git a/drivers/input/input.c b/drivers/input/input.c index 75b4d2a83dd9..5fe755586623 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
| @@ -471,37 +471,16 @@ static unsigned int input_proc_devices_poll(struct file *file, poll_table *wait) | |||
| 471 | return 0; | 471 | return 0; |
| 472 | } | 472 | } |
| 473 | 473 | ||
| 474 | static struct list_head *list_get_nth_element(struct list_head *list, loff_t *pos) | ||
| 475 | { | ||
| 476 | struct list_head *node; | ||
| 477 | loff_t i = 0; | ||
| 478 | |||
| 479 | list_for_each(node, list) | ||
| 480 | if (i++ == *pos) | ||
| 481 | return node; | ||
| 482 | |||
| 483 | return NULL; | ||
| 484 | } | ||
| 485 | |||
| 486 | static struct list_head *list_get_next_element(struct list_head *list, struct list_head *element, loff_t *pos) | ||
| 487 | { | ||
| 488 | if (element->next == list) | ||
| 489 | return NULL; | ||
| 490 | |||
| 491 | ++(*pos); | ||
| 492 | return element->next; | ||
| 493 | } | ||
| 494 | |||
| 495 | static void *input_devices_seq_start(struct seq_file *seq, loff_t *pos) | 474 | static void *input_devices_seq_start(struct seq_file *seq, loff_t *pos) |
| 496 | { | 475 | { |
| 497 | /* acquire lock here ... Yes, we do need locking, I knowi, I know... */ | 476 | /* acquire lock here ... Yes, we do need locking, I knowi, I know... */ |
| 498 | 477 | ||
| 499 | return list_get_nth_element(&input_dev_list, pos); | 478 | return seq_list_start(&input_dev_list, *pos); |
| 500 | } | 479 | } |
| 501 | 480 | ||
| 502 | static void *input_devices_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 481 | static void *input_devices_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
| 503 | { | 482 | { |
| 504 | return list_get_next_element(&input_dev_list, v, pos); | 483 | return seq_list_next(v, &input_dev_list, pos); |
| 505 | } | 484 | } |
| 506 | 485 | ||
| 507 | static void input_devices_seq_stop(struct seq_file *seq, void *v) | 486 | static void input_devices_seq_stop(struct seq_file *seq, void *v) |
| @@ -592,13 +571,13 @@ static void *input_handlers_seq_start(struct seq_file *seq, loff_t *pos) | |||
| 592 | { | 571 | { |
| 593 | /* acquire lock here ... Yes, we do need locking, I knowi, I know... */ | 572 | /* acquire lock here ... Yes, we do need locking, I knowi, I know... */ |
| 594 | seq->private = (void *)(unsigned long)*pos; | 573 | seq->private = (void *)(unsigned long)*pos; |
| 595 | return list_get_nth_element(&input_handler_list, pos); | 574 | return seq_list_start(&input_handler_list, *pos); |
| 596 | } | 575 | } |
| 597 | 576 | ||
| 598 | static void *input_handlers_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 577 | static void *input_handlers_seq_next(struct seq_file *seq, void *v, loff_t *pos) |
| 599 | { | 578 | { |
| 600 | seq->private = (void *)(unsigned long)(*pos + 1); | 579 | seq->private = (void *)(unsigned long)(*pos + 1); |
| 601 | return list_get_next_element(&input_handler_list, v, pos); | 580 | return seq_list_next(v, &input_handler_list, pos); |
| 602 | } | 581 | } |
| 603 | 582 | ||
| 604 | static void input_handlers_seq_stop(struct seq_file *seq, void *v) | 583 | static void input_handlers_seq_stop(struct seq_file *seq, void *v) |
diff --git a/drivers/input/joystick/Kconfig b/drivers/input/joystick/Kconfig index 12db72d83ea0..e2abe18e575d 100644 --- a/drivers/input/joystick/Kconfig +++ b/drivers/input/joystick/Kconfig | |||
| @@ -275,4 +275,11 @@ config JOYSTICK_XPAD_FF | |||
| 275 | ---help--- | 275 | ---help--- |
| 276 | Say Y here if you want to take advantage of xbox 360 rumble features. | 276 | Say Y here if you want to take advantage of xbox 360 rumble features. |
| 277 | 277 | ||
| 278 | config JOYSTICK_XPAD_LEDS | ||
| 279 | bool "LED Support for Xbox360 controller 'BigX' LED" | ||
| 280 | depends on LEDS_CLASS && JOYSTICK_XPAD | ||
| 281 | ---help--- | ||
| 282 | This option enables support for the LED which surrounds the Big X on | ||
| 283 | XBox 360 controller. | ||
| 284 | |||
| 278 | endif | 285 | endif |
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c index 244089c52650..28080395899c 100644 --- a/drivers/input/joystick/xpad.c +++ b/drivers/input/joystick/xpad.c | |||
| @@ -191,13 +191,18 @@ struct usb_xpad { | |||
| 191 | unsigned char *idata; /* input data */ | 191 | unsigned char *idata; /* input data */ |
| 192 | dma_addr_t idata_dma; | 192 | dma_addr_t idata_dma; |
| 193 | 193 | ||
| 194 | #ifdef CONFIG_JOYSTICK_XPAD_FF | 194 | #if defined(CONFIG_JOYSTICK_XPAD_FF) || defined(CONFIG_JOYSTICK_XPAD_LEDS) |
| 195 | struct urb *irq_out; /* urb for interrupt out report */ | 195 | struct urb *irq_out; /* urb for interrupt out report */ |
| 196 | unsigned char *odata; /* output data */ | 196 | unsigned char *odata; /* output data */ |
| 197 | dma_addr_t odata_dma; | 197 | dma_addr_t odata_dma; |
| 198 | struct mutex odata_mutex; | ||
| 199 | #endif | ||
| 200 | |||
| 201 | #if defined(CONFIG_JOYSTICK_XPAD_LEDS) | ||
| 202 | struct xpad_led *led; | ||
| 198 | #endif | 203 | #endif |
| 199 | 204 | ||
| 200 | char phys[65]; /* physical device path */ | 205 | char phys[64]; /* physical device path */ |
| 201 | 206 | ||
| 202 | int dpad_mapping; /* map d-pad to buttons or to axes */ | 207 | int dpad_mapping; /* map d-pad to buttons or to axes */ |
| 203 | int xtype; /* type of xbox device */ | 208 | int xtype; /* type of xbox device */ |
| @@ -349,7 +354,7 @@ exit: | |||
| 349 | __FUNCTION__, retval); | 354 | __FUNCTION__, retval); |
| 350 | } | 355 | } |
| 351 | 356 | ||
| 352 | #ifdef CONFIG_JOYSTICK_XPAD_FF | 357 | #if defined(CONFIG_JOYSTICK_XPAD_FF) || defined(CONFIG_JOYSTICK_XPAD_LEDS) |
| 353 | static void xpad_irq_out(struct urb *urb) | 358 | static void xpad_irq_out(struct urb *urb) |
| 354 | { | 359 | { |
| 355 | int retval; | 360 | int retval; |
| @@ -376,29 +381,7 @@ exit: | |||
| 376 | __FUNCTION__, retval); | 381 | __FUNCTION__, retval); |
| 377 | } | 382 | } |
| 378 | 383 | ||
| 379 | static int xpad_play_effect(struct input_dev *dev, void *data, | 384 | static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) |
| 380 | struct ff_effect *effect) | ||
| 381 | { | ||
| 382 | struct usb_xpad *xpad = input_get_drvdata(dev); | ||
| 383 | |||
| 384 | if (effect->type == FF_RUMBLE) { | ||
| 385 | __u16 strong = effect->u.rumble.strong_magnitude; | ||
| 386 | __u16 weak = effect->u.rumble.weak_magnitude; | ||
| 387 | xpad->odata[0] = 0x00; | ||
| 388 | xpad->odata[1] = 0x08; | ||
| 389 | xpad->odata[2] = 0x00; | ||
| 390 | xpad->odata[3] = strong / 256; | ||
| 391 | xpad->odata[4] = weak / 256; | ||
| 392 | xpad->odata[5] = 0x00; | ||
| 393 | xpad->odata[6] = 0x00; | ||
| 394 | xpad->odata[7] = 0x00; | ||
| 395 | usb_submit_urb(xpad->irq_out, GFP_KERNEL); | ||
| 396 | } | ||
| 397 | |||
| 398 | return 0; | ||
| 399 | } | ||
| 400 | |||
| 401 | static int xpad_init_ff(struct usb_interface *intf, struct usb_xpad *xpad) | ||
| 402 | { | 385 | { |
| 403 | struct usb_endpoint_descriptor *ep_irq_out; | 386 | struct usb_endpoint_descriptor *ep_irq_out; |
| 404 | int error = -ENOMEM; | 387 | int error = -ENOMEM; |
| @@ -411,6 +394,8 @@ static int xpad_init_ff(struct usb_interface *intf, struct usb_xpad *xpad) | |||
| 411 | if (!xpad->odata) | 394 | if (!xpad->odata) |
| 412 | goto fail1; | 395 | goto fail1; |
| 413 | 396 | ||
| 397 | mutex_init(&xpad->odata_mutex); | ||
| 398 | |||
| 414 | xpad->irq_out = usb_alloc_urb(0, GFP_KERNEL); | 399 | xpad->irq_out = usb_alloc_urb(0, GFP_KERNEL); |
| 415 | if (!xpad->irq_out) | 400 | if (!xpad->irq_out) |
| 416 | goto fail2; | 401 | goto fail2; |
| @@ -423,25 +408,19 @@ static int xpad_init_ff(struct usb_interface *intf, struct usb_xpad *xpad) | |||
| 423 | xpad->irq_out->transfer_dma = xpad->odata_dma; | 408 | xpad->irq_out->transfer_dma = xpad->odata_dma; |
| 424 | xpad->irq_out->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 409 | xpad->irq_out->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
| 425 | 410 | ||
| 426 | input_set_capability(xpad->dev, EV_FF, FF_RUMBLE); | ||
| 427 | |||
| 428 | error = input_ff_create_memless(xpad->dev, NULL, xpad_play_effect); | ||
| 429 | if (error) | ||
| 430 | goto fail2; | ||
| 431 | |||
| 432 | return 0; | 411 | return 0; |
| 433 | 412 | ||
| 434 | fail2: usb_buffer_free(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma); | 413 | fail2: usb_buffer_free(xpad->udev, XPAD_PKT_LEN, xpad->odata, xpad->odata_dma); |
| 435 | fail1: return error; | 414 | fail1: return error; |
| 436 | } | 415 | } |
| 437 | 416 | ||
| 438 | static void xpad_stop_ff(struct usb_xpad *xpad) | 417 | static void xpad_stop_output(struct usb_xpad *xpad) |
| 439 | { | 418 | { |
| 440 | if (xpad->xtype == XTYPE_XBOX360) | 419 | if (xpad->xtype == XTYPE_XBOX360) |
| 441 | usb_kill_urb(xpad->irq_out); | 420 | usb_kill_urb(xpad->irq_out); |
| 442 | } | 421 | } |
| 443 | 422 | ||
| 444 | static void xpad_deinit_ff(struct usb_xpad *xpad) | 423 | static void xpad_deinit_output(struct usb_xpad *xpad) |
| 445 | { | 424 | { |
| 446 | if (xpad->xtype == XTYPE_XBOX360) { | 425 | if (xpad->xtype == XTYPE_XBOX360) { |
| 447 | usb_free_urb(xpad->irq_out); | 426 | usb_free_urb(xpad->irq_out); |
| @@ -449,13 +428,130 @@ static void xpad_deinit_ff(struct usb_xpad *xpad) | |||
| 449 | xpad->odata, xpad->odata_dma); | 428 | xpad->odata, xpad->odata_dma); |
| 450 | } | 429 | } |
| 451 | } | 430 | } |
| 431 | #else | ||
| 432 | static int xpad_init_output(struct usb_interface *intf, struct usb_xpad *xpad) { return 0; } | ||
| 433 | static void xpad_deinit_output(struct usb_xpad *xpad) {} | ||
| 434 | static void xpad_stop_output(struct usb_xpad *xpad) {} | ||
| 435 | #endif | ||
| 436 | |||
| 437 | #ifdef CONFIG_JOYSTICK_XPAD_FF | ||
| 438 | static int xpad_play_effect(struct input_dev *dev, void *data, | ||
| 439 | struct ff_effect *effect) | ||
| 440 | { | ||
| 441 | struct usb_xpad *xpad = input_get_drvdata(dev); | ||
| 452 | 442 | ||
| 443 | if (effect->type == FF_RUMBLE) { | ||
| 444 | __u16 strong = effect->u.rumble.strong_magnitude; | ||
| 445 | __u16 weak = effect->u.rumble.weak_magnitude; | ||
| 446 | xpad->odata[0] = 0x00; | ||
| 447 | xpad->odata[1] = 0x08; | ||
| 448 | xpad->odata[2] = 0x00; | ||
| 449 | xpad->odata[3] = strong / 256; | ||
| 450 | xpad->odata[4] = weak / 256; | ||
| 451 | xpad->odata[5] = 0x00; | ||
| 452 | xpad->odata[6] = 0x00; | ||
| 453 | xpad->odata[7] = 0x00; | ||
| 454 | usb_submit_urb(xpad->irq_out, GFP_KERNEL); | ||
| 455 | } | ||
| 456 | |||
| 457 | return 0; | ||
| 458 | } | ||
| 459 | |||
| 460 | static int xpad_init_ff(struct usb_xpad *xpad) | ||
| 461 | { | ||
| 462 | input_set_capability(xpad->dev, EV_FF, FF_RUMBLE); | ||
| 463 | |||
| 464 | return input_ff_create_memless(xpad->dev, NULL, xpad_play_effect); | ||
| 465 | } | ||
| 466 | |||
| 467 | #else | ||
| 468 | static int xpad_init_ff(struct usb_xpad *xpad) { return 0; } | ||
| 469 | #endif | ||
| 470 | |||
| 471 | #if defined(CONFIG_JOYSTICK_XPAD_LEDS) | ||
| 472 | #include <linux/leds.h> | ||
| 473 | |||
| 474 | struct xpad_led { | ||
| 475 | char name[16]; | ||
| 476 | struct led_classdev led_cdev; | ||
| 477 | struct usb_xpad *xpad; | ||
| 478 | }; | ||
| 479 | |||
| 480 | static void xpad_send_led_command(struct usb_xpad *xpad, int command) | ||
| 481 | { | ||
| 482 | if (command >= 0 && command < 14) { | ||
| 483 | mutex_lock(&xpad->odata_mutex); | ||
| 484 | xpad->odata[0] = 0x01; | ||
| 485 | xpad->odata[1] = 0x03; | ||
| 486 | xpad->odata[2] = command; | ||
| 487 | usb_submit_urb(xpad->irq_out, GFP_KERNEL); | ||
| 488 | mutex_unlock(&xpad->odata_mutex); | ||
| 489 | } | ||
| 490 | } | ||
| 491 | |||
| 492 | static void xpad_led_set(struct led_classdev *led_cdev, | ||
| 493 | enum led_brightness value) | ||
| 494 | { | ||
| 495 | struct xpad_led *xpad_led = container_of(led_cdev, | ||
| 496 | struct xpad_led, led_cdev); | ||
| 497 | |||
| 498 | xpad_send_led_command(xpad_led->xpad, value); | ||
| 499 | } | ||
| 500 | |||
| 501 | static int xpad_led_probe(struct usb_xpad *xpad) | ||
| 502 | { | ||
| 503 | static atomic_t led_seq = ATOMIC_INIT(0); | ||
| 504 | long led_no; | ||
| 505 | struct xpad_led *led; | ||
| 506 | struct led_classdev *led_cdev; | ||
| 507 | int error; | ||
| 508 | |||
| 509 | if (xpad->xtype != XTYPE_XBOX360) | ||
| 510 | return 0; | ||
| 511 | |||
| 512 | xpad->led = led = kzalloc(sizeof(struct xpad_led), GFP_KERNEL); | ||
| 513 | if (!led) | ||
| 514 | return -ENOMEM; | ||
| 515 | |||
| 516 | led_no = (long)atomic_inc_return(&led_seq) - 1; | ||
| 517 | |||
| 518 | snprintf(led->name, sizeof(led->name), "xpad%ld", led_no); | ||
| 519 | led->xpad = xpad; | ||
| 520 | |||
| 521 | led_cdev = &led->led_cdev; | ||
| 522 | led_cdev->name = led->name; | ||
| 523 | led_cdev->brightness_set = xpad_led_set; | ||
| 524 | |||
| 525 | error = led_classdev_register(&xpad->udev->dev, led_cdev); | ||
| 526 | if (error) { | ||
| 527 | kfree(led); | ||
| 528 | xpad->led = NULL; | ||
| 529 | return error; | ||
| 530 | } | ||
| 531 | |||
| 532 | /* | ||
| 533 | * Light up the segment corresponding to controller number | ||
| 534 | */ | ||
| 535 | xpad_send_led_command(xpad, (led_no % 4) + 2); | ||
| 536 | |||
| 537 | return 0; | ||
| 538 | } | ||
| 539 | |||
| 540 | static void xpad_led_disconnect(struct usb_xpad *xpad) | ||
| 541 | { | ||
| 542 | struct xpad_led *xpad_led = xpad->led; | ||
| 543 | |||
| 544 | if (xpad_led) { | ||
| 545 | led_classdev_unregister(&xpad_led->led_cdev); | ||
| 546 | kfree(xpad_led->name); | ||
| 547 | } | ||
| 548 | } | ||
| 453 | #else | 549 | #else |
| 454 | static int xpad_init_ff(struct usb_interface *intf, struct usb_xpad *xpad) { return 0; } | 550 | static int xpad_led_probe(struct usb_xpad *xpad) { return 0; } |
| 455 | static void xpad_stop_ff(struct usb_xpad *xpad) { } | 551 | static void xpad_led_disconnect(struct usb_xpad *xpad) { } |
| 456 | static void xpad_deinit_ff(struct usb_xpad *xpad) { } | ||
| 457 | #endif | 552 | #endif |
| 458 | 553 | ||
| 554 | |||
| 459 | static int xpad_open(struct input_dev *dev) | 555 | static int xpad_open(struct input_dev *dev) |
| 460 | { | 556 | { |
| 461 | struct usb_xpad *xpad = input_get_drvdata(dev); | 557 | struct usb_xpad *xpad = input_get_drvdata(dev); |
| @@ -472,7 +568,7 @@ static void xpad_close(struct input_dev *dev) | |||
| 472 | struct usb_xpad *xpad = input_get_drvdata(dev); | 568 | struct usb_xpad *xpad = input_get_drvdata(dev); |
| 473 | 569 | ||
| 474 | usb_kill_urb(xpad->irq_in); | 570 | usb_kill_urb(xpad->irq_in); |
| 475 | xpad_stop_ff(xpad); | 571 | xpad_stop_output(xpad); |
| 476 | } | 572 | } |
| 477 | 573 | ||
| 478 | static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) | 574 | static void xpad_set_up_abs(struct input_dev *input_dev, signed short abs) |
| @@ -564,10 +660,18 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
| 564 | for (i = 0; xpad_abs_pad[i] >= 0; i++) | 660 | for (i = 0; xpad_abs_pad[i] >= 0; i++) |
| 565 | xpad_set_up_abs(input_dev, xpad_abs_pad[i]); | 661 | xpad_set_up_abs(input_dev, xpad_abs_pad[i]); |
| 566 | 662 | ||
| 567 | error = xpad_init_ff(intf, xpad); | 663 | error = xpad_init_output(intf, xpad); |
| 568 | if (error) | 664 | if (error) |
| 569 | goto fail2; | 665 | goto fail2; |
| 570 | 666 | ||
| 667 | error = xpad_init_ff(xpad); | ||
| 668 | if (error) | ||
| 669 | goto fail3; | ||
| 670 | |||
| 671 | error = xpad_led_probe(xpad); | ||
| 672 | if (error) | ||
| 673 | goto fail3; | ||
| 674 | |||
| 571 | ep_irq_in = &intf->cur_altsetting->endpoint[0].desc; | 675 | ep_irq_in = &intf->cur_altsetting->endpoint[0].desc; |
| 572 | usb_fill_int_urb(xpad->irq_in, udev, | 676 | usb_fill_int_urb(xpad->irq_in, udev, |
| 573 | usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress), | 677 | usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress), |
| @@ -578,12 +682,13 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
| 578 | 682 | ||
| 579 | error = input_register_device(xpad->dev); | 683 | error = input_register_device(xpad->dev); |
| 580 | if (error) | 684 | if (error) |
| 581 | goto fail3; | 685 | goto fail4; |
| 582 | 686 | ||
| 583 | usb_set_intfdata(intf, xpad); | 687 | usb_set_intfdata(intf, xpad); |
| 584 | return 0; | 688 | return 0; |
| 585 | 689 | ||
| 586 | fail3: usb_free_urb(xpad->irq_in); | 690 | fail4: usb_free_urb(xpad->irq_in); |
| 691 | fail3: xpad_deinit_output(xpad); | ||
| 587 | fail2: usb_buffer_free(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma); | 692 | fail2: usb_buffer_free(udev, XPAD_PKT_LEN, xpad->idata, xpad->idata_dma); |
| 588 | fail1: input_free_device(input_dev); | 693 | fail1: input_free_device(input_dev); |
| 589 | kfree(xpad); | 694 | kfree(xpad); |
| @@ -597,8 +702,9 @@ static void xpad_disconnect(struct usb_interface *intf) | |||
| 597 | 702 | ||
| 598 | usb_set_intfdata(intf, NULL); | 703 | usb_set_intfdata(intf, NULL); |
| 599 | if (xpad) { | 704 | if (xpad) { |
| 705 | xpad_led_disconnect(xpad); | ||
| 600 | input_unregister_device(xpad->dev); | 706 | input_unregister_device(xpad->dev); |
| 601 | xpad_deinit_ff(xpad); | 707 | xpad_deinit_output(xpad); |
| 602 | usb_free_urb(xpad->irq_in); | 708 | usb_free_urb(xpad->irq_in); |
| 603 | usb_buffer_free(xpad->udev, XPAD_PKT_LEN, | 709 | usb_buffer_free(xpad->udev, XPAD_PKT_LEN, |
| 604 | xpad->idata, xpad->idata_dma); | 710 | xpad->idata, xpad->idata_dma); |
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c index e3215267db11..2bea1b2c631c 100644 --- a/drivers/input/mouse/appletouch.c +++ b/drivers/input/mouse/appletouch.c | |||
| @@ -155,6 +155,8 @@ struct atp { | |||
| 155 | int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; | 155 | int xy_acc[ATP_XSENSORS + ATP_YSENSORS]; |
| 156 | int overflowwarn; /* overflow warning printed? */ | 156 | int overflowwarn; /* overflow warning printed? */ |
| 157 | int datalen; /* size of an USB urb transfer */ | 157 | int datalen; /* size of an USB urb transfer */ |
| 158 | int idlecount; /* number of empty packets */ | ||
| 159 | struct work_struct work; | ||
| 158 | }; | 160 | }; |
| 159 | 161 | ||
| 160 | #define dbg_dump(msg, tab) \ | 162 | #define dbg_dump(msg, tab) \ |
| @@ -208,6 +210,55 @@ static inline int atp_is_geyser_3(struct atp *dev) | |||
| 208 | (productId == GEYSER4_JIS_PRODUCT_ID); | 210 | (productId == GEYSER4_JIS_PRODUCT_ID); |
| 209 | } | 211 | } |
| 210 | 212 | ||
| 213 | /* | ||
| 214 | * By default Geyser 3 device sends standard USB HID mouse | ||
| 215 | * packets (Report ID 2). This code changes device mode, so it | ||
| 216 | * sends raw sensor reports (Report ID 5). | ||
| 217 | */ | ||
| 218 | static int atp_geyser3_init(struct usb_device *udev) | ||
| 219 | { | ||
| 220 | char data[8]; | ||
| 221 | int size; | ||
| 222 | |||
| 223 | size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | ||
| 224 | ATP_GEYSER3_MODE_READ_REQUEST_ID, | ||
| 225 | USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
| 226 | ATP_GEYSER3_MODE_REQUEST_VALUE, | ||
| 227 | ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); | ||
| 228 | |||
| 229 | if (size != 8) { | ||
| 230 | err("Could not do mode read request from device" | ||
| 231 | " (Geyser 3 mode)"); | ||
| 232 | return -EIO; | ||
| 233 | } | ||
| 234 | |||
| 235 | /* Apply the mode switch */ | ||
| 236 | data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE; | ||
| 237 | |||
| 238 | size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | ||
| 239 | ATP_GEYSER3_MODE_WRITE_REQUEST_ID, | ||
| 240 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
| 241 | ATP_GEYSER3_MODE_REQUEST_VALUE, | ||
| 242 | ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); | ||
| 243 | |||
| 244 | if (size != 8) { | ||
| 245 | err("Could not do mode write request to device" | ||
| 246 | " (Geyser 3 mode)"); | ||
| 247 | return -EIO; | ||
| 248 | } | ||
| 249 | return 0; | ||
| 250 | } | ||
| 251 | |||
| 252 | /* Reinitialise the device if it's a geyser 3 */ | ||
| 253 | static void atp_reinit(struct work_struct *work) | ||
| 254 | { | ||
| 255 | struct atp *dev = container_of(work, struct atp, work); | ||
| 256 | struct usb_device *udev = dev->udev; | ||
| 257 | |||
| 258 | dev->idlecount = 0; | ||
| 259 | atp_geyser3_init(udev); | ||
| 260 | } | ||
| 261 | |||
| 211 | static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, | 262 | static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, |
| 212 | int *z, int *fingers) | 263 | int *z, int *fingers) |
| 213 | { | 264 | { |
| @@ -439,8 +490,8 @@ static void atp_complete(struct urb* urb) | |||
| 439 | } | 490 | } |
| 440 | dev->x_old = x; | 491 | dev->x_old = x; |
| 441 | dev->y_old = y; | 492 | dev->y_old = y; |
| 442 | } | 493 | |
| 443 | else if (!x && !y) { | 494 | } else if (!x && !y) { |
| 444 | 495 | ||
| 445 | dev->x_old = dev->y_old = -1; | 496 | dev->x_old = dev->y_old = -1; |
| 446 | input_report_key(dev->input, BTN_TOUCH, 0); | 497 | input_report_key(dev->input, BTN_TOUCH, 0); |
| @@ -449,11 +500,21 @@ static void atp_complete(struct urb* urb) | |||
| 449 | 500 | ||
| 450 | /* reset the accumulator on release */ | 501 | /* reset the accumulator on release */ |
| 451 | memset(dev->xy_acc, 0, sizeof(dev->xy_acc)); | 502 | memset(dev->xy_acc, 0, sizeof(dev->xy_acc)); |
| 452 | } | ||
| 453 | 503 | ||
| 454 | input_report_key(dev->input, BTN_LEFT, | 504 | /* Geyser 3 will continue to send packets continually after |
| 455 | !!dev->data[dev->datalen - 1]); | 505 | the first touch unless reinitialised. Do so if it's been |
| 506 | idle for a while in order to avoid waking the kernel up | ||
| 507 | several hundred times a second */ | ||
| 508 | if (atp_is_geyser_3(dev)) { | ||
| 509 | dev->idlecount++; | ||
| 510 | if (dev->idlecount == 10) { | ||
| 511 | dev->valid = 0; | ||
| 512 | schedule_work(&dev->work); | ||
| 513 | } | ||
| 514 | } | ||
| 515 | } | ||
| 456 | 516 | ||
| 517 | input_report_key(dev->input, BTN_LEFT, dev->data[dev->datalen - 1] & 1); | ||
| 457 | input_sync(dev->input); | 518 | input_sync(dev->input); |
| 458 | 519 | ||
| 459 | exit: | 520 | exit: |
| @@ -480,6 +541,7 @@ static void atp_close(struct input_dev *input) | |||
| 480 | struct atp *dev = input_get_drvdata(input); | 541 | struct atp *dev = input_get_drvdata(input); |
| 481 | 542 | ||
| 482 | usb_kill_urb(dev->urb); | 543 | usb_kill_urb(dev->urb); |
| 544 | cancel_work_sync(&dev->work); | ||
| 483 | dev->open = 0; | 545 | dev->open = 0; |
| 484 | } | 546 | } |
| 485 | 547 | ||
| @@ -528,40 +590,10 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id | |||
| 528 | dev->datalen = 81; | 590 | dev->datalen = 81; |
| 529 | 591 | ||
| 530 | if (atp_is_geyser_3(dev)) { | 592 | if (atp_is_geyser_3(dev)) { |
| 531 | /* | 593 | /* switch to raw sensor mode */ |
| 532 | * By default Geyser 3 device sends standard USB HID mouse | 594 | if (atp_geyser3_init(udev)) |
| 533 | * packets (Report ID 2). This code changes device mode, so it | ||
| 534 | * sends raw sensor reports (Report ID 5). | ||
| 535 | */ | ||
| 536 | char data[8]; | ||
| 537 | int size; | ||
| 538 | |||
| 539 | size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | ||
| 540 | ATP_GEYSER3_MODE_READ_REQUEST_ID, | ||
| 541 | USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
| 542 | ATP_GEYSER3_MODE_REQUEST_VALUE, | ||
| 543 | ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); | ||
| 544 | |||
| 545 | if (size != 8) { | ||
| 546 | err("Could not do mode read request from device" | ||
| 547 | " (Geyser 3 mode)"); | ||
| 548 | goto err_free_devs; | 595 | goto err_free_devs; |
| 549 | } | ||
| 550 | |||
| 551 | /* Apply the mode switch */ | ||
| 552 | data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE; | ||
| 553 | |||
| 554 | size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | ||
| 555 | ATP_GEYSER3_MODE_WRITE_REQUEST_ID, | ||
| 556 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | ||
| 557 | ATP_GEYSER3_MODE_REQUEST_VALUE, | ||
| 558 | ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000); | ||
| 559 | 596 | ||
| 560 | if (size != 8) { | ||
| 561 | err("Could not do mode write request to device" | ||
| 562 | " (Geyser 3 mode)"); | ||
| 563 | goto err_free_devs; | ||
| 564 | } | ||
| 565 | printk("appletouch Geyser 3 inited.\n"); | 597 | printk("appletouch Geyser 3 inited.\n"); |
| 566 | } | 598 | } |
| 567 | 599 | ||
| @@ -636,6 +668,8 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id | |||
| 636 | /* save our data pointer in this interface device */ | 668 | /* save our data pointer in this interface device */ |
| 637 | usb_set_intfdata(iface, dev); | 669 | usb_set_intfdata(iface, dev); |
| 638 | 670 | ||
| 671 | INIT_WORK(&dev->work, atp_reinit); | ||
| 672 | |||
| 639 | return 0; | 673 | return 0; |
| 640 | 674 | ||
| 641 | err_free_buffer: | 675 | err_free_buffer: |
| @@ -669,14 +703,17 @@ static void atp_disconnect(struct usb_interface *iface) | |||
| 669 | static int atp_suspend(struct usb_interface *iface, pm_message_t message) | 703 | static int atp_suspend(struct usb_interface *iface, pm_message_t message) |
| 670 | { | 704 | { |
| 671 | struct atp *dev = usb_get_intfdata(iface); | 705 | struct atp *dev = usb_get_intfdata(iface); |
| 706 | |||
| 672 | usb_kill_urb(dev->urb); | 707 | usb_kill_urb(dev->urb); |
| 673 | dev->valid = 0; | 708 | dev->valid = 0; |
| 709 | |||
| 674 | return 0; | 710 | return 0; |
| 675 | } | 711 | } |
| 676 | 712 | ||
| 677 | static int atp_resume(struct usb_interface *iface) | 713 | static int atp_resume(struct usb_interface *iface) |
| 678 | { | 714 | { |
| 679 | struct atp *dev = usb_get_intfdata(iface); | 715 | struct atp *dev = usb_get_intfdata(iface); |
| 716 | |||
| 680 | if (dev->open && usb_submit_urb(dev->urb, GFP_ATOMIC)) | 717 | if (dev->open && usb_submit_urb(dev->urb, GFP_ATOMIC)) |
| 681 | return -EIO; | 718 | return -EIO; |
| 682 | 719 | ||
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c index 1740cadd9594..91109b49fde1 100644 --- a/drivers/input/mouse/lifebook.c +++ b/drivers/input/mouse/lifebook.c | |||
| @@ -109,7 +109,7 @@ static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse) | |||
| 109 | { | 109 | { |
| 110 | struct lifebook_data *priv = psmouse->private; | 110 | struct lifebook_data *priv = psmouse->private; |
| 111 | struct input_dev *dev1 = psmouse->dev; | 111 | struct input_dev *dev1 = psmouse->dev; |
| 112 | struct input_dev *dev2 = priv->dev2; | 112 | struct input_dev *dev2 = priv ? priv->dev2 : NULL; |
| 113 | unsigned char *packet = psmouse->packet; | 113 | unsigned char *packet = psmouse->packet; |
| 114 | int relative_packet = packet[0] & 0x08; | 114 | int relative_packet = packet[0] & 0x08; |
| 115 | 115 | ||
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 4fca1e7f2678..702a526cf45b 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
| @@ -366,6 +366,7 @@ static void i8042_pnp_exit(void) | |||
| 366 | static int __init i8042_pnp_init(void) | 366 | static int __init i8042_pnp_init(void) |
| 367 | { | 367 | { |
| 368 | char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 }; | 368 | char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 }; |
| 369 | int pnp_data_busted = 0; | ||
| 369 | int err; | 370 | int err; |
| 370 | 371 | ||
| 371 | if (i8042_nopnp) { | 372 | if (i8042_nopnp) { |
| @@ -413,27 +414,48 @@ static int __init i8042_pnp_init(void) | |||
| 413 | #endif | 414 | #endif |
| 414 | 415 | ||
| 415 | if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) && | 416 | if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) && |
| 416 | i8042_pnp_data_reg != i8042_data_reg) || !i8042_pnp_data_reg) { | 417 | i8042_pnp_data_reg != i8042_data_reg) || |
| 417 | printk(KERN_WARNING "PNP: PS/2 controller has invalid data port %#x; using default %#x\n", | 418 | !i8042_pnp_data_reg) { |
| 419 | printk(KERN_WARNING | ||
| 420 | "PNP: PS/2 controller has invalid data port %#x; " | ||
| 421 | "using default %#x\n", | ||
| 418 | i8042_pnp_data_reg, i8042_data_reg); | 422 | i8042_pnp_data_reg, i8042_data_reg); |
| 419 | i8042_pnp_data_reg = i8042_data_reg; | 423 | i8042_pnp_data_reg = i8042_data_reg; |
| 424 | pnp_data_busted = 1; | ||
| 420 | } | 425 | } |
| 421 | 426 | ||
| 422 | if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) && | 427 | if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) && |
| 423 | i8042_pnp_command_reg != i8042_command_reg) || !i8042_pnp_command_reg) { | 428 | i8042_pnp_command_reg != i8042_command_reg) || |
| 424 | printk(KERN_WARNING "PNP: PS/2 controller has invalid command port %#x; using default %#x\n", | 429 | !i8042_pnp_command_reg) { |
| 430 | printk(KERN_WARNING | ||
| 431 | "PNP: PS/2 controller has invalid command port %#x; " | ||
| 432 | "using default %#x\n", | ||
| 425 | i8042_pnp_command_reg, i8042_command_reg); | 433 | i8042_pnp_command_reg, i8042_command_reg); |
| 426 | i8042_pnp_command_reg = i8042_command_reg; | 434 | i8042_pnp_command_reg = i8042_command_reg; |
| 435 | pnp_data_busted = 1; | ||
| 427 | } | 436 | } |
| 428 | 437 | ||
| 429 | if (!i8042_nokbd && !i8042_pnp_kbd_irq) { | 438 | if (!i8042_nokbd && !i8042_pnp_kbd_irq) { |
| 430 | printk(KERN_WARNING "PNP: PS/2 controller doesn't have KBD irq; using default %d\n", i8042_kbd_irq); | 439 | printk(KERN_WARNING |
| 440 | "PNP: PS/2 controller doesn't have KBD irq; " | ||
| 441 | "using default %d\n", i8042_kbd_irq); | ||
| 431 | i8042_pnp_kbd_irq = i8042_kbd_irq; | 442 | i8042_pnp_kbd_irq = i8042_kbd_irq; |
| 443 | pnp_data_busted = 1; | ||
| 432 | } | 444 | } |
| 433 | 445 | ||
| 434 | if (!i8042_noaux && !i8042_pnp_aux_irq) { | 446 | if (!i8042_noaux && !i8042_pnp_aux_irq) { |
| 435 | printk(KERN_WARNING "PNP: PS/2 controller doesn't have AUX irq; using default %d\n", i8042_aux_irq); | 447 | if (!pnp_data_busted && i8042_pnp_kbd_irq) { |
| 436 | i8042_pnp_aux_irq = i8042_aux_irq; | 448 | printk(KERN_WARNING |
| 449 | "PNP: PS/2 appears to have AUX port disabled, " | ||
| 450 | "if this is incorrect please boot with " | ||
| 451 | "i8042.nopnp\n"); | ||
| 452 | i8042_noaux = 1; | ||
| 453 | } else { | ||
| 454 | printk(KERN_WARNING | ||
| 455 | "PNP: PS/2 controller doesn't have AUX irq; " | ||
| 456 | "using default %d\n", i8042_aux_irq); | ||
| 457 | i8042_pnp_aux_irq = i8042_aux_irq; | ||
| 458 | } | ||
| 437 | } | 459 | } |
| 438 | 460 | ||
| 439 | i8042_data_reg = i8042_pnp_data_reg; | 461 | i8042_data_reg = i8042_pnp_data_reg; |
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 69371779806a..f929fcdbae2e 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
| @@ -54,6 +54,19 @@ config TOUCHSCREEN_CORGI | |||
| 54 | To compile this driver as a module, choose M here: the | 54 | To compile this driver as a module, choose M here: the |
| 55 | module will be called corgi_ts. | 55 | module will be called corgi_ts. |
| 56 | 56 | ||
| 57 | config TOUCHSCREEN_FUJITSU | ||
| 58 | tristate "Fujitsu serial touchscreen" | ||
| 59 | select SERIO | ||
| 60 | help | ||
| 61 | Say Y here if you have the Fujitsu touchscreen (such as one | ||
| 62 | installed in Lifebook P series laptop) connected to your | ||
| 63 | system. | ||
| 64 | |||
| 65 | If unsure, say N. | ||
| 66 | |||
| 67 | To compile this driver as a module, choose M here: the | ||
| 68 | module will be called fujitsu-ts. | ||
| 69 | |||
| 57 | config TOUCHSCREEN_GUNZE | 70 | config TOUCHSCREEN_GUNZE |
| 58 | tristate "Gunze AHL-51S touchscreen" | 71 | tristate "Gunze AHL-51S touchscreen" |
| 59 | select SERIO | 72 | select SERIO |
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 2f86d6ad06d3..5de8933c4993 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile | |||
| @@ -9,6 +9,7 @@ obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o | |||
| 9 | obj-$(CONFIG_TOUCHSCREEN_CORGI) += corgi_ts.o | 9 | obj-$(CONFIG_TOUCHSCREEN_CORGI) += corgi_ts.o |
| 10 | obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o | 10 | obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o |
| 11 | obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o | 11 | obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o |
| 12 | obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o | ||
| 12 | obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o | 13 | obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o |
| 13 | obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o | 14 | obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o |
| 14 | obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o | 15 | obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 1c9069cd3bae..96581d08774f 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
| @@ -95,7 +95,7 @@ struct ads7846 { | |||
| 95 | u16 dummy; /* for the pwrdown read */ | 95 | u16 dummy; /* for the pwrdown read */ |
| 96 | struct ts_event tc; | 96 | struct ts_event tc; |
| 97 | 97 | ||
| 98 | struct spi_transfer xfer[10]; | 98 | struct spi_transfer xfer[18]; |
| 99 | struct spi_message msg[5]; | 99 | struct spi_message msg[5]; |
| 100 | struct spi_message *last_msg; | 100 | struct spi_message *last_msg; |
| 101 | int msg_idx; | 101 | int msg_idx; |
| @@ -107,6 +107,8 @@ struct ads7846 { | |||
| 107 | u16 debounce_tol; | 107 | u16 debounce_tol; |
| 108 | u16 debounce_rep; | 108 | u16 debounce_rep; |
| 109 | 109 | ||
| 110 | u16 penirq_recheck_delay_usecs; | ||
| 111 | |||
| 110 | spinlock_t lock; | 112 | spinlock_t lock; |
| 111 | struct hrtimer timer; | 113 | struct hrtimer timer; |
| 112 | unsigned pendown:1; /* P: lock */ | 114 | unsigned pendown:1; /* P: lock */ |
| @@ -553,6 +555,15 @@ static void ads7846_rx(void *ads) | |||
| 553 | return; | 555 | return; |
| 554 | } | 556 | } |
| 555 | 557 | ||
| 558 | /* Maybe check the pendown state before reporting. This discards | ||
| 559 | * false readings when the pen is lifted. | ||
| 560 | */ | ||
| 561 | if (ts->penirq_recheck_delay_usecs) { | ||
| 562 | udelay(ts->penirq_recheck_delay_usecs); | ||
| 563 | if (!ts->get_pendown_state()) | ||
| 564 | Rt = 0; | ||
| 565 | } | ||
| 566 | |||
| 556 | /* NOTE: We can't rely on the pressure to determine the pen down | 567 | /* NOTE: We can't rely on the pressure to determine the pen down |
| 557 | * state, even this controller has a pressure sensor. The pressure | 568 | * state, even this controller has a pressure sensor. The pressure |
| 558 | * value can fluctuate for quite a while after lifting the pen and | 569 | * value can fluctuate for quite a while after lifting the pen and |
| @@ -896,6 +907,10 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
| 896 | ts->filter = ads7846_no_filter; | 907 | ts->filter = ads7846_no_filter; |
| 897 | ts->get_pendown_state = pdata->get_pendown_state; | 908 | ts->get_pendown_state = pdata->get_pendown_state; |
| 898 | 909 | ||
| 910 | if (pdata->penirq_recheck_delay_usecs) | ||
| 911 | ts->penirq_recheck_delay_usecs = | ||
| 912 | pdata->penirq_recheck_delay_usecs; | ||
| 913 | |||
| 899 | snprintf(ts->phys, sizeof(ts->phys), "%s/input0", spi->dev.bus_id); | 914 | snprintf(ts->phys, sizeof(ts->phys), "%s/input0", spi->dev.bus_id); |
| 900 | 915 | ||
| 901 | input_dev->name = "ADS784x Touchscreen"; | 916 | input_dev->name = "ADS784x Touchscreen"; |
| @@ -936,6 +951,24 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
| 936 | x->len = 2; | 951 | x->len = 2; |
| 937 | spi_message_add_tail(x, m); | 952 | spi_message_add_tail(x, m); |
| 938 | 953 | ||
| 954 | /* the first sample after switching drivers can be low quality; | ||
| 955 | * optionally discard it, using a second one after the signals | ||
| 956 | * have had enough time to stabilize. | ||
| 957 | */ | ||
| 958 | if (pdata->settle_delay_usecs) { | ||
| 959 | x->delay_usecs = pdata->settle_delay_usecs; | ||
| 960 | |||
| 961 | x++; | ||
| 962 | x->tx_buf = &ts->read_y; | ||
| 963 | x->len = 1; | ||
| 964 | spi_message_add_tail(x, m); | ||
| 965 | |||
| 966 | x++; | ||
| 967 | x->rx_buf = &ts->tc.y; | ||
| 968 | x->len = 2; | ||
| 969 | spi_message_add_tail(x, m); | ||
| 970 | } | ||
| 971 | |||
| 939 | m->complete = ads7846_rx_val; | 972 | m->complete = ads7846_rx_val; |
| 940 | m->context = ts; | 973 | m->context = ts; |
| 941 | 974 | ||
| @@ -954,6 +987,21 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
| 954 | x->len = 2; | 987 | x->len = 2; |
| 955 | spi_message_add_tail(x, m); | 988 | spi_message_add_tail(x, m); |
| 956 | 989 | ||
| 990 | /* ... maybe discard first sample ... */ | ||
| 991 | if (pdata->settle_delay_usecs) { | ||
| 992 | x->delay_usecs = pdata->settle_delay_usecs; | ||
| 993 | |||
| 994 | x++; | ||
| 995 | x->tx_buf = &ts->read_x; | ||
| 996 | x->len = 1; | ||
| 997 | spi_message_add_tail(x, m); | ||
| 998 | |||
| 999 | x++; | ||
| 1000 | x->rx_buf = &ts->tc.x; | ||
| 1001 | x->len = 2; | ||
| 1002 | spi_message_add_tail(x, m); | ||
| 1003 | } | ||
| 1004 | |||
| 957 | m->complete = ads7846_rx_val; | 1005 | m->complete = ads7846_rx_val; |
| 958 | m->context = ts; | 1006 | m->context = ts; |
| 959 | 1007 | ||
| @@ -973,6 +1021,21 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
| 973 | x->len = 2; | 1021 | x->len = 2; |
| 974 | spi_message_add_tail(x, m); | 1022 | spi_message_add_tail(x, m); |
| 975 | 1023 | ||
| 1024 | /* ... maybe discard first sample ... */ | ||
| 1025 | if (pdata->settle_delay_usecs) { | ||
| 1026 | x->delay_usecs = pdata->settle_delay_usecs; | ||
| 1027 | |||
| 1028 | x++; | ||
| 1029 | x->tx_buf = &ts->read_z1; | ||
| 1030 | x->len = 1; | ||
| 1031 | spi_message_add_tail(x, m); | ||
| 1032 | |||
| 1033 | x++; | ||
| 1034 | x->rx_buf = &ts->tc.z1; | ||
| 1035 | x->len = 2; | ||
| 1036 | spi_message_add_tail(x, m); | ||
| 1037 | } | ||
| 1038 | |||
| 976 | m->complete = ads7846_rx_val; | 1039 | m->complete = ads7846_rx_val; |
| 977 | m->context = ts; | 1040 | m->context = ts; |
| 978 | 1041 | ||
| @@ -990,6 +1053,21 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
| 990 | x->len = 2; | 1053 | x->len = 2; |
| 991 | spi_message_add_tail(x, m); | 1054 | spi_message_add_tail(x, m); |
| 992 | 1055 | ||
| 1056 | /* ... maybe discard first sample ... */ | ||
| 1057 | if (pdata->settle_delay_usecs) { | ||
| 1058 | x->delay_usecs = pdata->settle_delay_usecs; | ||
| 1059 | |||
| 1060 | x++; | ||
| 1061 | x->tx_buf = &ts->read_z2; | ||
| 1062 | x->len = 1; | ||
| 1063 | spi_message_add_tail(x, m); | ||
| 1064 | |||
| 1065 | x++; | ||
| 1066 | x->rx_buf = &ts->tc.z2; | ||
| 1067 | x->len = 2; | ||
| 1068 | spi_message_add_tail(x, m); | ||
| 1069 | } | ||
| 1070 | |||
| 993 | m->complete = ads7846_rx_val; | 1071 | m->complete = ads7846_rx_val; |
| 994 | m->context = ts; | 1072 | m->context = ts; |
| 995 | } | 1073 | } |
diff --git a/drivers/input/touchscreen/fujitsu_ts.c b/drivers/input/touchscreen/fujitsu_ts.c new file mode 100644 index 000000000000..daf7a4afc935 --- /dev/null +++ b/drivers/input/touchscreen/fujitsu_ts.c | |||
| @@ -0,0 +1,189 @@ | |||
| 1 | /* | ||
| 2 | * Fujitsu serial touchscreen driver | ||
| 3 | * | ||
| 4 | * Copyright (c) Dmitry Torokhov <dtor@mail.ru> | ||
| 5 | */ | ||
| 6 | |||
| 7 | /* | ||
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms of the GNU General Public License version 2 as published | ||
| 10 | * by the Free Software Foundation. | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include <linux/errno.h> | ||
| 14 | #include <linux/kernel.h> | ||
| 15 | #include <linux/module.h> | ||
| 16 | #include <linux/slab.h> | ||
| 17 | #include <linux/input.h> | ||
| 18 | #include <linux/serio.h> | ||
| 19 | #include <linux/init.h> | ||
| 20 | |||
| 21 | #define DRIVER_DESC "Fujitsu serial touchscreen driver" | ||
| 22 | |||
| 23 | MODULE_AUTHOR("Dmitry Torokhov <dtor@mail.ru>"); | ||
| 24 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
| 25 | MODULE_LICENSE("GPL"); | ||
| 26 | |||
| 27 | #define FUJITSU_LENGTH 5 | ||
| 28 | |||
| 29 | /* | ||
| 30 | * Per-touchscreen data. | ||
| 31 | */ | ||
| 32 | struct fujitsu { | ||
| 33 | struct input_dev *dev; | ||
| 34 | struct serio *serio; | ||
| 35 | int idx; | ||
| 36 | unsigned char data[FUJITSU_LENGTH]; | ||
| 37 | char phys[32]; | ||
| 38 | }; | ||
| 39 | |||
| 40 | /* | ||
| 41 | * Decode serial data (5 bytes per packet) | ||
| 42 | * First byte | ||
| 43 | * 1 C 0 0 R S S S | ||
| 44 | * Where C is 1 while in calibration mode (which we don't use) | ||
| 45 | * R is 1 when no coordinate corection was done. | ||
| 46 | * S are button state | ||
| 47 | */ | ||
| 48 | static irqreturn_t fujitsu_interrupt(struct serio *serio, | ||
| 49 | unsigned char data, unsigned int flags) | ||
| 50 | { | ||
| 51 | struct fujitsu *fujitsu = serio_get_drvdata(serio); | ||
| 52 | struct input_dev *dev = fujitsu->dev; | ||
| 53 | |||
| 54 | if (fujitsu->idx == 0) { | ||
| 55 | /* resync skip until start of frame */ | ||
| 56 | if ((data & 0xf0) != 0x80) | ||
| 57 | return IRQ_HANDLED; | ||
| 58 | } else { | ||
| 59 | /* resync skip garbage */ | ||
| 60 | if (data & 0x80) { | ||
| 61 | fujitsu->idx = 0; | ||
| 62 | return IRQ_HANDLED; | ||
| 63 | } | ||
| 64 | } | ||
| 65 | |||
| 66 | fujitsu->data[fujitsu->idx++] = data; | ||
| 67 | if (fujitsu->idx == FUJITSU_LENGTH) { | ||
| 68 | input_report_abs(dev, ABS_X, | ||
| 69 | (fujitsu->data[2] << 7) | fujitsu->data[1]); | ||
| 70 | input_report_abs(dev, ABS_Y, | ||
| 71 | (fujitsu->data[4] << 7) | fujitsu->data[3]); | ||
| 72 | input_report_key(dev, BTN_TOUCH, | ||
| 73 | (fujitsu->data[0] & 0x03) != 2); | ||
| 74 | input_sync(dev); | ||
| 75 | fujitsu->idx = 0; | ||
| 76 | } | ||
| 77 | |||
| 78 | return IRQ_HANDLED; | ||
| 79 | } | ||
| 80 | |||
| 81 | /* | ||
| 82 | * fujitsu_disconnect() is the opposite of fujitsu_connect() | ||
| 83 | */ | ||
| 84 | static void fujitsu_disconnect(struct serio *serio) | ||
| 85 | { | ||
| 86 | struct fujitsu *fujitsu = serio_get_drvdata(serio); | ||
| 87 | |||
| 88 | input_get_device(fujitsu->dev); | ||
| 89 | input_unregister_device(fujitsu->dev); | ||
| 90 | serio_close(serio); | ||
| 91 | serio_set_drvdata(serio, NULL); | ||
| 92 | input_put_device(fujitsu->dev); | ||
| 93 | kfree(fujitsu); | ||
| 94 | } | ||
| 95 | |||
| 96 | /* | ||
| 97 | * fujitsu_connect() is the routine that is called when someone adds a | ||
| 98 | * new serio device that supports the Fujitsu protocol and registers it | ||
| 99 | * as input device. | ||
| 100 | */ | ||
| 101 | static int fujitsu_connect(struct serio *serio, struct serio_driver *drv) | ||
| 102 | { | ||
| 103 | struct fujitsu *fujitsu; | ||
| 104 | struct input_dev *input_dev; | ||
| 105 | int err; | ||
| 106 | |||
| 107 | fujitsu = kzalloc(sizeof(struct fujitsu), GFP_KERNEL); | ||
| 108 | input_dev = input_allocate_device(); | ||
| 109 | if (!fujitsu || !input_dev) { | ||
| 110 | err = -ENOMEM; | ||
| 111 | goto fail1; | ||
| 112 | } | ||
| 113 | |||
| 114 | fujitsu->serio = serio; | ||
| 115 | fujitsu->dev = input_dev; | ||
| 116 | snprintf(fujitsu->phys, sizeof(fujitsu->phys), | ||
| 117 | "%s/input0", serio->phys); | ||
| 118 | |||
| 119 | input_dev->name = "Fujitsu Serial Touchscreen"; | ||
| 120 | input_dev->phys = fujitsu->phys; | ||
| 121 | input_dev->id.bustype = BUS_RS232; | ||
| 122 | input_dev->id.vendor = SERIO_FUJITSU; | ||
| 123 | input_dev->id.product = 0; | ||
| 124 | input_dev->id.version = 0x0100; | ||
| 125 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); | ||
| 126 | input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); | ||
| 127 | |||
| 128 | input_set_abs_params(input_dev, ABS_X, 0, 4096, 0, 0); | ||
| 129 | input_set_abs_params(input_dev, ABS_Y, 0, 4096, 0, 0); | ||
| 130 | serio_set_drvdata(serio, fujitsu); | ||
| 131 | |||
| 132 | err = serio_open(serio, drv); | ||
| 133 | if (err) | ||
| 134 | goto fail2; | ||
| 135 | |||
| 136 | err = input_register_device(fujitsu->dev); | ||
| 137 | if (err) | ||
| 138 | goto fail3; | ||
| 139 | |||
| 140 | return 0; | ||
| 141 | |||
| 142 | fail3: | ||
| 143 | serio_close(serio); | ||
| 144 | fail2: | ||
| 145 | serio_set_drvdata(serio, NULL); | ||
| 146 | fail1: | ||
| 147 | input_free_device(input_dev); | ||
| 148 | kfree(fujitsu); | ||
| 149 | return err; | ||
| 150 | } | ||
| 151 | |||
| 152 | /* | ||
| 153 | * The serio driver structure. | ||
| 154 | */ | ||
| 155 | static struct serio_device_id fujitsu_serio_ids[] = { | ||
| 156 | { | ||
| 157 | .type = SERIO_RS232, | ||
| 158 | .proto = SERIO_FUJITSU, | ||
| 159 | .id = SERIO_ANY, | ||
| 160 | .extra = SERIO_ANY, | ||
| 161 | }, | ||
| 162 | { 0 } | ||
| 163 | }; | ||
| 164 | |||
| 165 | MODULE_DEVICE_TABLE(serio, fujitsu_serio_ids); | ||
| 166 | |||
| 167 | static struct serio_driver fujitsu_drv = { | ||
| 168 | .driver = { | ||
| 169 | .name = "fujitsu_ts", | ||
| 170 | }, | ||
| 171 | .description = DRIVER_DESC, | ||
| 172 | .id_table = fujitsu_serio_ids, | ||
| 173 | .interrupt = fujitsu_interrupt, | ||
| 174 | .connect = fujitsu_connect, | ||
| 175 | .disconnect = fujitsu_disconnect, | ||
| 176 | }; | ||
| 177 | |||
| 178 | static int __init fujitsu_init(void) | ||
| 179 | { | ||
| 180 | return serio_register_driver(&fujitsu_drv); | ||
| 181 | } | ||
| 182 | |||
| 183 | static void __exit fujitsu_exit(void) | ||
| 184 | { | ||
| 185 | serio_unregister_driver(&fujitsu_drv); | ||
| 186 | } | ||
| 187 | |||
| 188 | module_init(fujitsu_init); | ||
| 189 | module_exit(fujitsu_exit); | ||
diff --git a/include/linux/input.h b/include/linux/input.h index 18c98b543030..e02c6a66b2ba 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
| @@ -344,7 +344,8 @@ struct input_absinfo { | |||
| 344 | #define KEY_BRIGHTNESSUP 225 | 344 | #define KEY_BRIGHTNESSUP 225 |
| 345 | #define KEY_MEDIA 226 | 345 | #define KEY_MEDIA 226 |
| 346 | 346 | ||
| 347 | #define KEY_SWITCHVIDEOMODE 227 | 347 | #define KEY_SWITCHVIDEOMODE 227 /* Cycle between available video |
| 348 | outputs (Monitor/LCD/TV-out/etc) */ | ||
| 348 | #define KEY_KBDILLUMTOGGLE 228 | 349 | #define KEY_KBDILLUMTOGGLE 228 |
| 349 | #define KEY_KBDILLUMDOWN 229 | 350 | #define KEY_KBDILLUMDOWN 229 |
| 350 | #define KEY_KBDILLUMUP 230 | 351 | #define KEY_KBDILLUMUP 230 |
diff --git a/include/linux/serio.h b/include/linux/serio.h index d9377ce9ffd1..9f3825014674 100644 --- a/include/linux/serio.h +++ b/include/linux/serio.h | |||
| @@ -210,5 +210,6 @@ static inline void serio_unpin_driver(struct serio *serio) | |||
| 210 | #define SERIO_TOUCHRIGHT 0x32 | 210 | #define SERIO_TOUCHRIGHT 0x32 |
| 211 | #define SERIO_TOUCHWIN 0x33 | 211 | #define SERIO_TOUCHWIN 0x33 |
| 212 | #define SERIO_TAOSEVM 0x34 | 212 | #define SERIO_TAOSEVM 0x34 |
| 213 | #define SERIO_FUJITSU 0x35 | ||
| 213 | 214 | ||
| 214 | #endif | 215 | #endif |
diff --git a/include/linux/spi/ads7846.h b/include/linux/spi/ads7846.h index 3387e44dfd13..334d31411629 100644 --- a/include/linux/spi/ads7846.h +++ b/include/linux/spi/ads7846.h | |||
| @@ -16,6 +16,20 @@ struct ads7846_platform_data { | |||
| 16 | u16 vref_delay_usecs; /* 0 for external vref; etc */ | 16 | u16 vref_delay_usecs; /* 0 for external vref; etc */ |
| 17 | int keep_vref_on:1; /* set to keep vref on for differential | 17 | int keep_vref_on:1; /* set to keep vref on for differential |
| 18 | * measurements as well */ | 18 | * measurements as well */ |
| 19 | |||
| 20 | /* Settling time of the analog signals; a function of Vcc and the | ||
| 21 | * capacitance on the X/Y drivers. If set to non-zero, two samples | ||
| 22 | * are taken with settle_delay us apart, and the second one is used. | ||
| 23 | * ~150 uSec with 0.01uF caps. | ||
| 24 | */ | ||
| 25 | u16 settle_delay_usecs; | ||
| 26 | |||
| 27 | /* If set to non-zero, after samples are taken this delay is applied | ||
| 28 | * and penirq is rechecked, to help avoid false events. This value | ||
| 29 | * is affected by the material used to build the touch layer. | ||
| 30 | */ | ||
| 31 | u16 penirq_recheck_delay_usecs; | ||
| 32 | |||
| 19 | u16 x_plate_ohms; | 33 | u16 x_plate_ohms; |
| 20 | u16 y_plate_ohms; | 34 | u16 y_plate_ohms; |
| 21 | 35 | ||
