From: Dmitry Torokhov <dtor_core@ameritech.net>
Date: Sun, 29 May 2005 07:30:37 +0000 (-0500)
Subject: Input: apparently Lifebook touchscreens have double resolution
X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a913829e90e2af7a6e98f5aadcc9fec4dcf1ef64;p=linux.git

Input: apparently Lifebook touchscreens have double resolution
       compared to "classic" PS/2 mice, provide appropriate
       resolution setting handler.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---

diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index 1eb98e18c9e7e..bd9df9b283259 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -82,6 +82,17 @@ static int lifebook_absolute_mode(struct psmouse *psmouse)
 	return 0;
 }
 
+static void lifebook_set_resolution(struct psmouse *psmouse, unsigned int resolution)
+{
+	unsigned char params[] = { 0, 1, 2, 2, 3 };
+
+	if (resolution == 0 || resolution > 400)
+		resolution = 400;
+
+	ps2_command(&psmouse->ps2dev, &params[resolution / 100], PSMOUSE_CMD_SETRES);
+	psmouse->resolution = 50 << params[resolution / 100];
+}
+
 static void lifebook_disconnect(struct psmouse *psmouse)
 {
 	psmouse_reset(psmouse);
@@ -113,6 +124,7 @@ int lifebook_init(struct psmouse *psmouse)
 	input_set_abs_params(&psmouse->dev, ABS_Y, 0, 1024, 0, 0);
 
 	psmouse->protocol_handler = lifebook_process_byte;
+	psmouse->set_resolution = lifebook_set_resolution;
 	psmouse->disconnect = lifebook_disconnect;
 	psmouse->reconnect  = lifebook_absolute_mode;
 	psmouse->pktsize = 3;