aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/psmouse-base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/mouse/psmouse-base.c')
-rw-r--r--drivers/input/mouse/psmouse-base.c74
1 files changed, 30 insertions, 44 deletions
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index fd0bc094616a..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.
@@ -1137,7 +1146,10 @@ static void psmouse_cleanup(struct serio *serio)
1137 if (psmouse->cleanup) 1146 if (psmouse->cleanup)
1138 psmouse->cleanup(psmouse); 1147 psmouse->cleanup(psmouse);
1139 1148
1140 psmouse_reset(psmouse); 1149/*
1150 * Reset the mouse to defaults (bare PS/2 protocol).
1151 */
1152 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
1141 1153
1142/* 1154/*
1143 * Some boxes, such as HP nx7400, get terribly confused if mouse 1155 * Some boxes, such as HP nx7400, get terribly confused if mouse
@@ -1447,24 +1459,10 @@ ssize_t psmouse_attr_show_helper(struct device *dev, struct device_attribute *de
1447 struct serio *serio = to_serio_port(dev); 1459 struct serio *serio = to_serio_port(dev);
1448 struct psmouse_attribute *attr = to_psmouse_attr(devattr); 1460 struct psmouse_attribute *attr = to_psmouse_attr(devattr);
1449 struct psmouse *psmouse; 1461 struct psmouse *psmouse;
1450 int retval;
1451
1452 retval = serio_pin_driver(serio);
1453 if (retval)
1454 return retval;
1455
1456 if (serio->drv != &psmouse_drv) {
1457 retval = -ENODEV;
1458 goto out;
1459 }
1460 1462
1461 psmouse = serio_get_drvdata(serio); 1463 psmouse = serio_get_drvdata(serio);
1462 1464
1463 retval = attr->show(psmouse, attr->data, buf); 1465 return attr->show(psmouse, attr->data, buf);
1464
1465out:
1466 serio_unpin_driver(serio);
1467 return retval;
1468} 1466}
1469 1467
1470ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *devattr, 1468ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *devattr,
@@ -1475,18 +1473,9 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev
1475 struct psmouse *psmouse, *parent = NULL; 1473 struct psmouse *psmouse, *parent = NULL;
1476 int retval; 1474 int retval;
1477 1475
1478 retval = serio_pin_driver(serio);
1479 if (retval)
1480 return retval;
1481
1482 if (serio->drv != &psmouse_drv) {
1483 retval = -ENODEV;
1484 goto out_unpin;
1485 }
1486
1487 retval = mutex_lock_interruptible(&psmouse_mutex); 1476 retval = mutex_lock_interruptible(&psmouse_mutex);
1488 if (retval) 1477 if (retval)
1489 goto out_unpin; 1478 goto out;
1490 1479
1491 psmouse = serio_get_drvdata(serio); 1480 psmouse = serio_get_drvdata(serio);
1492 1481
@@ -1516,8 +1505,7 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev
1516 1505
1517 out_unlock: 1506 out_unlock:
1518 mutex_unlock(&psmouse_mutex); 1507 mutex_unlock(&psmouse_mutex);
1519 out_unpin: 1508 out:
1520 serio_unpin_driver(serio);
1521 return retval; 1509 return retval;
1522} 1510}
1523 1511
@@ -1579,9 +1567,7 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co
1579 } 1567 }
1580 1568
1581 mutex_unlock(&psmouse_mutex); 1569 mutex_unlock(&psmouse_mutex);
1582 serio_unpin_driver(serio);
1583 serio_unregister_child_port(serio); 1570 serio_unregister_child_port(serio);
1584 serio_pin_driver_uninterruptible(serio);
1585 mutex_lock(&psmouse_mutex); 1571 mutex_lock(&psmouse_mutex);
1586 1572
1587 if (serio->drv != &psmouse_drv) { 1573 if (serio->drv != &psmouse_drv) {