aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2018-01-09 16:44:46 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2018-01-16 16:30:51 -0500
commit2bc4298f59d2f15175bb568e2d356b5912d0cdd9 (patch)
tree8f9d5739dd1985ef48329faa77f01ac484067c53
parentfaec44b6838312484d63e82286087cf2d5ebb891 (diff)
Input: psmouse - fix Synaptics detection when protocol is disabled
When Synaptics protocol is disabled, we still need to try and detect the hardware, so we can switch to SMBus device if SMbus is detected, or we know that it is Synaptics device and reset it properly for the bare PS/2 protocol. Fixes: c378b5119eb0 ("Input: psmouse - factor out common protocol probing code") Reported-by: Matteo Croce <mcroce@redhat.com> Tested-by: Matteo Croce <mcroce@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/mouse/psmouse-base.c34
1 files changed, 21 insertions, 13 deletions
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 6a5649e52eed..8ac9e03c05b4 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -975,6 +975,21 @@ static void psmouse_apply_defaults(struct psmouse *psmouse)
975 psmouse->pt_deactivate = NULL; 975 psmouse->pt_deactivate = NULL;
976} 976}
977 977
978static bool psmouse_do_detect(int (*detect)(struct psmouse *, bool),
979 struct psmouse *psmouse, bool allow_passthrough,
980 bool set_properties)
981{
982 if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU &&
983 !allow_passthrough) {
984 return false;
985 }
986
987 if (set_properties)
988 psmouse_apply_defaults(psmouse);
989
990 return detect(psmouse, set_properties) == 0;
991}
992
978static bool psmouse_try_protocol(struct psmouse *psmouse, 993static bool psmouse_try_protocol(struct psmouse *psmouse,
979 enum psmouse_type type, 994 enum psmouse_type type,
980 unsigned int *max_proto, 995 unsigned int *max_proto,
@@ -986,15 +1001,8 @@ static bool psmouse_try_protocol(struct psmouse *psmouse,
986 if (!proto) 1001 if (!proto)
987 return false; 1002 return false;
988 1003
989 if (psmouse->ps2dev.serio->id.type == SERIO_PS_PSTHRU && 1004 if (!psmouse_do_detect(proto->detect, psmouse, proto->try_passthru,
990 !proto->try_passthru) { 1005 set_properties))
991 return false;
992 }
993
994 if (set_properties)
995 psmouse_apply_defaults(psmouse);
996
997 if (proto->detect(psmouse, set_properties) != 0)
998 return false; 1006 return false;
999 1007
1000 if (set_properties && proto->init && init_allowed) { 1008 if (set_properties && proto->init && init_allowed) {
@@ -1027,8 +1035,8 @@ static int psmouse_extensions(struct psmouse *psmouse,
1027 * Always check for focaltech, this is safe as it uses pnp-id 1035 * Always check for focaltech, this is safe as it uses pnp-id
1028 * matching. 1036 * matching.
1029 */ 1037 */
1030 if (psmouse_try_protocol(psmouse, PSMOUSE_FOCALTECH, 1038 if (psmouse_do_detect(focaltech_detect,
1031 &max_proto, set_properties, false)) { 1039 psmouse, false, set_properties)) {
1032 if (max_proto > PSMOUSE_IMEX && 1040 if (max_proto > PSMOUSE_IMEX &&
1033 IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH) && 1041 IS_ENABLED(CONFIG_MOUSE_PS2_FOCALTECH) &&
1034 (!set_properties || focaltech_init(psmouse) == 0)) { 1042 (!set_properties || focaltech_init(psmouse) == 0)) {
@@ -1074,8 +1082,8 @@ static int psmouse_extensions(struct psmouse *psmouse,
1074 * probing for IntelliMouse. 1082 * probing for IntelliMouse.
1075 */ 1083 */
1076 if (max_proto > PSMOUSE_PS2 && 1084 if (max_proto > PSMOUSE_PS2 &&
1077 psmouse_try_protocol(psmouse, PSMOUSE_SYNAPTICS, &max_proto, 1085 psmouse_do_detect(synaptics_detect,
1078 set_properties, false)) { 1086 psmouse, false, set_properties)) {
1079 synaptics_hardware = true; 1087 synaptics_hardware = true;
1080 1088
1081 if (max_proto > PSMOUSE_IMEX) { 1089 if (max_proto > PSMOUSE_IMEX) {