Commit 993808253ca256b8ca7f8ff90d9935d7c99cd32d
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
Merge branch 'next' into for-linus
Conflicts: drivers/input/tablet/wacom_sys.c
Showing 12 changed files Side-by-side Diff
- arch/arm/plat-spear/include/plat/keyboard.h
- drivers/input/joystick/amijoy.c
- drivers/input/keyboard/gpio_keys.c
- drivers/input/keyboard/tegra-kbc.c
- drivers/input/mouse/sentelic.c
- drivers/input/mouse/sentelic.h
- drivers/input/tablet/Kconfig
- drivers/input/tablet/wacom.h
- drivers/input/tablet/wacom_sys.c
- drivers/input/tablet/wacom_wac.c
- drivers/input/tablet/wacom_wac.h
- include/linux/gpio_keys.h
arch/arm/plat-spear/include/plat/keyboard.h
... | ... | @@ -159,12 +159,5 @@ |
159 | 159 | unsigned int mode; |
160 | 160 | }; |
161 | 161 | |
162 | -/* This function is used to set platform data field of pdev->dev */ | |
163 | -static inline void | |
164 | -kbd_set_plat_data(struct platform_device *pdev, struct kbd_platform_data *data) | |
165 | -{ | |
166 | - pdev->dev.platform_data = data; | |
167 | -} | |
168 | - | |
169 | 162 | #endif /* __PLAT_KEYBOARD_H */ |
drivers/input/joystick/amijoy.c
drivers/input/keyboard/gpio_keys.c
... | ... | @@ -28,14 +28,18 @@ |
28 | 28 | #include <linux/gpio.h> |
29 | 29 | #include <linux/of_platform.h> |
30 | 30 | #include <linux/of_gpio.h> |
31 | +#include <linux/spinlock.h> | |
31 | 32 | |
32 | 33 | struct gpio_button_data { |
33 | - struct gpio_keys_button *button; | |
34 | + const struct gpio_keys_button *button; | |
34 | 35 | struct input_dev *input; |
35 | 36 | struct timer_list timer; |
36 | 37 | struct work_struct work; |
37 | - int timer_debounce; /* in msecs */ | |
38 | + unsigned int timer_debounce; /* in msecs */ | |
39 | + unsigned int irq; | |
40 | + spinlock_t lock; | |
38 | 41 | bool disabled; |
42 | + bool key_pressed; | |
39 | 43 | }; |
40 | 44 | |
41 | 45 | struct gpio_keys_drvdata { |
... | ... | @@ -114,7 +118,7 @@ |
114 | 118 | /* |
115 | 119 | * Disable IRQ and possible debouncing timer. |
116 | 120 | */ |
117 | - disable_irq(gpio_to_irq(bdata->button->gpio)); | |
121 | + disable_irq(bdata->irq); | |
118 | 122 | if (bdata->timer_debounce) |
119 | 123 | del_timer_sync(&bdata->timer); |
120 | 124 | |
... | ... | @@ -135,7 +139,7 @@ |
135 | 139 | static void gpio_keys_enable_button(struct gpio_button_data *bdata) |
136 | 140 | { |
137 | 141 | if (bdata->disabled) { |
138 | - enable_irq(gpio_to_irq(bdata->button->gpio)); | |
142 | + enable_irq(bdata->irq); | |
139 | 143 | bdata->disabled = false; |
140 | 144 | } |
141 | 145 | } |
... | ... | @@ -195,7 +199,7 @@ |
195 | 199 | * @type: button type (%EV_KEY, %EV_SW) |
196 | 200 | * |
197 | 201 | * This function parses stringified bitmap from @buf and disables/enables |
198 | - * GPIO buttons accordinly. Returns 0 on success and negative error | |
202 | + * GPIO buttons accordingly. Returns 0 on success and negative error | |
199 | 203 | * on failure. |
200 | 204 | */ |
201 | 205 | static ssize_t gpio_keys_attr_store_helper(struct gpio_keys_drvdata *ddata, |
202 | 206 | |
... | ... | @@ -320,9 +324,9 @@ |
320 | 324 | .attrs = gpio_keys_attrs, |
321 | 325 | }; |
322 | 326 | |
323 | -static void gpio_keys_report_event(struct gpio_button_data *bdata) | |
327 | +static void gpio_keys_gpio_report_event(struct gpio_button_data *bdata) | |
324 | 328 | { |
325 | - struct gpio_keys_button *button = bdata->button; | |
329 | + const struct gpio_keys_button *button = bdata->button; | |
326 | 330 | struct input_dev *input = bdata->input; |
327 | 331 | unsigned int type = button->type ?: EV_KEY; |
328 | 332 | int state = (gpio_get_value_cansleep(button->gpio) ? 1 : 0) ^ button->active_low; |
329 | 333 | |
330 | 334 | |
331 | 335 | |
332 | 336 | |
333 | 337 | |
334 | 338 | |
335 | 339 | |
... | ... | @@ -336,27 +340,26 @@ |
336 | 340 | input_sync(input); |
337 | 341 | } |
338 | 342 | |
339 | -static void gpio_keys_work_func(struct work_struct *work) | |
343 | +static void gpio_keys_gpio_work_func(struct work_struct *work) | |
340 | 344 | { |
341 | 345 | struct gpio_button_data *bdata = |
342 | 346 | container_of(work, struct gpio_button_data, work); |
343 | 347 | |
344 | - gpio_keys_report_event(bdata); | |
348 | + gpio_keys_gpio_report_event(bdata); | |
345 | 349 | } |
346 | 350 | |
347 | -static void gpio_keys_timer(unsigned long _data) | |
351 | +static void gpio_keys_gpio_timer(unsigned long _data) | |
348 | 352 | { |
349 | - struct gpio_button_data *data = (struct gpio_button_data *)_data; | |
353 | + struct gpio_button_data *bdata = (struct gpio_button_data *)_data; | |
350 | 354 | |
351 | - schedule_work(&data->work); | |
355 | + schedule_work(&bdata->work); | |
352 | 356 | } |
353 | 357 | |
354 | -static irqreturn_t gpio_keys_isr(int irq, void *dev_id) | |
358 | +static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id) | |
355 | 359 | { |
356 | 360 | struct gpio_button_data *bdata = dev_id; |
357 | - struct gpio_keys_button *button = bdata->button; | |
358 | 361 | |
359 | - BUG_ON(irq != gpio_to_irq(button->gpio)); | |
362 | + BUG_ON(irq != bdata->irq); | |
360 | 363 | |
361 | 364 | if (bdata->timer_debounce) |
362 | 365 | mod_timer(&bdata->timer, |
363 | 366 | |
364 | 367 | |
365 | 368 | |
366 | 369 | |
367 | 370 | |
368 | 371 | |
369 | 372 | |
370 | 373 | |
371 | 374 | |
... | ... | @@ -367,50 +370,133 @@ |
367 | 370 | return IRQ_HANDLED; |
368 | 371 | } |
369 | 372 | |
373 | +static void gpio_keys_irq_timer(unsigned long _data) | |
374 | +{ | |
375 | + struct gpio_button_data *bdata = (struct gpio_button_data *)_data; | |
376 | + struct input_dev *input = bdata->input; | |
377 | + unsigned long flags; | |
378 | + | |
379 | + spin_lock_irqsave(&bdata->lock, flags); | |
380 | + if (bdata->key_pressed) { | |
381 | + input_event(input, EV_KEY, bdata->button->code, 0); | |
382 | + input_sync(input); | |
383 | + bdata->key_pressed = false; | |
384 | + } | |
385 | + spin_unlock_irqrestore(&bdata->lock, flags); | |
386 | +} | |
387 | + | |
388 | +static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id) | |
389 | +{ | |
390 | + struct gpio_button_data *bdata = dev_id; | |
391 | + const struct gpio_keys_button *button = bdata->button; | |
392 | + struct input_dev *input = bdata->input; | |
393 | + unsigned long flags; | |
394 | + | |
395 | + BUG_ON(irq != bdata->irq); | |
396 | + | |
397 | + spin_lock_irqsave(&bdata->lock, flags); | |
398 | + | |
399 | + if (!bdata->key_pressed) { | |
400 | + input_event(input, EV_KEY, button->code, 1); | |
401 | + input_sync(input); | |
402 | + | |
403 | + if (!bdata->timer_debounce) { | |
404 | + input_event(input, EV_KEY, button->code, 0); | |
405 | + input_sync(input); | |
406 | + goto out; | |
407 | + } | |
408 | + | |
409 | + bdata->key_pressed = true; | |
410 | + } | |
411 | + | |
412 | + if (bdata->timer_debounce) | |
413 | + mod_timer(&bdata->timer, | |
414 | + jiffies + msecs_to_jiffies(bdata->timer_debounce)); | |
415 | +out: | |
416 | + spin_unlock_irqrestore(&bdata->lock, flags); | |
417 | + return IRQ_HANDLED; | |
418 | +} | |
419 | + | |
370 | 420 | static int __devinit gpio_keys_setup_key(struct platform_device *pdev, |
421 | + struct input_dev *input, | |
371 | 422 | struct gpio_button_data *bdata, |
372 | - struct gpio_keys_button *button) | |
423 | + const struct gpio_keys_button *button) | |
373 | 424 | { |
374 | 425 | const char *desc = button->desc ? button->desc : "gpio_keys"; |
375 | 426 | struct device *dev = &pdev->dev; |
427 | + irq_handler_t isr; | |
376 | 428 | unsigned long irqflags; |
377 | 429 | int irq, error; |
378 | 430 | |
379 | - setup_timer(&bdata->timer, gpio_keys_timer, (unsigned long)bdata); | |
380 | - INIT_WORK(&bdata->work, gpio_keys_work_func); | |
431 | + bdata->input = input; | |
432 | + bdata->button = button; | |
433 | + spin_lock_init(&bdata->lock); | |
381 | 434 | |
382 | - error = gpio_request(button->gpio, desc); | |
383 | - if (error < 0) { | |
384 | - dev_err(dev, "failed to request GPIO %d, error %d\n", | |
385 | - button->gpio, error); | |
386 | - goto fail2; | |
387 | - } | |
435 | + if (gpio_is_valid(button->gpio)) { | |
388 | 436 | |
389 | - error = gpio_direction_input(button->gpio); | |
390 | - if (error < 0) { | |
391 | - dev_err(dev, "failed to configure" | |
392 | - " direction for GPIO %d, error %d\n", | |
393 | - button->gpio, error); | |
394 | - goto fail3; | |
395 | - } | |
437 | + error = gpio_request(button->gpio, desc); | |
438 | + if (error < 0) { | |
439 | + dev_err(dev, "Failed to request GPIO %d, error %d\n", | |
440 | + button->gpio, error); | |
441 | + return error; | |
442 | + } | |
396 | 443 | |
397 | - if (button->debounce_interval) { | |
398 | - error = gpio_set_debounce(button->gpio, | |
399 | - button->debounce_interval * 1000); | |
400 | - /* use timer if gpiolib doesn't provide debounce */ | |
401 | - if (error < 0) | |
402 | - bdata->timer_debounce = button->debounce_interval; | |
403 | - } | |
444 | + error = gpio_direction_input(button->gpio); | |
445 | + if (error < 0) { | |
446 | + dev_err(dev, | |
447 | + "Failed to configure direction for GPIO %d, error %d\n", | |
448 | + button->gpio, error); | |
449 | + goto fail; | |
450 | + } | |
404 | 451 | |
405 | - irq = gpio_to_irq(button->gpio); | |
406 | - if (irq < 0) { | |
407 | - error = irq; | |
408 | - dev_err(dev, "Unable to get irq number for GPIO %d, error %d\n", | |
409 | - button->gpio, error); | |
410 | - goto fail3; | |
452 | + if (button->debounce_interval) { | |
453 | + error = gpio_set_debounce(button->gpio, | |
454 | + button->debounce_interval * 1000); | |
455 | + /* use timer if gpiolib doesn't provide debounce */ | |
456 | + if (error < 0) | |
457 | + bdata->timer_debounce = | |
458 | + button->debounce_interval; | |
459 | + } | |
460 | + | |
461 | + irq = gpio_to_irq(button->gpio); | |
462 | + if (irq < 0) { | |
463 | + error = irq; | |
464 | + dev_err(dev, | |
465 | + "Unable to get irq number for GPIO %d, error %d\n", | |
466 | + button->gpio, error); | |
467 | + goto fail; | |
468 | + } | |
469 | + bdata->irq = irq; | |
470 | + | |
471 | + INIT_WORK(&bdata->work, gpio_keys_gpio_work_func); | |
472 | + setup_timer(&bdata->timer, | |
473 | + gpio_keys_gpio_timer, (unsigned long)bdata); | |
474 | + | |
475 | + isr = gpio_keys_gpio_isr; | |
476 | + irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING; | |
477 | + | |
478 | + } else { | |
479 | + if (!button->irq) { | |
480 | + dev_err(dev, "No IRQ specified\n"); | |
481 | + return -EINVAL; | |
482 | + } | |
483 | + bdata->irq = button->irq; | |
484 | + | |
485 | + if (button->type && button->type != EV_KEY) { | |
486 | + dev_err(dev, "Only EV_KEY allowed for IRQ buttons.\n"); | |
487 | + return -EINVAL; | |
488 | + } | |
489 | + | |
490 | + bdata->timer_debounce = button->debounce_interval; | |
491 | + setup_timer(&bdata->timer, | |
492 | + gpio_keys_irq_timer, (unsigned long)bdata); | |
493 | + | |
494 | + isr = gpio_keys_irq_isr; | |
495 | + irqflags = 0; | |
411 | 496 | } |
412 | 497 | |
413 | - irqflags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING; | |
498 | + input_set_capability(input, button->type ?: EV_KEY, button->code); | |
499 | + | |
414 | 500 | /* |
415 | 501 | * If platform has specified that the button can be disabled, |
416 | 502 | * we don't want it to share the interrupt line. |
417 | 503 | |
418 | 504 | |
... | ... | @@ -418,18 +504,19 @@ |
418 | 504 | if (!button->can_disable) |
419 | 505 | irqflags |= IRQF_SHARED; |
420 | 506 | |
421 | - error = request_threaded_irq(irq, NULL, gpio_keys_isr, irqflags, desc, bdata); | |
507 | + error = request_any_context_irq(bdata->irq, isr, irqflags, desc, bdata); | |
422 | 508 | if (error < 0) { |
423 | 509 | dev_err(dev, "Unable to claim irq %d; error %d\n", |
424 | - irq, error); | |
425 | - goto fail3; | |
510 | + bdata->irq, error); | |
511 | + goto fail; | |
426 | 512 | } |
427 | 513 | |
428 | 514 | return 0; |
429 | 515 | |
430 | -fail3: | |
431 | - gpio_free(button->gpio); | |
432 | -fail2: | |
516 | +fail: | |
517 | + if (gpio_is_valid(button->gpio)) | |
518 | + gpio_free(button->gpio); | |
519 | + | |
433 | 520 | return error; |
434 | 521 | } |
435 | 522 | |
436 | 523 | |
... | ... | @@ -547,9 +634,19 @@ |
547 | 634 | |
548 | 635 | #endif |
549 | 636 | |
637 | +static void gpio_remove_key(struct gpio_button_data *bdata) | |
638 | +{ | |
639 | + free_irq(bdata->irq, bdata); | |
640 | + if (bdata->timer_debounce) | |
641 | + del_timer_sync(&bdata->timer); | |
642 | + cancel_work_sync(&bdata->work); | |
643 | + if (gpio_is_valid(bdata->button->gpio)) | |
644 | + gpio_free(bdata->button->gpio); | |
645 | +} | |
646 | + | |
550 | 647 | static int __devinit gpio_keys_probe(struct platform_device *pdev) |
551 | 648 | { |
552 | - struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; | |
649 | + const struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; | |
553 | 650 | struct gpio_keys_drvdata *ddata; |
554 | 651 | struct device *dev = &pdev->dev; |
555 | 652 | struct gpio_keys_platform_data alt_pdata; |
556 | 653 | |
557 | 654 | |
558 | 655 | |
... | ... | @@ -599,21 +696,15 @@ |
599 | 696 | __set_bit(EV_REP, input->evbit); |
600 | 697 | |
601 | 698 | for (i = 0; i < pdata->nbuttons; i++) { |
602 | - struct gpio_keys_button *button = &pdata->buttons[i]; | |
699 | + const struct gpio_keys_button *button = &pdata->buttons[i]; | |
603 | 700 | struct gpio_button_data *bdata = &ddata->data[i]; |
604 | - unsigned int type = button->type ?: EV_KEY; | |
605 | 701 | |
606 | - bdata->input = input; | |
607 | - bdata->button = button; | |
608 | - | |
609 | - error = gpio_keys_setup_key(pdev, bdata, button); | |
702 | + error = gpio_keys_setup_key(pdev, input, bdata, button); | |
610 | 703 | if (error) |
611 | 704 | goto fail2; |
612 | 705 | |
613 | 706 | if (button->wakeup) |
614 | 707 | wakeup = 1; |
615 | - | |
616 | - input_set_capability(input, type, button->code); | |
617 | 708 | } |
618 | 709 | |
619 | 710 | error = sysfs_create_group(&pdev->dev.kobj, &gpio_keys_attr_group); |
... | ... | @@ -630,9 +721,12 @@ |
630 | 721 | goto fail3; |
631 | 722 | } |
632 | 723 | |
633 | - /* get current state of buttons */ | |
634 | - for (i = 0; i < pdata->nbuttons; i++) | |
635 | - gpio_keys_report_event(&ddata->data[i]); | |
724 | + /* get current state of buttons that are connected to GPIOs */ | |
725 | + for (i = 0; i < pdata->nbuttons; i++) { | |
726 | + struct gpio_button_data *bdata = &ddata->data[i]; | |
727 | + if (gpio_is_valid(bdata->button->gpio)) | |
728 | + gpio_keys_gpio_report_event(bdata); | |
729 | + } | |
636 | 730 | input_sync(input); |
637 | 731 | |
638 | 732 | device_init_wakeup(&pdev->dev, wakeup); |
... | ... | @@ -642,13 +736,8 @@ |
642 | 736 | fail3: |
643 | 737 | sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group); |
644 | 738 | fail2: |
645 | - while (--i >= 0) { | |
646 | - free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]); | |
647 | - if (ddata->data[i].timer_debounce) | |
648 | - del_timer_sync(&ddata->data[i].timer); | |
649 | - cancel_work_sync(&ddata->data[i].work); | |
650 | - gpio_free(pdata->buttons[i].gpio); | |
651 | - } | |
739 | + while (--i >= 0) | |
740 | + gpio_remove_key(&ddata->data[i]); | |
652 | 741 | |
653 | 742 | platform_set_drvdata(pdev, NULL); |
654 | 743 | fail1: |
... | ... | @@ -671,14 +760,8 @@ |
671 | 760 | |
672 | 761 | device_init_wakeup(&pdev->dev, 0); |
673 | 762 | |
674 | - for (i = 0; i < ddata->n_buttons; i++) { | |
675 | - int irq = gpio_to_irq(ddata->data[i].button->gpio); | |
676 | - free_irq(irq, &ddata->data[i]); | |
677 | - if (ddata->data[i].timer_debounce) | |
678 | - del_timer_sync(&ddata->data[i].timer); | |
679 | - cancel_work_sync(&ddata->data[i].work); | |
680 | - gpio_free(ddata->data[i].button->gpio); | |
681 | - } | |
763 | + for (i = 0; i < ddata->n_buttons; i++) | |
764 | + gpio_remove_key(&ddata->data[i]); | |
682 | 765 | |
683 | 766 | input_unregister_device(input); |
684 | 767 | |
... | ... | @@ -703,11 +786,9 @@ |
703 | 786 | |
704 | 787 | if (device_may_wakeup(dev)) { |
705 | 788 | for (i = 0; i < ddata->n_buttons; i++) { |
706 | - struct gpio_keys_button *button = ddata->data[i].button; | |
707 | - if (button->wakeup) { | |
708 | - int irq = gpio_to_irq(button->gpio); | |
709 | - enable_irq_wake(irq); | |
710 | - } | |
789 | + struct gpio_button_data *bdata = &ddata->data[i]; | |
790 | + if (bdata->button->wakeup) | |
791 | + enable_irq_wake(bdata->irq); | |
711 | 792 | } |
712 | 793 | } |
713 | 794 | |
714 | 795 | |
... | ... | @@ -720,14 +801,12 @@ |
720 | 801 | int i; |
721 | 802 | |
722 | 803 | for (i = 0; i < ddata->n_buttons; i++) { |
804 | + struct gpio_button_data *bdata = &ddata->data[i]; | |
805 | + if (bdata->button->wakeup && device_may_wakeup(dev)) | |
806 | + disable_irq_wake(bdata->irq); | |
723 | 807 | |
724 | - struct gpio_keys_button *button = ddata->data[i].button; | |
725 | - if (button->wakeup && device_may_wakeup(dev)) { | |
726 | - int irq = gpio_to_irq(button->gpio); | |
727 | - disable_irq_wake(irq); | |
728 | - } | |
729 | - | |
730 | - gpio_keys_report_event(&ddata->data[i]); | |
808 | + if (gpio_is_valid(bdata->button->gpio)) | |
809 | + gpio_keys_gpio_report_event(bdata); | |
731 | 810 | } |
732 | 811 | input_sync(ddata->input); |
733 | 812 |
drivers/input/keyboard/tegra-kbc.c
drivers/input/mouse/sentelic.c
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | * Finger Sensing Pad PS/2 mouse driver. |
3 | 3 | * |
4 | 4 | * Copyright (C) 2005-2007 Asia Vital Components Co., Ltd. |
5 | - * Copyright (C) 2005-2011 Tai-hwa Liang, Sentelic Corporation. | |
5 | + * Copyright (C) 2005-2012 Tai-hwa Liang, Sentelic Corporation. | |
6 | 6 | * |
7 | 7 | * This program is free software; you can redistribute it and/or |
8 | 8 | * modify it under the terms of the GNU General Public License |
... | ... | @@ -21,6 +21,7 @@ |
21 | 21 | |
22 | 22 | #include <linux/module.h> |
23 | 23 | #include <linux/input.h> |
24 | +#include <linux/input/mt.h> | |
24 | 25 | #include <linux/ctype.h> |
25 | 26 | #include <linux/libps2.h> |
26 | 27 | #include <linux/serio.h> |
... | ... | @@ -36,6 +37,9 @@ |
36 | 37 | #define FSP_CMD_TIMEOUT 200 |
37 | 38 | #define FSP_CMD_TIMEOUT2 30 |
38 | 39 | |
40 | +#define GET_ABS_X(packet) ((packet[1] << 2) | ((packet[3] >> 2) & 0x03)) | |
41 | +#define GET_ABS_Y(packet) ((packet[2] << 2) | (packet[3] & 0x03)) | |
42 | + | |
39 | 43 | /** Driver version. */ |
40 | 44 | static const char fsp_drv_ver[] = "1.0.0-K"; |
41 | 45 | |
... | ... | @@ -128,8 +132,9 @@ |
128 | 132 | out: |
129 | 133 | ps2_end_command(ps2dev); |
130 | 134 | psmouse_activate(psmouse); |
131 | - dev_dbg(&ps2dev->serio->dev, "READ REG: 0x%02x is 0x%02x (rc = %d)\n", | |
132 | - reg_addr, *reg_val, rc); | |
135 | + psmouse_dbg(psmouse, | |
136 | + "READ REG: 0x%02x is 0x%02x (rc = %d)\n", | |
137 | + reg_addr, *reg_val, rc); | |
133 | 138 | return rc; |
134 | 139 | } |
135 | 140 | |
... | ... | @@ -179,8 +184,9 @@ |
179 | 184 | |
180 | 185 | out: |
181 | 186 | ps2_end_command(ps2dev); |
182 | - dev_dbg(&ps2dev->serio->dev, "WRITE REG: 0x%02x to 0x%02x (rc = %d)\n", | |
183 | - reg_addr, reg_val, rc); | |
187 | + psmouse_dbg(psmouse, | |
188 | + "WRITE REG: 0x%02x to 0x%02x (rc = %d)\n", | |
189 | + reg_addr, reg_val, rc); | |
184 | 190 | return rc; |
185 | 191 | } |
186 | 192 | |
... | ... | @@ -237,8 +243,9 @@ |
237 | 243 | out: |
238 | 244 | ps2_end_command(ps2dev); |
239 | 245 | psmouse_activate(psmouse); |
240 | - dev_dbg(&ps2dev->serio->dev, "READ PAGE REG: 0x%02x (rc = %d)\n", | |
241 | - *reg_val, rc); | |
246 | + psmouse_dbg(psmouse, | |
247 | + "READ PAGE REG: 0x%02x (rc = %d)\n", | |
248 | + *reg_val, rc); | |
242 | 249 | return rc; |
243 | 250 | } |
244 | 251 | |
... | ... | @@ -274,8 +281,9 @@ |
274 | 281 | |
275 | 282 | out: |
276 | 283 | ps2_end_command(ps2dev); |
277 | - dev_dbg(&ps2dev->serio->dev, "WRITE PAGE REG: to 0x%02x (rc = %d)\n", | |
278 | - reg_val, rc); | |
284 | + psmouse_dbg(psmouse, | |
285 | + "WRITE PAGE REG: to 0x%02x (rc = %d)\n", | |
286 | + reg_val, rc); | |
279 | 287 | return rc; |
280 | 288 | } |
281 | 289 | |
... | ... | @@ -319,7 +327,7 @@ |
319 | 327 | int res = 0; |
320 | 328 | |
321 | 329 | if (fsp_reg_read(psmouse, FSP_REG_OPC_QDOWN, &v) == -1) { |
322 | - dev_err(&psmouse->ps2dev.serio->dev, "Unable get OPC state.\n"); | |
330 | + psmouse_err(psmouse, "Unable get OPC state.\n"); | |
323 | 331 | return -EIO; |
324 | 332 | } |
325 | 333 | |
... | ... | @@ -336,8 +344,7 @@ |
336 | 344 | } |
337 | 345 | |
338 | 346 | if (res != 0) { |
339 | - dev_err(&psmouse->ps2dev.serio->dev, | |
340 | - "Unable to enable OPC tag.\n"); | |
347 | + psmouse_err(psmouse, "Unable to enable OPC tag.\n"); | |
341 | 348 | res = -EIO; |
342 | 349 | } |
343 | 350 | |
344 | 351 | |
345 | 352 | |
346 | 353 | |
... | ... | @@ -615,18 +622,40 @@ |
615 | 622 | .attrs = fsp_attributes, |
616 | 623 | }; |
617 | 624 | |
618 | -#ifdef FSP_DEBUG | |
619 | -static void fsp_packet_debug(unsigned char packet[]) | |
625 | +#ifdef FSP_DEBUG | |
626 | +static void fsp_packet_debug(struct psmouse *psmouse, unsigned char packet[]) | |
620 | 627 | { |
621 | 628 | static unsigned int ps2_packet_cnt; |
622 | 629 | static unsigned int ps2_last_second; |
623 | 630 | unsigned int jiffies_msec; |
631 | + const char *packet_type = "UNKNOWN"; | |
632 | + unsigned short abs_x = 0, abs_y = 0; | |
624 | 633 | |
634 | + /* Interpret & dump the packet data. */ | |
635 | + switch (packet[0] >> FSP_PKT_TYPE_SHIFT) { | |
636 | + case FSP_PKT_TYPE_ABS: | |
637 | + packet_type = "Absolute"; | |
638 | + abs_x = GET_ABS_X(packet); | |
639 | + abs_y = GET_ABS_Y(packet); | |
640 | + break; | |
641 | + case FSP_PKT_TYPE_NORMAL: | |
642 | + packet_type = "Normal"; | |
643 | + break; | |
644 | + case FSP_PKT_TYPE_NOTIFY: | |
645 | + packet_type = "Notify"; | |
646 | + break; | |
647 | + case FSP_PKT_TYPE_NORMAL_OPC: | |
648 | + packet_type = "Normal-OPC"; | |
649 | + break; | |
650 | + } | |
651 | + | |
625 | 652 | ps2_packet_cnt++; |
626 | 653 | jiffies_msec = jiffies_to_msecs(jiffies); |
627 | 654 | psmouse_dbg(psmouse, |
628 | - "%08dms PS/2 packets: %02x, %02x, %02x, %02x\n", | |
629 | - jiffies_msec, packet[0], packet[1], packet[2], packet[3]); | |
655 | + "%08dms %s packets: %02x, %02x, %02x, %02x; " | |
656 | + "abs_x: %d, abs_y: %d\n", | |
657 | + jiffies_msec, packet_type, | |
658 | + packet[0], packet[1], packet[2], packet[3], abs_x, abs_y); | |
630 | 659 | |
631 | 660 | if (jiffies_msec - ps2_last_second > 1000) { |
632 | 661 | psmouse_dbg(psmouse, "PS/2 packets/sec = %d\n", ps2_packet_cnt); |
633 | 662 | |
634 | 663 | |
... | ... | @@ -635,17 +664,29 @@ |
635 | 664 | } |
636 | 665 | } |
637 | 666 | #else |
638 | -static void fsp_packet_debug(unsigned char packet[]) | |
667 | +static void fsp_packet_debug(struct psmouse *psmouse, unsigned char packet[]) | |
639 | 668 | { |
640 | 669 | } |
641 | 670 | #endif |
642 | 671 | |
672 | +static void fsp_set_slot(struct input_dev *dev, int slot, bool active, | |
673 | + unsigned int x, unsigned int y) | |
674 | +{ | |
675 | + input_mt_slot(dev, slot); | |
676 | + input_mt_report_slot_state(dev, MT_TOOL_FINGER, active); | |
677 | + if (active) { | |
678 | + input_report_abs(dev, ABS_MT_POSITION_X, x); | |
679 | + input_report_abs(dev, ABS_MT_POSITION_Y, y); | |
680 | + } | |
681 | +} | |
682 | + | |
643 | 683 | static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse) |
644 | 684 | { |
645 | 685 | struct input_dev *dev = psmouse->dev; |
646 | 686 | struct fsp_data *ad = psmouse->private; |
647 | 687 | unsigned char *packet = psmouse->packet; |
648 | 688 | unsigned char button_status = 0, lscroll = 0, rscroll = 0; |
689 | + unsigned short abs_x, abs_y, fgrs = 0; | |
649 | 690 | int rel_x, rel_y; |
650 | 691 | |
651 | 692 | if (psmouse->pktcnt < 4) |
652 | 693 | |
653 | 694 | |
... | ... | @@ -655,16 +696,76 @@ |
655 | 696 | * Full packet accumulated, process it |
656 | 697 | */ |
657 | 698 | |
699 | + fsp_packet_debug(psmouse, packet); | |
700 | + | |
658 | 701 | switch (psmouse->packet[0] >> FSP_PKT_TYPE_SHIFT) { |
659 | 702 | case FSP_PKT_TYPE_ABS: |
660 | - dev_warn(&psmouse->ps2dev.serio->dev, | |
661 | - "Unexpected absolute mode packet, ignored.\n"); | |
703 | + abs_x = GET_ABS_X(packet); | |
704 | + abs_y = GET_ABS_Y(packet); | |
705 | + | |
706 | + if (packet[0] & FSP_PB0_MFMC) { | |
707 | + /* | |
708 | + * MFMC packet: assume that there are two fingers on | |
709 | + * pad | |
710 | + */ | |
711 | + fgrs = 2; | |
712 | + | |
713 | + /* MFMC packet */ | |
714 | + if (packet[0] & FSP_PB0_MFMC_FGR2) { | |
715 | + /* 2nd finger */ | |
716 | + if (ad->last_mt_fgr == 2) { | |
717 | + /* | |
718 | + * workaround for buggy firmware | |
719 | + * which doesn't clear MFMC bit if | |
720 | + * the 1st finger is up | |
721 | + */ | |
722 | + fgrs = 1; | |
723 | + fsp_set_slot(dev, 0, false, 0, 0); | |
724 | + } | |
725 | + ad->last_mt_fgr = 2; | |
726 | + | |
727 | + fsp_set_slot(dev, 1, fgrs == 2, abs_x, abs_y); | |
728 | + } else { | |
729 | + /* 1st finger */ | |
730 | + if (ad->last_mt_fgr == 1) { | |
731 | + /* | |
732 | + * workaround for buggy firmware | |
733 | + * which doesn't clear MFMC bit if | |
734 | + * the 2nd finger is up | |
735 | + */ | |
736 | + fgrs = 1; | |
737 | + fsp_set_slot(dev, 1, false, 0, 0); | |
738 | + } | |
739 | + ad->last_mt_fgr = 1; | |
740 | + fsp_set_slot(dev, 0, fgrs != 0, abs_x, abs_y); | |
741 | + } | |
742 | + } else { | |
743 | + /* SFAC packet */ | |
744 | + | |
745 | + /* no multi-finger information */ | |
746 | + ad->last_mt_fgr = 0; | |
747 | + | |
748 | + if (abs_x != 0 && abs_y != 0) | |
749 | + fgrs = 1; | |
750 | + | |
751 | + fsp_set_slot(dev, 0, fgrs > 0, abs_x, abs_y); | |
752 | + fsp_set_slot(dev, 1, false, 0, 0); | |
753 | + } | |
754 | + if (fgrs > 0) { | |
755 | + input_report_abs(dev, ABS_X, abs_x); | |
756 | + input_report_abs(dev, ABS_Y, abs_y); | |
757 | + } | |
758 | + input_report_key(dev, BTN_LEFT, packet[0] & 0x01); | |
759 | + input_report_key(dev, BTN_RIGHT, packet[0] & 0x02); | |
760 | + input_report_key(dev, BTN_TOUCH, fgrs); | |
761 | + input_report_key(dev, BTN_TOOL_FINGER, fgrs == 1); | |
762 | + input_report_key(dev, BTN_TOOL_DOUBLETAP, fgrs == 2); | |
662 | 763 | break; |
663 | 764 | |
664 | 765 | case FSP_PKT_TYPE_NORMAL_OPC: |
665 | 766 | /* on-pad click, filter it if necessary */ |
666 | 767 | if ((ad->flags & FSPDRV_FLAG_EN_OPC) != FSPDRV_FLAG_EN_OPC) |
667 | - packet[0] &= ~BIT(0); | |
768 | + packet[0] &= ~FSP_PB0_LBTN; | |
668 | 769 | /* fall through */ |
669 | 770 | |
670 | 771 | case FSP_PKT_TYPE_NORMAL: |
... | ... | @@ -711,8 +812,6 @@ |
711 | 812 | |
712 | 813 | input_sync(dev); |
713 | 814 | |
714 | - fsp_packet_debug(packet); | |
715 | - | |
716 | 815 | return PSMOUSE_FULL_PACKET; |
717 | 816 | } |
718 | 817 | |
719 | 818 | |
720 | 819 | |
721 | 820 | |
722 | 821 | |
723 | 822 | |
724 | 823 | |
... | ... | @@ -736,43 +835,107 @@ |
736 | 835 | |
737 | 836 | ps2_command(ps2dev, param, PSMOUSE_CMD_GETID); |
738 | 837 | if (param[0] != 0x04) { |
739 | - dev_err(&psmouse->ps2dev.serio->dev, | |
740 | - "Unable to enable 4 bytes packet format.\n"); | |
838 | + psmouse_err(psmouse, | |
839 | + "Unable to enable 4 bytes packet format.\n"); | |
741 | 840 | return -EIO; |
742 | 841 | } |
743 | 842 | |
744 | - if (fsp_reg_read(psmouse, FSP_REG_SYSCTL5, &val)) { | |
745 | - dev_err(&psmouse->ps2dev.serio->dev, | |
746 | - "Unable to read SYSCTL5 register.\n"); | |
747 | - return -EIO; | |
748 | - } | |
843 | + if (pad->ver < FSP_VER_STL3888_C0) { | |
844 | + /* Preparing relative coordinates output for older hardware */ | |
845 | + if (fsp_reg_read(psmouse, FSP_REG_SYSCTL5, &val)) { | |
846 | + psmouse_err(psmouse, | |
847 | + "Unable to read SYSCTL5 register.\n"); | |
848 | + return -EIO; | |
849 | + } | |
749 | 850 | |
750 | - val &= ~(FSP_BIT_EN_MSID7 | FSP_BIT_EN_MSID8 | FSP_BIT_EN_AUTO_MSID8); | |
751 | - /* Ensure we are not in absolute mode */ | |
752 | - val &= ~FSP_BIT_EN_PKT_G0; | |
753 | - if (pad->buttons == 0x06) { | |
754 | - /* Left/Middle/Right & Scroll Up/Down/Right/Left */ | |
755 | - val |= FSP_BIT_EN_MSID6; | |
756 | - } | |
851 | + if (fsp_get_buttons(psmouse, &pad->buttons)) { | |
852 | + psmouse_err(psmouse, | |
853 | + "Unable to retrieve number of buttons.\n"); | |
854 | + return -EIO; | |
855 | + } | |
757 | 856 | |
758 | - if (fsp_reg_write(psmouse, FSP_REG_SYSCTL5, val)) { | |
759 | - dev_err(&psmouse->ps2dev.serio->dev, | |
760 | - "Unable to set up required mode bits.\n"); | |
761 | - return -EIO; | |
857 | + val &= ~(FSP_BIT_EN_MSID7 | FSP_BIT_EN_MSID8 | FSP_BIT_EN_AUTO_MSID8); | |
858 | + /* Ensure we are not in absolute mode */ | |
859 | + val &= ~FSP_BIT_EN_PKT_G0; | |
860 | + if (pad->buttons == 0x06) { | |
861 | + /* Left/Middle/Right & Scroll Up/Down/Right/Left */ | |
862 | + val |= FSP_BIT_EN_MSID6; | |
863 | + } | |
864 | + | |
865 | + if (fsp_reg_write(psmouse, FSP_REG_SYSCTL5, val)) { | |
866 | + psmouse_err(psmouse, | |
867 | + "Unable to set up required mode bits.\n"); | |
868 | + return -EIO; | |
869 | + } | |
870 | + | |
871 | + /* | |
872 | + * Enable OPC tags such that driver can tell the difference | |
873 | + * between on-pad and real button click | |
874 | + */ | |
875 | + if (fsp_opc_tag_enable(psmouse, true)) | |
876 | + psmouse_warn(psmouse, | |
877 | + "Failed to enable OPC tag mode.\n"); | |
878 | + /* enable on-pad click by default */ | |
879 | + pad->flags |= FSPDRV_FLAG_EN_OPC; | |
880 | + | |
881 | + /* Enable on-pad vertical and horizontal scrolling */ | |
882 | + fsp_onpad_vscr(psmouse, true); | |
883 | + fsp_onpad_hscr(psmouse, true); | |
884 | + } else { | |
885 | + /* Enable absolute coordinates output for Cx/Dx hardware */ | |
886 | + if (fsp_reg_write(psmouse, FSP_REG_SWC1, | |
887 | + FSP_BIT_SWC1_EN_ABS_1F | | |
888 | + FSP_BIT_SWC1_EN_ABS_2F | | |
889 | + FSP_BIT_SWC1_EN_FUP_OUT | | |
890 | + FSP_BIT_SWC1_EN_ABS_CON)) { | |
891 | + psmouse_err(psmouse, | |
892 | + "Unable to enable absolute coordinates output.\n"); | |
893 | + return -EIO; | |
894 | + } | |
762 | 895 | } |
763 | 896 | |
764 | - /* | |
765 | - * Enable OPC tags such that driver can tell the difference between | |
766 | - * on-pad and real button click | |
767 | - */ | |
768 | - if (fsp_opc_tag_enable(psmouse, true)) | |
769 | - dev_warn(&psmouse->ps2dev.serio->dev, | |
770 | - "Failed to enable OPC tag mode.\n"); | |
897 | + return 0; | |
898 | +} | |
771 | 899 | |
772 | - /* Enable on-pad vertical and horizontal scrolling */ | |
773 | - fsp_onpad_vscr(psmouse, true); | |
774 | - fsp_onpad_hscr(psmouse, true); | |
900 | +static int fsp_set_input_params(struct psmouse *psmouse) | |
901 | +{ | |
902 | + struct input_dev *dev = psmouse->dev; | |
903 | + struct fsp_data *pad = psmouse->private; | |
775 | 904 | |
905 | + if (pad->ver < FSP_VER_STL3888_C0) { | |
906 | + __set_bit(BTN_MIDDLE, dev->keybit); | |
907 | + __set_bit(BTN_BACK, dev->keybit); | |
908 | + __set_bit(BTN_FORWARD, dev->keybit); | |
909 | + __set_bit(REL_WHEEL, dev->relbit); | |
910 | + __set_bit(REL_HWHEEL, dev->relbit); | |
911 | + } else { | |
912 | + /* | |
913 | + * Hardware prior to Cx performs much better in relative mode; | |
914 | + * hence, only enable absolute coordinates output as well as | |
915 | + * multi-touch output for the newer hardware. | |
916 | + * | |
917 | + * Maximum coordinates can be computed as: | |
918 | + * | |
919 | + * number of scanlines * 64 - 57 | |
920 | + * | |
921 | + * where number of X/Y scanline lines are 16/12. | |
922 | + */ | |
923 | + int abs_x = 967, abs_y = 711; | |
924 | + | |
925 | + __set_bit(EV_ABS, dev->evbit); | |
926 | + __clear_bit(EV_REL, dev->evbit); | |
927 | + __set_bit(BTN_TOUCH, dev->keybit); | |
928 | + __set_bit(BTN_TOOL_FINGER, dev->keybit); | |
929 | + __set_bit(BTN_TOOL_DOUBLETAP, dev->keybit); | |
930 | + __set_bit(INPUT_PROP_SEMI_MT, dev->propbit); | |
931 | + | |
932 | + input_set_abs_params(dev, ABS_X, 0, abs_x, 0, 0); | |
933 | + input_set_abs_params(dev, ABS_Y, 0, abs_y, 0, 0); | |
934 | + input_mt_init_slots(dev, 2); | |
935 | + input_set_abs_params(dev, ABS_MT_POSITION_X, 0, abs_x, 0, 0); | |
936 | + input_set_abs_params(dev, ABS_MT_POSITION_Y, 0, abs_y, 0, 0); | |
937 | + } | |
938 | + | |
776 | 939 | return 0; |
777 | 940 | } |
778 | 941 | |
779 | 942 | |
780 | 943 | |
... | ... | @@ -829,18 +992,16 @@ |
829 | 992 | int fsp_init(struct psmouse *psmouse) |
830 | 993 | { |
831 | 994 | struct fsp_data *priv; |
832 | - int ver, rev, buttons; | |
995 | + int ver, rev; | |
833 | 996 | int error; |
834 | 997 | |
835 | 998 | if (fsp_get_version(psmouse, &ver) || |
836 | - fsp_get_revision(psmouse, &rev) || | |
837 | - fsp_get_buttons(psmouse, &buttons)) { | |
999 | + fsp_get_revision(psmouse, &rev)) { | |
838 | 1000 | return -ENODEV; |
839 | 1001 | } |
840 | 1002 | |
841 | - psmouse_info(psmouse, | |
842 | - "Finger Sensing Pad, hw: %d.%d.%d, sw: %s, buttons: %d\n", | |
843 | - ver >> 4, ver & 0x0F, rev, fsp_drv_ver, buttons & 7); | |
1003 | + psmouse_info(psmouse, "Finger Sensing Pad, hw: %d.%d.%d, sw: %s\n", | |
1004 | + ver >> 4, ver & 0x0F, rev, fsp_drv_ver); | |
844 | 1005 | |
845 | 1006 | psmouse->private = priv = kzalloc(sizeof(struct fsp_data), GFP_KERNEL); |
846 | 1007 | if (!priv) |
847 | 1008 | |
848 | 1009 | |
849 | 1010 | |
850 | 1011 | |
... | ... | @@ -848,34 +1009,27 @@ |
848 | 1009 | |
849 | 1010 | priv->ver = ver; |
850 | 1011 | priv->rev = rev; |
851 | - priv->buttons = buttons; | |
852 | 1012 | |
853 | - /* enable on-pad click by default */ | |
854 | - priv->flags |= FSPDRV_FLAG_EN_OPC; | |
855 | - | |
856 | - /* Set up various supported input event bits */ | |
857 | - __set_bit(BTN_MIDDLE, psmouse->dev->keybit); | |
858 | - __set_bit(BTN_BACK, psmouse->dev->keybit); | |
859 | - __set_bit(BTN_FORWARD, psmouse->dev->keybit); | |
860 | - __set_bit(REL_WHEEL, psmouse->dev->relbit); | |
861 | - __set_bit(REL_HWHEEL, psmouse->dev->relbit); | |
862 | - | |
863 | 1013 | psmouse->protocol_handler = fsp_process_byte; |
864 | 1014 | psmouse->disconnect = fsp_disconnect; |
865 | 1015 | psmouse->reconnect = fsp_reconnect; |
866 | 1016 | psmouse->cleanup = fsp_reset; |
867 | 1017 | psmouse->pktsize = 4; |
868 | 1018 | |
869 | - /* set default packet output based on number of buttons we found */ | |
870 | 1019 | error = fsp_activate_protocol(psmouse); |
871 | 1020 | if (error) |
872 | 1021 | goto err_out; |
873 | 1022 | |
1023 | + /* Set up various supported input event bits */ | |
1024 | + error = fsp_set_input_params(psmouse); | |
1025 | + if (error) | |
1026 | + goto err_out; | |
1027 | + | |
874 | 1028 | error = sysfs_create_group(&psmouse->ps2dev.serio->dev.kobj, |
875 | 1029 | &fsp_attribute_group); |
876 | 1030 | if (error) { |
877 | - dev_err(&psmouse->ps2dev.serio->dev, | |
878 | - "Failed to create sysfs attributes (%d)", error); | |
1031 | + psmouse_err(psmouse, | |
1032 | + "Failed to create sysfs attributes (%d)", error); | |
879 | 1033 | goto err_out; |
880 | 1034 | } |
881 | 1035 |
drivers/input/mouse/sentelic.h
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | * Finger Sensing Pad PS/2 mouse driver. |
3 | 3 | * |
4 | 4 | * Copyright (C) 2005-2007 Asia Vital Components Co., Ltd. |
5 | - * Copyright (C) 2005-2011 Tai-hwa Liang, Sentelic Corporation. | |
5 | + * Copyright (C) 2005-2012 Tai-hwa Liang, Sentelic Corporation. | |
6 | 6 | * |
7 | 7 | * This program is free software; you can redistribute it and/or |
8 | 8 | * modify it under the terms of the GNU General Public License |
... | ... | @@ -55,6 +55,16 @@ |
55 | 55 | #define FSP_BIT_FIX_HSCR BIT(5) |
56 | 56 | #define FSP_BIT_DRAG_LOCK BIT(6) |
57 | 57 | |
58 | +#define FSP_REG_SWC1 (0x90) | |
59 | +#define FSP_BIT_SWC1_EN_ABS_1F BIT(0) | |
60 | +#define FSP_BIT_SWC1_EN_GID BIT(1) | |
61 | +#define FSP_BIT_SWC1_EN_ABS_2F BIT(2) | |
62 | +#define FSP_BIT_SWC1_EN_FUP_OUT BIT(3) | |
63 | +#define FSP_BIT_SWC1_EN_ABS_CON BIT(4) | |
64 | +#define FSP_BIT_SWC1_GST_GRP0 BIT(5) | |
65 | +#define FSP_BIT_SWC1_GST_GRP1 BIT(6) | |
66 | +#define FSP_BIT_SWC1_BX_COMPAT BIT(7) | |
67 | + | |
58 | 68 | /* Finger-sensing Pad packet formating related definitions */ |
59 | 69 | |
60 | 70 | /* absolute packet type */ |
61 | 71 | |
... | ... | @@ -64,12 +74,32 @@ |
64 | 74 | #define FSP_PKT_TYPE_NORMAL_OPC (0x03) |
65 | 75 | #define FSP_PKT_TYPE_SHIFT (6) |
66 | 76 | |
77 | +/* bit definitions for the first byte of report packet */ | |
78 | +#define FSP_PB0_LBTN BIT(0) | |
79 | +#define FSP_PB0_RBTN BIT(1) | |
80 | +#define FSP_PB0_MBTN BIT(2) | |
81 | +#define FSP_PB0_MFMC_FGR2 FSP_PB0_MBTN | |
82 | +#define FSP_PB0_MUST_SET BIT(3) | |
83 | +#define FSP_PB0_PHY_BTN BIT(4) | |
84 | +#define FSP_PB0_MFMC BIT(5) | |
85 | + | |
86 | +/* hardware revisions */ | |
87 | +#define FSP_VER_STL3888_A4 (0xC1) | |
88 | +#define FSP_VER_STL3888_B0 (0xD0) | |
89 | +#define FSP_VER_STL3888_B1 (0xD1) | |
90 | +#define FSP_VER_STL3888_B2 (0xD2) | |
91 | +#define FSP_VER_STL3888_C0 (0xE0) | |
92 | +#define FSP_VER_STL3888_C1 (0xE1) | |
93 | +#define FSP_VER_STL3888_D0 (0xE2) | |
94 | +#define FSP_VER_STL3888_D1 (0xE3) | |
95 | +#define FSP_VER_STL3888_E0 (0xE4) | |
96 | + | |
67 | 97 | #ifdef __KERNEL__ |
68 | 98 | |
69 | 99 | struct fsp_data { |
70 | 100 | unsigned char ver; /* hardware version */ |
71 | 101 | unsigned char rev; /* hardware revison */ |
72 | - unsigned char buttons; /* Number of buttons */ | |
102 | + unsigned int buttons; /* Number of buttons */ | |
73 | 103 | unsigned int flags; |
74 | 104 | #define FSPDRV_FLAG_EN_OPC (0x001) /* enable on-pad clicking */ |
75 | 105 | |
... | ... | @@ -78,6 +108,7 @@ |
78 | 108 | |
79 | 109 | unsigned char last_reg; /* Last register we requested read from */ |
80 | 110 | unsigned char last_val; |
111 | + unsigned int last_mt_fgr; /* Last seen finger(multitouch) */ | |
81 | 112 | }; |
82 | 113 | |
83 | 114 | #ifdef CONFIG_MOUSE_PS2_SENTELIC |
drivers/input/tablet/Kconfig
drivers/input/tablet/wacom.h
... | ... | @@ -88,6 +88,7 @@ |
88 | 88 | #include <linux/mod_devicetable.h> |
89 | 89 | #include <linux/init.h> |
90 | 90 | #include <linux/usb/input.h> |
91 | +#include <linux/power_supply.h> | |
91 | 92 | #include <asm/unaligned.h> |
92 | 93 | |
93 | 94 | /* |
... | ... | @@ -112,6 +113,7 @@ |
112 | 113 | struct urb *irq; |
113 | 114 | struct wacom_wac wacom_wac; |
114 | 115 | struct mutex lock; |
116 | + struct work_struct work; | |
115 | 117 | bool open; |
116 | 118 | char phys[32]; |
117 | 119 | struct wacom_led { |
118 | 120 | |
... | ... | @@ -120,7 +122,14 @@ |
120 | 122 | u8 hlv; /* status led brightness button pressed (1..127) */ |
121 | 123 | u8 img_lum; /* OLED matrix display brightness */ |
122 | 124 | } led; |
125 | + struct power_supply battery; | |
123 | 126 | }; |
127 | + | |
128 | +static inline void wacom_schedule_work(struct wacom_wac *wacom_wac) | |
129 | +{ | |
130 | + struct wacom *wacom = container_of(wacom_wac, struct wacom, wacom_wac); | |
131 | + schedule_work(&wacom->work); | |
132 | +} | |
124 | 133 | |
125 | 134 | extern const struct usb_device_id wacom_ids[]; |
126 | 135 |
drivers/input/tablet/wacom_sys.c
... | ... | @@ -167,6 +167,19 @@ |
167 | 167 | usb_autopm_put_interface(wacom->intf); |
168 | 168 | } |
169 | 169 | |
170 | +/* | |
171 | + * Static values for max X/Y and resolution of Pen interface is stored in | |
172 | + * features. This mean physical size of active area can be computed. | |
173 | + * This is useful to do when Pen and Touch have same active area of tablet. | |
174 | + * This means for Touch device, we only need to find max X/Y value and we | |
175 | + * have enough information to compute resolution of touch. | |
176 | + */ | |
177 | +static void wacom_set_phy_from_res(struct wacom_features *features) | |
178 | +{ | |
179 | + features->x_phy = (features->x_max * 100) / features->x_resolution; | |
180 | + features->y_phy = (features->y_max * 100) / features->y_resolution; | |
181 | +} | |
182 | + | |
170 | 183 | static int wacom_parse_logical_collection(unsigned char *report, |
171 | 184 | struct wacom_features *features) |
172 | 185 | { |
... | ... | @@ -178,15 +191,7 @@ |
178 | 191 | features->pktlen = WACOM_PKGLEN_BBTOUCH3; |
179 | 192 | features->device_type = BTN_TOOL_FINGER; |
180 | 193 | |
181 | - /* | |
182 | - * Stylus and Touch have same active area | |
183 | - * so compute physical size based on stylus | |
184 | - * data before its overwritten. | |
185 | - */ | |
186 | - features->x_phy = | |
187 | - (features->x_max * 100) / features->x_resolution; | |
188 | - features->y_phy = | |
189 | - (features->y_max * 100) / features->y_resolution; | |
194 | + wacom_set_phy_from_res(features); | |
190 | 195 | |
191 | 196 | features->x_max = features->y_max = |
192 | 197 | get_unaligned_le16(&report[10]); |
... | ... | @@ -422,6 +427,7 @@ |
422 | 427 | report_id, rep_data, 4, 1); |
423 | 428 | } while ((error < 0 || rep_data[1] != 4) && limit++ < WAC_MSG_RETRIES); |
424 | 429 | } else if (features->type != TABLETPC && |
430 | + features->type != WIRELESS && | |
425 | 431 | features->device_type == BTN_TOOL_PEN) { |
426 | 432 | do { |
427 | 433 | rep_data[0] = 2; |
... | ... | @@ -454,6 +460,21 @@ |
454 | 460 | features->pressure_fuzz = 0; |
455 | 461 | features->distance_fuzz = 0; |
456 | 462 | |
463 | + /* | |
464 | + * The wireless device HID is basic and layout conflicts with | |
465 | + * other tablets (monitor and touch interface can look like pen). | |
466 | + * Skip the query for this type and modify defaults based on | |
467 | + * interface number. | |
468 | + */ | |
469 | + if (features->type == WIRELESS) { | |
470 | + if (intf->cur_altsetting->desc.bInterfaceNumber == 0) { | |
471 | + features->device_type = 0; | |
472 | + } else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) { | |
473 | + features->device_type = BTN_TOOL_DOUBLETAP; | |
474 | + features->pktlen = WACOM_PKGLEN_BBTOUCH3; | |
475 | + } | |
476 | + } | |
477 | + | |
457 | 478 | /* only Tablet PCs and Bamboo P&T need to retrieve the info */ |
458 | 479 | if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) && |
459 | 480 | (features->type != BAMBOO_PT)) |
... | ... | @@ -822,6 +843,152 @@ |
822 | 843 | } |
823 | 844 | } |
824 | 845 | |
846 | +static enum power_supply_property wacom_battery_props[] = { | |
847 | + POWER_SUPPLY_PROP_CAPACITY | |
848 | +}; | |
849 | + | |
850 | +static int wacom_battery_get_property(struct power_supply *psy, | |
851 | + enum power_supply_property psp, | |
852 | + union power_supply_propval *val) | |
853 | +{ | |
854 | + struct wacom *wacom = container_of(psy, struct wacom, battery); | |
855 | + int ret = 0; | |
856 | + | |
857 | + switch (psp) { | |
858 | + case POWER_SUPPLY_PROP_CAPACITY: | |
859 | + val->intval = | |
860 | + wacom->wacom_wac.battery_capacity * 100 / 31; | |
861 | + break; | |
862 | + default: | |
863 | + ret = -EINVAL; | |
864 | + break; | |
865 | + } | |
866 | + | |
867 | + return ret; | |
868 | +} | |
869 | + | |
870 | +static int wacom_initialize_battery(struct wacom *wacom) | |
871 | +{ | |
872 | + int error = 0; | |
873 | + | |
874 | + if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_MONITOR) { | |
875 | + wacom->battery.properties = wacom_battery_props; | |
876 | + wacom->battery.num_properties = ARRAY_SIZE(wacom_battery_props); | |
877 | + wacom->battery.get_property = wacom_battery_get_property; | |
878 | + wacom->battery.name = "wacom_battery"; | |
879 | + wacom->battery.type = POWER_SUPPLY_TYPE_BATTERY; | |
880 | + wacom->battery.use_for_apm = 0; | |
881 | + | |
882 | + error = power_supply_register(&wacom->usbdev->dev, | |
883 | + &wacom->battery); | |
884 | + } | |
885 | + | |
886 | + return error; | |
887 | +} | |
888 | + | |
889 | +static void wacom_destroy_battery(struct wacom *wacom) | |
890 | +{ | |
891 | + if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_MONITOR) | |
892 | + power_supply_unregister(&wacom->battery); | |
893 | +} | |
894 | + | |
895 | +static int wacom_register_input(struct wacom *wacom) | |
896 | +{ | |
897 | + struct input_dev *input_dev; | |
898 | + struct usb_interface *intf = wacom->intf; | |
899 | + struct usb_device *dev = interface_to_usbdev(intf); | |
900 | + struct wacom_wac *wacom_wac = &(wacom->wacom_wac); | |
901 | + int error; | |
902 | + | |
903 | + input_dev = input_allocate_device(); | |
904 | + if (!input_dev) | |
905 | + return -ENOMEM; | |
906 | + | |
907 | + input_dev->name = wacom_wac->name; | |
908 | + input_dev->dev.parent = &intf->dev; | |
909 | + input_dev->open = wacom_open; | |
910 | + input_dev->close = wacom_close; | |
911 | + usb_to_input_id(dev, &input_dev->id); | |
912 | + input_set_drvdata(input_dev, wacom); | |
913 | + | |
914 | + wacom_wac->input = input_dev; | |
915 | + wacom_setup_input_capabilities(input_dev, wacom_wac); | |
916 | + | |
917 | + error = input_register_device(input_dev); | |
918 | + if (error) { | |
919 | + input_free_device(input_dev); | |
920 | + wacom_wac->input = NULL; | |
921 | + } | |
922 | + | |
923 | + return error; | |
924 | +} | |
925 | + | |
926 | +static void wacom_wireless_work(struct work_struct *work) | |
927 | +{ | |
928 | + struct wacom *wacom = container_of(work, struct wacom, work); | |
929 | + struct usb_device *usbdev = wacom->usbdev; | |
930 | + struct wacom_wac *wacom_wac = &wacom->wacom_wac; | |
931 | + | |
932 | + /* | |
933 | + * Regardless if this is a disconnect or a new tablet, | |
934 | + * remove any existing input devices. | |
935 | + */ | |
936 | + | |
937 | + /* Stylus interface */ | |
938 | + wacom = usb_get_intfdata(usbdev->config->interface[1]); | |
939 | + if (wacom->wacom_wac.input) | |
940 | + input_unregister_device(wacom->wacom_wac.input); | |
941 | + wacom->wacom_wac.input = 0; | |
942 | + | |
943 | + /* Touch interface */ | |
944 | + wacom = usb_get_intfdata(usbdev->config->interface[2]); | |
945 | + if (wacom->wacom_wac.input) | |
946 | + input_unregister_device(wacom->wacom_wac.input); | |
947 | + wacom->wacom_wac.input = 0; | |
948 | + | |
949 | + if (wacom_wac->pid == 0) { | |
950 | + printk(KERN_INFO "wacom: wireless tablet disconnected\n"); | |
951 | + } else { | |
952 | + const struct usb_device_id *id = wacom_ids; | |
953 | + | |
954 | + printk(KERN_INFO | |
955 | + "wacom: wireless tablet connected with PID %x\n", | |
956 | + wacom_wac->pid); | |
957 | + | |
958 | + while (id->match_flags) { | |
959 | + if (id->idVendor == USB_VENDOR_ID_WACOM && | |
960 | + id->idProduct == wacom_wac->pid) | |
961 | + break; | |
962 | + id++; | |
963 | + } | |
964 | + | |
965 | + if (!id->match_flags) { | |
966 | + printk(KERN_INFO | |
967 | + "wacom: ignorning unknown PID.\n"); | |
968 | + return; | |
969 | + } | |
970 | + | |
971 | + /* Stylus interface */ | |
972 | + wacom = usb_get_intfdata(usbdev->config->interface[1]); | |
973 | + wacom_wac = &wacom->wacom_wac; | |
974 | + wacom_wac->features = | |
975 | + *((struct wacom_features *)id->driver_info); | |
976 | + wacom_wac->features.device_type = BTN_TOOL_PEN; | |
977 | + wacom_register_input(wacom); | |
978 | + | |
979 | + /* Touch interface */ | |
980 | + wacom = usb_get_intfdata(usbdev->config->interface[2]); | |
981 | + wacom_wac = &wacom->wacom_wac; | |
982 | + wacom_wac->features = | |
983 | + *((struct wacom_features *)id->driver_info); | |
984 | + wacom_wac->features.pktlen = WACOM_PKGLEN_BBTOUCH3; | |
985 | + wacom_wac->features.device_type = BTN_TOOL_FINGER; | |
986 | + wacom_set_phy_from_res(&wacom_wac->features); | |
987 | + wacom_wac->features.x_max = wacom_wac->features.y_max = 4096; | |
988 | + wacom_register_input(wacom); | |
989 | + } | |
990 | +} | |
991 | + | |
825 | 992 | static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) |
826 | 993 | { |
827 | 994 | struct usb_device *dev = interface_to_usbdev(intf); |
828 | 995 | |
... | ... | @@ -829,18 +996,12 @@ |
829 | 996 | struct wacom *wacom; |
830 | 997 | struct wacom_wac *wacom_wac; |
831 | 998 | struct wacom_features *features; |
832 | - struct input_dev *input_dev; | |
833 | 999 | int error; |
834 | 1000 | |
835 | 1001 | if (!id->driver_info) |
836 | 1002 | return -EINVAL; |
837 | 1003 | |
838 | 1004 | wacom = kzalloc(sizeof(struct wacom), GFP_KERNEL); |
839 | - input_dev = input_allocate_device(); | |
840 | - if (!wacom || !input_dev) { | |
841 | - error = -ENOMEM; | |
842 | - goto fail1; | |
843 | - } | |
844 | 1005 | |
845 | 1006 | wacom_wac = &wacom->wacom_wac; |
846 | 1007 | wacom_wac->features = *((struct wacom_features *)id->driver_info); |
847 | 1008 | |
... | ... | @@ -866,11 +1027,10 @@ |
866 | 1027 | wacom->usbdev = dev; |
867 | 1028 | wacom->intf = intf; |
868 | 1029 | mutex_init(&wacom->lock); |
1030 | + INIT_WORK(&wacom->work, wacom_wireless_work); | |
869 | 1031 | usb_make_path(dev, wacom->phys, sizeof(wacom->phys)); |
870 | 1032 | strlcat(wacom->phys, "/input0", sizeof(wacom->phys)); |
871 | 1033 | |
872 | - wacom_wac->input = input_dev; | |
873 | - | |
874 | 1034 | endpoint = &intf->cur_altsetting->endpoint[0].desc; |
875 | 1035 | |
876 | 1036 | /* Retrieve the physical and logical size for OEM devices */ |
... | ... | @@ -894,15 +1054,6 @@ |
894 | 1054 | goto fail3; |
895 | 1055 | } |
896 | 1056 | |
897 | - input_dev->name = wacom_wac->name; | |
898 | - input_dev->dev.parent = &intf->dev; | |
899 | - input_dev->open = wacom_open; | |
900 | - input_dev->close = wacom_close; | |
901 | - usb_to_input_id(dev, &input_dev->id); | |
902 | - input_set_drvdata(input_dev, wacom); | |
903 | - | |
904 | - wacom_setup_input_capabilities(input_dev, wacom_wac); | |
905 | - | |
906 | 1057 | usb_fill_int_urb(wacom->irq, dev, |
907 | 1058 | usb_rcvintpipe(dev, endpoint->bEndpointAddress), |
908 | 1059 | wacom_wac->data, features->pktlen, |
909 | 1060 | |
910 | 1061 | |
911 | 1062 | |
912 | 1063 | |
... | ... | @@ -914,22 +1065,34 @@ |
914 | 1065 | if (error) |
915 | 1066 | goto fail4; |
916 | 1067 | |
917 | - error = input_register_device(input_dev); | |
1068 | + error = wacom_initialize_battery(wacom); | |
918 | 1069 | if (error) |
919 | 1070 | goto fail5; |
920 | 1071 | |
1072 | + if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) { | |
1073 | + error = wacom_register_input(wacom); | |
1074 | + if (error) | |
1075 | + goto fail6; | |
1076 | + } | |
1077 | + | |
921 | 1078 | /* Note that if query fails it is not a hard failure */ |
922 | 1079 | wacom_query_tablet_data(intf, features); |
923 | 1080 | |
924 | 1081 | usb_set_intfdata(intf, wacom); |
1082 | + | |
1083 | + if (features->quirks & WACOM_QUIRK_MONITOR) { | |
1084 | + if (usb_submit_urb(wacom->irq, GFP_KERNEL)) | |
1085 | + goto fail5; | |
1086 | + } | |
1087 | + | |
925 | 1088 | return 0; |
926 | 1089 | |
1090 | + fail6: wacom_destroy_battery(wacom); | |
927 | 1091 | fail5: wacom_destroy_leds(wacom); |
928 | 1092 | fail4: wacom_remove_shared_data(wacom_wac); |
929 | 1093 | fail3: usb_free_urb(wacom->irq); |
930 | 1094 | fail2: usb_free_coherent(dev, WACOM_PKGLEN_MAX, wacom_wac->data, wacom->data_dma); |
931 | - fail1: input_free_device(input_dev); | |
932 | - kfree(wacom); | |
1095 | + fail1: kfree(wacom); | |
933 | 1096 | return error; |
934 | 1097 | } |
935 | 1098 | |
... | ... | @@ -940,7 +1103,10 @@ |
940 | 1103 | usb_set_intfdata(intf, NULL); |
941 | 1104 | |
942 | 1105 | usb_kill_urb(wacom->irq); |
943 | - input_unregister_device(wacom->wacom_wac.input); | |
1106 | + cancel_work_sync(&wacom->work); | |
1107 | + if (wacom->wacom_wac.input) | |
1108 | + input_unregister_device(wacom->wacom_wac.input); | |
1109 | + wacom_destroy_battery(wacom); | |
944 | 1110 | wacom_destroy_leds(wacom); |
945 | 1111 | usb_free_urb(wacom->irq); |
946 | 1112 | usb_free_coherent(interface_to_usbdev(intf), WACOM_PKGLEN_MAX, |
... | ... | @@ -972,7 +1138,8 @@ |
972 | 1138 | wacom_query_tablet_data(intf, features); |
973 | 1139 | wacom_led_control(wacom); |
974 | 1140 | |
975 | - if (wacom->open && usb_submit_urb(wacom->irq, GFP_NOIO) < 0) | |
1141 | + if ((wacom->open || features->quirks & WACOM_QUIRK_MONITOR) | |
1142 | + && usb_submit_urb(wacom->irq, GFP_NOIO) < 0) | |
976 | 1143 | rv = -EIO; |
977 | 1144 | |
978 | 1145 | mutex_unlock(&wacom->lock); |
drivers/input/tablet/wacom_wac.c
... | ... | @@ -1044,6 +1044,35 @@ |
1044 | 1044 | return 0; |
1045 | 1045 | } |
1046 | 1046 | |
1047 | +static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len) | |
1048 | +{ | |
1049 | + unsigned char *data = wacom->data; | |
1050 | + int connected; | |
1051 | + | |
1052 | + if (len != WACOM_PKGLEN_WIRELESS || data[0] != 0x80) | |
1053 | + return 0; | |
1054 | + | |
1055 | + connected = data[1] & 0x01; | |
1056 | + if (connected) { | |
1057 | + int pid, battery; | |
1058 | + | |
1059 | + pid = get_unaligned_be16(&data[6]); | |
1060 | + battery = data[5] & 0x3f; | |
1061 | + if (wacom->pid != pid) { | |
1062 | + wacom->pid = pid; | |
1063 | + wacom_schedule_work(wacom); | |
1064 | + } | |
1065 | + wacom->battery_capacity = battery; | |
1066 | + } else if (wacom->pid != 0) { | |
1067 | + /* disconnected while previously connected */ | |
1068 | + wacom->pid = 0; | |
1069 | + wacom_schedule_work(wacom); | |
1070 | + wacom->battery_capacity = 0; | |
1071 | + } | |
1072 | + | |
1073 | + return 0; | |
1074 | +} | |
1075 | + | |
1047 | 1076 | void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) |
1048 | 1077 | { |
1049 | 1078 | bool sync; |
... | ... | @@ -1094,6 +1123,10 @@ |
1094 | 1123 | sync = wacom_bpt_irq(wacom_wac, len); |
1095 | 1124 | break; |
1096 | 1125 | |
1126 | + case WIRELESS: | |
1127 | + sync = wacom_wireless_irq(wacom_wac, len); | |
1128 | + break; | |
1129 | + | |
1097 | 1130 | default: |
1098 | 1131 | sync = false; |
1099 | 1132 | break; |
... | ... | @@ -1155,7 +1188,7 @@ |
1155 | 1188 | |
1156 | 1189 | /* these device have multiple inputs */ |
1157 | 1190 | if (features->type == TABLETPC || features->type == TABLETPC2FG || |
1158 | - features->type == BAMBOO_PT) | |
1191 | + features->type == BAMBOO_PT || features->type == WIRELESS) | |
1159 | 1192 | features->quirks |= WACOM_QUIRK_MULTI_INPUT; |
1160 | 1193 | |
1161 | 1194 | /* quirk for bamboo touch with 2 low res touches */ |
... | ... | @@ -1167,6 +1200,16 @@ |
1167 | 1200 | features->y_fuzz <<= 5; |
1168 | 1201 | features->quirks |= WACOM_QUIRK_BBTOUCH_LOWRES; |
1169 | 1202 | } |
1203 | + | |
1204 | + if (features->type == WIRELESS) { | |
1205 | + | |
1206 | + /* monitor never has input and pen/touch have delayed create */ | |
1207 | + features->quirks |= WACOM_QUIRK_NO_INPUT; | |
1208 | + | |
1209 | + /* must be monitor interface if no device_type set */ | |
1210 | + if (!features->device_type) | |
1211 | + features->quirks |= WACOM_QUIRK_MONITOR; | |
1212 | + } | |
1170 | 1213 | } |
1171 | 1214 | |
1172 | 1215 | static unsigned int wacom_calculate_touch_res(unsigned int logical_max, |
... | ... | @@ -1640,6 +1683,9 @@ |
1640 | 1683 | static const struct wacom_features wacom_features_0x47 = |
1641 | 1684 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, |
1642 | 1685 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
1686 | +static const struct wacom_features wacom_features_0x84 = | |
1687 | + { "Wacom Wireless Receiver", WACOM_PKGLEN_WIRELESS, 0, 0, 0, | |
1688 | + 0, WIRELESS, 0, 0 }; | |
1643 | 1689 | static const struct wacom_features wacom_features_0xD0 = |
1644 | 1690 | { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, |
1645 | 1691 | 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
... | ... | @@ -1766,6 +1812,7 @@ |
1766 | 1812 | { USB_DEVICE_DETAILED(0xCE, USB_CLASS_HID, |
1767 | 1813 | USB_INTERFACE_SUBCLASS_BOOT, |
1768 | 1814 | USB_INTERFACE_PROTOCOL_MOUSE) }, |
1815 | + { USB_DEVICE_WACOM(0x84) }, | |
1769 | 1816 | { USB_DEVICE_WACOM(0xD0) }, |
1770 | 1817 | { USB_DEVICE_WACOM(0xD1) }, |
1771 | 1818 | { USB_DEVICE_WACOM(0xD2) }, |
drivers/input/tablet/wacom_wac.h
... | ... | @@ -24,6 +24,7 @@ |
24 | 24 | #define WACOM_PKGLEN_BBTOUCH 20 |
25 | 25 | #define WACOM_PKGLEN_BBTOUCH3 64 |
26 | 26 | #define WACOM_PKGLEN_BBPEN 10 |
27 | +#define WACOM_PKGLEN_WIRELESS 32 | |
27 | 28 | |
28 | 29 | /* device IDs */ |
29 | 30 | #define STYLUS_DEVICE_ID 0x02 |
... | ... | @@ -45,6 +46,8 @@ |
45 | 46 | /* device quirks */ |
46 | 47 | #define WACOM_QUIRK_MULTI_INPUT 0x0001 |
47 | 48 | #define WACOM_QUIRK_BBTOUCH_LOWRES 0x0002 |
49 | +#define WACOM_QUIRK_NO_INPUT 0x0004 | |
50 | +#define WACOM_QUIRK_MONITOR 0x0008 | |
48 | 51 | |
49 | 52 | enum { |
50 | 53 | PENPARTNER = 0, |
... | ... | @@ -54,6 +57,7 @@ |
54 | 57 | PL, |
55 | 58 | DTU, |
56 | 59 | BAMBOO_PT, |
60 | + WIRELESS, | |
57 | 61 | INTUOS, |
58 | 62 | INTUOS3S, |
59 | 63 | INTUOS3, |
... | ... | @@ -107,6 +111,8 @@ |
107 | 111 | struct wacom_features features; |
108 | 112 | struct wacom_shared *shared; |
109 | 113 | struct input_dev *input; |
114 | + int pid; | |
115 | + int battery_capacity; | |
110 | 116 | }; |
111 | 117 | |
112 | 118 | #endif |
include/linux/gpio_keys.h
... | ... | @@ -6,7 +6,7 @@ |
6 | 6 | struct gpio_keys_button { |
7 | 7 | /* Configuration parameters */ |
8 | 8 | unsigned int code; /* input event code (KEY_*, SW_*) */ |
9 | - int gpio; | |
9 | + int gpio; /* -1 if this key does not support gpio */ | |
10 | 10 | int active_low; |
11 | 11 | const char *desc; |
12 | 12 | unsigned int type; /* input event type (EV_KEY, EV_SW, EV_ABS) */ |
... | ... | @@ -14,6 +14,7 @@ |
14 | 14 | int debounce_interval; /* debounce ticks interval in msecs */ |
15 | 15 | bool can_disable; |
16 | 16 | int value; /* axis value for EV_ABS */ |
17 | + unsigned int irq; /* Irq number in case of interrupt keys */ | |
17 | 18 | }; |
18 | 19 | |
19 | 20 | struct gpio_keys_platform_data { |