diff options
-rw-r--r-- | drivers/input/mouse/elantech.c | 36 | ||||
-rw-r--r-- | drivers/input/mouse/elantech.h | 1 |
2 files changed, 29 insertions, 8 deletions
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index b562392d0cd8..24bb2b5f5667 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -43,6 +43,24 @@ static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, | |||
43 | } | 43 | } |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * V3 and later support this fast command | ||
47 | */ | ||
48 | static int elantech_send_cmd(struct psmouse *psmouse, unsigned char c, | ||
49 | unsigned char *param) | ||
50 | { | ||
51 | struct ps2dev *ps2dev = &psmouse->ps2dev; | ||
52 | |||
53 | if (ps2_command(ps2dev, NULL, ETP_PS2_CUSTOM_COMMAND) || | ||
54 | ps2_command(ps2dev, NULL, c) || | ||
55 | ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) { | ||
56 | psmouse_err(psmouse, "%s query 0x%02x failed.\n", __func__, c); | ||
57 | return -1; | ||
58 | } | ||
59 | |||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | /* | ||
46 | * A retrying version of ps2_command | 64 | * A retrying version of ps2_command |
47 | */ | 65 | */ |
48 | static int elantech_ps2_command(struct psmouse *psmouse, | 66 | static int elantech_ps2_command(struct psmouse *psmouse, |
@@ -863,13 +881,13 @@ static int elantech_set_range(struct psmouse *psmouse, | |||
863 | i = (etd->fw_version > 0x020800 && | 881 | i = (etd->fw_version > 0x020800 && |
864 | etd->fw_version < 0x020900) ? 1 : 2; | 882 | etd->fw_version < 0x020900) ? 1 : 2; |
865 | 883 | ||
866 | if (synaptics_send_cmd(psmouse, ETP_FW_ID_QUERY, param)) | 884 | if (etd->send_cmd(psmouse, ETP_FW_ID_QUERY, param)) |
867 | return -1; | 885 | return -1; |
868 | 886 | ||
869 | fixed_dpi = param[1] & 0x10; | 887 | fixed_dpi = param[1] & 0x10; |
870 | 888 | ||
871 | if (((etd->fw_version >> 16) == 0x14) && fixed_dpi) { | 889 | if (((etd->fw_version >> 16) == 0x14) && fixed_dpi) { |
872 | if (synaptics_send_cmd(psmouse, ETP_SAMPLE_QUERY, param)) | 890 | if (etd->send_cmd(psmouse, ETP_SAMPLE_QUERY, param)) |
873 | return -1; | 891 | return -1; |
874 | 892 | ||
875 | *x_max = (etd->capabilities[1] - i) * param[1] / 2; | 893 | *x_max = (etd->capabilities[1] - i) * param[1] / 2; |
@@ -888,7 +906,7 @@ static int elantech_set_range(struct psmouse *psmouse, | |||
888 | break; | 906 | break; |
889 | 907 | ||
890 | case 3: | 908 | case 3: |
891 | if (synaptics_send_cmd(psmouse, ETP_FW_ID_QUERY, param)) | 909 | if (etd->send_cmd(psmouse, ETP_FW_ID_QUERY, param)) |
892 | return -1; | 910 | return -1; |
893 | 911 | ||
894 | *x_max = (0x0f & param[0]) << 8 | param[1]; | 912 | *x_max = (0x0f & param[0]) << 8 | param[1]; |
@@ -896,7 +914,7 @@ static int elantech_set_range(struct psmouse *psmouse, | |||
896 | break; | 914 | break; |
897 | 915 | ||
898 | case 4: | 916 | case 4: |
899 | if (synaptics_send_cmd(psmouse, ETP_FW_ID_QUERY, param)) | 917 | if (etd->send_cmd(psmouse, ETP_FW_ID_QUERY, param)) |
900 | return -1; | 918 | return -1; |
901 | 919 | ||
902 | *x_max = (0x0f & param[0]) << 8 | param[1]; | 920 | *x_max = (0x0f & param[0]) << 8 | param[1]; |
@@ -1220,9 +1238,11 @@ static int elantech_set_properties(struct elantech_data *etd) | |||
1220 | else | 1238 | else |
1221 | return -1; | 1239 | return -1; |
1222 | 1240 | ||
1223 | /* | 1241 | /* decide which send_cmd we're gonna use early */ |
1224 | * Turn on packet checking by default. | 1242 | etd->send_cmd = etd->hw_version >= 3 ? elantech_send_cmd : |
1225 | */ | 1243 | synaptics_send_cmd; |
1244 | |||
1245 | /* Turn on packet checking by default */ | ||
1226 | etd->paritycheck = 1; | 1246 | etd->paritycheck = 1; |
1227 | 1247 | ||
1228 | /* | 1248 | /* |
@@ -1278,7 +1298,7 @@ int elantech_init(struct psmouse *psmouse) | |||
1278 | "assuming hardware version %d (with firmware version 0x%02x%02x%02x)\n", | 1298 | "assuming hardware version %d (with firmware version 0x%02x%02x%02x)\n", |
1279 | etd->hw_version, param[0], param[1], param[2]); | 1299 | etd->hw_version, param[0], param[1], param[2]); |
1280 | 1300 | ||
1281 | if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY, | 1301 | if (etd->send_cmd(psmouse, ETP_CAPABILITIES_QUERY, |
1282 | etd->capabilities)) { | 1302 | etd->capabilities)) { |
1283 | psmouse_err(psmouse, "failed to query capabilities.\n"); | 1303 | psmouse_err(psmouse, "failed to query capabilities.\n"); |
1284 | goto init_fail; | 1304 | goto init_fail; |
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h index 9e5f1aabea7e..08d00bd9d1f8 100644 --- a/drivers/input/mouse/elantech.h +++ b/drivers/input/mouse/elantech.h | |||
@@ -135,6 +135,7 @@ struct elantech_data { | |||
135 | unsigned int width; | 135 | unsigned int width; |
136 | struct finger_pos mt[ETP_MAX_FINGERS]; | 136 | struct finger_pos mt[ETP_MAX_FINGERS]; |
137 | unsigned char parity[256]; | 137 | unsigned char parity[256]; |
138 | int (*send_cmd)(struct psmouse *psmouse, unsigned char c, unsigned char *param); | ||
138 | }; | 139 | }; |
139 | 140 | ||
140 | #ifdef CONFIG_MOUSE_PS2_ELANTECH | 141 | #ifdef CONFIG_MOUSE_PS2_ELANTECH |