diff options
Diffstat (limited to 'drivers/input/mouse/psmouse-base.c')
-rw-r--r-- | drivers/input/mouse/psmouse-base.c | 69 |
1 files changed, 26 insertions, 43 deletions
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 401ac6b6edd4..9774bdfaa482 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -627,8 +627,15 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
627 | synaptics_hardware = true; | 627 | synaptics_hardware = true; |
628 | 628 | ||
629 | if (max_proto > PSMOUSE_IMEX) { | 629 | if (max_proto > PSMOUSE_IMEX) { |
630 | if (!set_properties || synaptics_init(psmouse) == 0) | 630 | /* |
631 | * Try activating protocol, but check if support is enabled first, since | ||
632 | * we try detecting Synaptics even when protocol is disabled. | ||
633 | */ | ||
634 | if (synaptics_supported() && | ||
635 | (!set_properties || synaptics_init(psmouse) == 0)) { | ||
631 | return PSMOUSE_SYNAPTICS; | 636 | return PSMOUSE_SYNAPTICS; |
637 | } | ||
638 | |||
632 | /* | 639 | /* |
633 | * Some Synaptics touchpads can emulate extended protocols (like IMPS/2). | 640 | * Some Synaptics touchpads can emulate extended protocols (like IMPS/2). |
634 | * Unfortunately Logitech/Genius probes confuse some firmware versions so | 641 | * Unfortunately Logitech/Genius probes confuse some firmware versions so |
@@ -683,19 +690,6 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
683 | max_proto = PSMOUSE_IMEX; | 690 | max_proto = PSMOUSE_IMEX; |
684 | } | 691 | } |
685 | 692 | ||
686 | /* | ||
687 | * Try Finger Sensing Pad | ||
688 | */ | ||
689 | if (max_proto > PSMOUSE_IMEX) { | ||
690 | if (fsp_detect(psmouse, set_properties) == 0) { | ||
691 | if (!set_properties || fsp_init(psmouse) == 0) | ||
692 | return PSMOUSE_FSP; | ||
693 | /* | ||
694 | * Init failed, try basic relative protocols | ||
695 | */ | ||
696 | max_proto = PSMOUSE_IMEX; | ||
697 | } | ||
698 | } | ||
699 | 693 | ||
700 | if (max_proto > PSMOUSE_IMEX) { | 694 | if (max_proto > PSMOUSE_IMEX) { |
701 | if (genius_detect(psmouse, set_properties) == 0) | 695 | if (genius_detect(psmouse, set_properties) == 0) |
@@ -712,6 +706,21 @@ static int psmouse_extensions(struct psmouse *psmouse, | |||
712 | } | 706 | } |
713 | 707 | ||
714 | /* | 708 | /* |
709 | * Try Finger Sensing Pad. We do it here because its probe upsets | ||
710 | * Trackpoint devices (causing TP_READ_ID command to time out). | ||
711 | */ | ||
712 | if (max_proto > PSMOUSE_IMEX) { | ||
713 | if (fsp_detect(psmouse, set_properties) == 0) { | ||
714 | if (!set_properties || fsp_init(psmouse) == 0) | ||
715 | return PSMOUSE_FSP; | ||
716 | /* | ||
717 | * Init failed, try basic relative protocols | ||
718 | */ | ||
719 | max_proto = PSMOUSE_IMEX; | ||
720 | } | ||
721 | } | ||
722 | |||
723 | /* | ||
715 | * Reset to defaults in case the device got confused by extended | 724 | * Reset to defaults in case the device got confused by extended |
716 | * protocol probes. Note that we follow up with full reset because | 725 | * protocol probes. Note that we follow up with full reset because |
717 | * some mice put themselves to sleep when they see PSMOUSE_RESET_DIS. | 726 | * some mice put themselves to sleep when they see PSMOUSE_RESET_DIS. |
@@ -1450,24 +1459,10 @@ ssize_t psmouse_attr_show_helper(struct device *dev, struct device_attribute *de | |||
1450 | struct serio *serio = to_serio_port(dev); | 1459 | struct serio *serio = to_serio_port(dev); |
1451 | struct psmouse_attribute *attr = to_psmouse_attr(devattr); | 1460 | struct psmouse_attribute *attr = to_psmouse_attr(devattr); |
1452 | struct psmouse *psmouse; | 1461 | struct psmouse *psmouse; |
1453 | int retval; | ||
1454 | |||
1455 | retval = serio_pin_driver(serio); | ||
1456 | if (retval) | ||
1457 | return retval; | ||
1458 | |||
1459 | if (serio->drv != &psmouse_drv) { | ||
1460 | retval = -ENODEV; | ||
1461 | goto out; | ||
1462 | } | ||
1463 | 1462 | ||
1464 | psmouse = serio_get_drvdata(serio); | 1463 | psmouse = serio_get_drvdata(serio); |
1465 | 1464 | ||
1466 | retval = attr->show(psmouse, attr->data, buf); | 1465 | return attr->show(psmouse, attr->data, buf); |
1467 | |||
1468 | out: | ||
1469 | serio_unpin_driver(serio); | ||
1470 | return retval; | ||
1471 | } | 1466 | } |
1472 | 1467 | ||
1473 | ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *devattr, | 1468 | ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *devattr, |
@@ -1478,18 +1473,9 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev | |||
1478 | struct psmouse *psmouse, *parent = NULL; | 1473 | struct psmouse *psmouse, *parent = NULL; |
1479 | int retval; | 1474 | int retval; |
1480 | 1475 | ||
1481 | retval = serio_pin_driver(serio); | ||
1482 | if (retval) | ||
1483 | return retval; | ||
1484 | |||
1485 | if (serio->drv != &psmouse_drv) { | ||
1486 | retval = -ENODEV; | ||
1487 | goto out_unpin; | ||
1488 | } | ||
1489 | |||
1490 | retval = mutex_lock_interruptible(&psmouse_mutex); | 1476 | retval = mutex_lock_interruptible(&psmouse_mutex); |
1491 | if (retval) | 1477 | if (retval) |
1492 | goto out_unpin; | 1478 | goto out; |
1493 | 1479 | ||
1494 | psmouse = serio_get_drvdata(serio); | 1480 | psmouse = serio_get_drvdata(serio); |
1495 | 1481 | ||
@@ -1519,8 +1505,7 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev | |||
1519 | 1505 | ||
1520 | out_unlock: | 1506 | out_unlock: |
1521 | mutex_unlock(&psmouse_mutex); | 1507 | mutex_unlock(&psmouse_mutex); |
1522 | out_unpin: | 1508 | out: |
1523 | serio_unpin_driver(serio); | ||
1524 | return retval; | 1509 | return retval; |
1525 | } | 1510 | } |
1526 | 1511 | ||
@@ -1582,9 +1567,7 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co | |||
1582 | } | 1567 | } |
1583 | 1568 | ||
1584 | mutex_unlock(&psmouse_mutex); | 1569 | mutex_unlock(&psmouse_mutex); |
1585 | serio_unpin_driver(serio); | ||
1586 | serio_unregister_child_port(serio); | 1570 | serio_unregister_child_port(serio); |
1587 | serio_pin_driver_uninterruptible(serio); | ||
1588 | mutex_lock(&psmouse_mutex); | 1571 | mutex_lock(&psmouse_mutex); |
1589 | 1572 | ||
1590 | if (serio->drv != &psmouse_drv) { | 1573 | if (serio->drv != &psmouse_drv) { |