Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 282382
b: refs/heads/master
c: b56b92a
h: refs/heads/master
v: v3
  • Loading branch information
JJ Ding authored and Dmitry Torokhov committed Nov 21, 2011
1 parent 8fa401b commit bc899c2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8672bd93d3d67b18a2b067ece30dabcda11f8cde
refs/heads/master: b56b92a9a175faad4c182309a63f221219de9191
36 changes: 28 additions & 8 deletions trunk/drivers/input/mouse/elantech.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,24 @@ static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c,
return 0;
}

/*
* V3 and later support this fast command
*/
static int elantech_send_cmd(struct psmouse *psmouse, unsigned char c,
unsigned char *param)
{
struct ps2dev *ps2dev = &psmouse->ps2dev;

if (ps2_command(ps2dev, NULL, ETP_PS2_CUSTOM_COMMAND) ||
ps2_command(ps2dev, NULL, c) ||
ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO)) {
psmouse_err(psmouse, "%s query 0x%02x failed.\n", __func__, c);
return -1;
}

return 0;
}

/*
* A retrying version of ps2_command
*/
Expand Down Expand Up @@ -863,13 +881,13 @@ static int elantech_set_range(struct psmouse *psmouse,
i = (etd->fw_version > 0x020800 &&
etd->fw_version < 0x020900) ? 1 : 2;

if (synaptics_send_cmd(psmouse, ETP_FW_ID_QUERY, param))
if (etd->send_cmd(psmouse, ETP_FW_ID_QUERY, param))
return -1;

fixed_dpi = param[1] & 0x10;

if (((etd->fw_version >> 16) == 0x14) && fixed_dpi) {
if (synaptics_send_cmd(psmouse, ETP_SAMPLE_QUERY, param))
if (etd->send_cmd(psmouse, ETP_SAMPLE_QUERY, param))
return -1;

*x_max = (etd->capabilities[1] - i) * param[1] / 2;
Expand All @@ -888,15 +906,15 @@ static int elantech_set_range(struct psmouse *psmouse,
break;

case 3:
if (synaptics_send_cmd(psmouse, ETP_FW_ID_QUERY, param))
if (etd->send_cmd(psmouse, ETP_FW_ID_QUERY, param))
return -1;

*x_max = (0x0f & param[0]) << 8 | param[1];
*y_max = (0xf0 & param[0]) << 4 | param[2];
break;

case 4:
if (synaptics_send_cmd(psmouse, ETP_FW_ID_QUERY, param))
if (etd->send_cmd(psmouse, ETP_FW_ID_QUERY, param))
return -1;

*x_max = (0x0f & param[0]) << 8 | param[1];
Expand Down Expand Up @@ -1220,9 +1238,11 @@ static int elantech_set_properties(struct elantech_data *etd)
else
return -1;

/*
* Turn on packet checking by default.
*/
/* decide which send_cmd we're gonna use early */
etd->send_cmd = etd->hw_version >= 3 ? elantech_send_cmd :
synaptics_send_cmd;

/* Turn on packet checking by default */
etd->paritycheck = 1;

/*
Expand Down Expand Up @@ -1278,7 +1298,7 @@ int elantech_init(struct psmouse *psmouse)
"assuming hardware version %d (with firmware version 0x%02x%02x%02x)\n",
etd->hw_version, param[0], param[1], param[2]);

if (synaptics_send_cmd(psmouse, ETP_CAPABILITIES_QUERY,
if (etd->send_cmd(psmouse, ETP_CAPABILITIES_QUERY,
etd->capabilities)) {
psmouse_err(psmouse, "failed to query capabilities.\n");
goto init_fail;
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/input/mouse/elantech.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ struct elantech_data {
unsigned int width;
struct finger_pos mt[ETP_MAX_FINGERS];
unsigned char parity[256];
int (*send_cmd)(struct psmouse *psmouse, unsigned char c, unsigned char *param);
};

#ifdef CONFIG_MOUSE_PS2_ELANTECH
Expand Down

0 comments on commit bc899c2

Please sign in to comment.