aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/lifebook.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-05-29 03:30:28 -0400
committerDmitry Torokhov <dtor_core@ameritech.net>2005-05-29 03:30:28 -0400
commit14e94143964d5af6d0a2ae8401cd9e9e091967b9 (patch)
tree197dc3833a27a6af4f5d33f29ba86221cbf01792 /drivers/input/mouse/lifebook.c
parent02d7f5895005bd559c6c12d0f1b4e3dd5d91b927 (diff)
Input: lifebook - various cleanups:
- do not try to set rate and resolution in init method, let psmouse core do it for us. This also removes special quirks from the core; - do not disable mouse before doing full reset - meaningless; - some formatting and whitespace cleanups. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse/lifebook.c')
-rw-r--r--drivers/input/mouse/lifebook.c37
1 files changed, 12 insertions, 25 deletions
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index 5b8883857b80..a5a1fb3f794b 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -20,12 +20,9 @@
20#include "psmouse.h" 20#include "psmouse.h"
21#include "lifebook.h" 21#include "lifebook.h"
22 22
23static int max_y = 1024;
24
25
26static struct dmi_system_id lifebook_dmi_table[] = { 23static struct dmi_system_id lifebook_dmi_table[] = {
27 { 24 {
28 .ident = "Fujitsu Siemens Lifebook B-Sereis", 25 .ident = "Lifebook B",
29 .matches = { 26 .matches = {
30 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"), 27 DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"),
31 }, 28 },
@@ -39,7 +36,7 @@ static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse, struct pt_re
39 unsigned char *packet = psmouse->packet; 36 unsigned char *packet = psmouse->packet;
40 struct input_dev *dev = &psmouse->dev; 37 struct input_dev *dev = &psmouse->dev;
41 38
42 if ( psmouse->pktcnt != 3 ) 39 if (psmouse->pktcnt != 3)
43 return PSMOUSE_GOOD_DATA; 40 return PSMOUSE_GOOD_DATA;
44 41
45 input_regs(dev, regs); 42 input_regs(dev, regs);
@@ -49,12 +46,12 @@ static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse, struct pt_re
49 input_report_abs(dev, ABS_X, 46 input_report_abs(dev, ABS_X,
50 (packet[1] | ((packet[0] & 0x30) << 4))); 47 (packet[1] | ((packet[0] & 0x30) << 4)));
51 input_report_abs(dev, ABS_Y, 48 input_report_abs(dev, ABS_Y,
52 max_y - (packet[2] | ((packet[0] & 0xC0) << 2))); 49 1024 - (packet[2] | ((packet[0] & 0xC0) << 2)));
53 } else { 50 } else {
54 input_report_rel(dev, REL_X, 51 input_report_rel(dev, REL_X,
55 ((packet[0] & 0x10) ? packet[1]-256 : packet[1])); 52 ((packet[0] & 0x10) ? packet[1] - 256 : packet[1]));
56 input_report_rel(dev, REL_Y, 53 input_report_rel(dev, REL_Y,
57 (- (int)((packet[0] & 0x20) ? packet[2]-256 : packet[2]))); 54 -(int)((packet[0] & 0x20) ? packet[2] - 256 : packet[2]));
58 } 55 }
59 56
60 input_report_key(dev, BTN_LEFT, packet[0] & 0x01); 57 input_report_key(dev, BTN_LEFT, packet[0] & 0x01);
@@ -71,26 +68,17 @@ static int lifebook_initialize(struct psmouse *psmouse)
71 struct ps2dev *ps2dev = &psmouse->ps2dev; 68 struct ps2dev *ps2dev = &psmouse->ps2dev;
72 unsigned char param; 69 unsigned char param;
73 70
74 if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE)) 71 if (psmouse_reset(psmouse))
75 return -1;
76
77 if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_BAT))
78 return -1; 72 return -1;
79 73
80 /* 74 /*
81 Enable absolute output -- ps2_command fails always but if 75 Enable absolute output -- ps2_command fails always but if
82 you leave this call out the touchsreen will never send 76 you leave this call out the touchsreen will never send
83 absolute coordinates 77 absolute coordinates
84 */ 78 */
85 param = 0x07; 79 param = 0x07;
86 ps2_command(ps2dev, &param, PSMOUSE_CMD_SETRES); 80 ps2_command(ps2dev, &param, PSMOUSE_CMD_SETRES);
87 81
88 psmouse->set_rate(psmouse, psmouse->rate);
89 psmouse->set_resolution(psmouse, psmouse->resolution);
90
91 if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE))
92 return -1;
93
94 return 0; 82 return 0;
95} 83}
96 84
@@ -99,11 +87,10 @@ static void lifebook_disconnect(struct psmouse *psmouse)
99 psmouse_reset(psmouse); 87 psmouse_reset(psmouse);
100} 88}
101 89
102int lifebook_detect(struct psmouse *psmouse, unsigned int max_proto, 90int lifebook_detect(struct psmouse *psmouse, unsigned int max_proto,
103 int set_properties) 91 int set_properties)
104{ 92{
105 if (!dmi_check_system(lifebook_dmi_table) && 93 if (!dmi_check_system(lifebook_dmi_table) && max_proto != PSMOUSE_LIFEBOOK)
106 (max_proto != PSMOUSE_LIFEBOOK) )
107 return -1; 94 return -1;
108 95
109 if (set_properties) { 96 if (set_properties) {