Input: psmouse - move sliced command implementation to libps2

In preparation to adding some debugging statements to PS/2 control
sequences let's move psmouse_sliced_command() into libps2 and rename it
to ps2_sliced_command().

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
Dmitry Torokhov
2018-01-02 12:03:02 -08:00
parent 3a92dd331f
commit 08be954b7a
7 changed files with 46 additions and 38 deletions

View File

@@ -431,32 +431,6 @@ static irqreturn_t psmouse_interrupt(struct serio *serio,
return IRQ_HANDLED;
}
/*
* psmouse_sliced_command() sends an extended PS/2 command to the mouse
* using sliced syntax, understood by advanced devices, such as Logitech
* or Synaptics touchpads. The command is encoded as:
* 0xE6 0xE8 rr 0xE8 ss 0xE8 tt 0xE8 uu where (rr*64)+(ss*16)+(tt*4)+uu
* is the command.
*/
int psmouse_sliced_command(struct psmouse *psmouse, u8 command)
{
int i;
int error;
error = ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11);
if (error)
return error;
for (i = 6; i >= 0; i -= 2) {
u8 d = (command >> i) & 3;
error = ps2_command(&psmouse->ps2dev, &d, PSMOUSE_CMD_SETRES);
if (error)
return error;
}
return 0;
}
/*
* psmouse_reset() resets the mouse into power-on state.
*/