diff options
Diffstat (limited to 'drivers/input/mouse/synaptics.c')
-rw-r--r-- | drivers/input/mouse/synaptics.c | 88 |
1 files changed, 64 insertions, 24 deletions
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 026df601016..40cea334ad1 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -36,6 +36,8 @@ | |||
36 | * The x/y limits are taken from the Synaptics TouchPad interfacing Guide, | 36 | * The x/y limits are taken from the Synaptics TouchPad interfacing Guide, |
37 | * section 2.3.2, which says that they should be valid regardless of the | 37 | * section 2.3.2, which says that they should be valid regardless of the |
38 | * actual size of the sensor. | 38 | * actual size of the sensor. |
39 | * Note that newer firmware allows querying device for maximum useable | ||
40 | * coordinates. | ||
39 | */ | 41 | */ |
40 | #define XMIN_NOMINAL 1472 | 42 | #define XMIN_NOMINAL 1472 |
41 | #define XMAX_NOMINAL 5472 | 43 | #define XMAX_NOMINAL 5472 |
@@ -137,7 +139,8 @@ static int synaptics_capability(struct psmouse *psmouse) | |||
137 | if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap)) | 139 | if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap)) |
138 | return -1; | 140 | return -1; |
139 | priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2]; | 141 | priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2]; |
140 | priv->ext_cap = 0; | 142 | priv->ext_cap = priv->ext_cap_0c = 0; |
143 | |||
141 | if (!SYN_CAP_VALID(priv->capabilities)) | 144 | if (!SYN_CAP_VALID(priv->capabilities)) |
142 | return -1; | 145 | return -1; |
143 | 146 | ||
@@ -150,7 +153,7 @@ static int synaptics_capability(struct psmouse *psmouse) | |||
150 | if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) { | 153 | if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) { |
151 | if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) { | 154 | if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) { |
152 | printk(KERN_ERR "Synaptics claims to have extended capabilities," | 155 | printk(KERN_ERR "Synaptics claims to have extended capabilities," |
153 | " but I'm not able to read them."); | 156 | " but I'm not able to read them.\n"); |
154 | } else { | 157 | } else { |
155 | priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2]; | 158 | priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2]; |
156 | 159 | ||
@@ -162,6 +165,16 @@ static int synaptics_capability(struct psmouse *psmouse) | |||
162 | priv->ext_cap &= 0xff0fff; | 165 | priv->ext_cap &= 0xff0fff; |
163 | } | 166 | } |
164 | } | 167 | } |
168 | |||
169 | if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 4) { | ||
170 | if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB_0C, cap)) { | ||
171 | printk(KERN_ERR "Synaptics claims to have extended capability 0x0c," | ||
172 | " but I'm not able to read it.\n"); | ||
173 | } else { | ||
174 | priv->ext_cap_0c = (cap[0] << 16) | (cap[1] << 8) | cap[2]; | ||
175 | } | ||
176 | } | ||
177 | |||
165 | return 0; | 178 | return 0; |
166 | } | 179 | } |
167 | 180 | ||
@@ -183,23 +196,33 @@ static int synaptics_identify(struct psmouse *psmouse) | |||
183 | } | 196 | } |
184 | 197 | ||
185 | /* | 198 | /* |
186 | * Read touchpad resolution | 199 | * Read touchpad resolution and maximum reported coordinates |
187 | * Resolution is left zero if touchpad does not support the query | 200 | * Resolution is left zero if touchpad does not support the query |
188 | */ | 201 | */ |
189 | static int synaptics_resolution(struct psmouse *psmouse) | 202 | static int synaptics_resolution(struct psmouse *psmouse) |
190 | { | 203 | { |
191 | struct synaptics_data *priv = psmouse->private; | 204 | struct synaptics_data *priv = psmouse->private; |
192 | unsigned char res[3]; | 205 | unsigned char res[3]; |
206 | unsigned char max[3]; | ||
193 | 207 | ||
194 | if (SYN_ID_MAJOR(priv->identity) < 4) | 208 | if (SYN_ID_MAJOR(priv->identity) < 4) |
195 | return 0; | ||
196 | 209 | ||
197 | if (synaptics_send_cmd(psmouse, SYN_QUE_RESOLUTION, res)) | 210 | if (synaptics_send_cmd(psmouse, SYN_QUE_RESOLUTION, res) == 0) { |
198 | return 0; | 211 | if (res[0] != 0 && (res[1] & 0x80) && res[2] != 0) { |
212 | priv->x_res = res[0]; /* x resolution in units/mm */ | ||
213 | priv->y_res = res[2]; /* y resolution in units/mm */ | ||
214 | } | ||
215 | } | ||
199 | 216 | ||
200 | if ((res[0] != 0) && (res[1] & 0x80) && (res[2] != 0)) { | 217 | if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 && |
201 | priv->x_res = res[0]; /* x resolution in units/mm */ | 218 | SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) { |
202 | priv->y_res = res[2]; /* y resolution in units/mm */ | 219 | if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_DIMENSIONS, max)) { |
220 | printk(KERN_ERR "Synaptics claims to have dimensions query," | ||
221 | " but I'm not able to read it.\n"); | ||
222 | } else { | ||
223 | priv->x_max = (max[0] << 5) | ((max[1] & 0x0f) << 1); | ||
224 | priv->y_max = (max[2] << 5) | ((max[1] & 0xf0) >> 3); | ||
225 | } | ||
203 | } | 226 | } |
204 | 227 | ||
205 | return 0; | 228 | return 0; |
@@ -348,7 +371,15 @@ static void synaptics_parse_hw_state(unsigned char buf[], struct synaptics_data | |||
348 | hw->left = (buf[0] & 0x01) ? 1 : 0; | 371 | hw->left = (buf[0] & 0x01) ? 1 : 0; |
349 | hw->right = (buf[0] & 0x02) ? 1 : 0; | 372 | hw->right = (buf[0] & 0x02) ? 1 : 0; |
350 | 373 | ||
351 | if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) { | 374 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { |
375 | /* | ||
376 | * Clickpad's button is transmitted as middle button, | ||
377 | * however, since it is primary button, we will report | ||
378 | * it as BTN_LEFT. | ||
379 | */ | ||
380 | hw->left = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; | ||
381 | |||
382 | } else if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) { | ||
352 | hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; | 383 | hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; |
353 | if (hw->w == 2) | 384 | if (hw->w == 2) |
354 | hw->scroll = (signed char)(buf[1]); | 385 | hw->scroll = (signed char)(buf[1]); |
@@ -501,19 +532,20 @@ static int synaptics_validate_byte(unsigned char packet[], int idx, unsigned cha | |||
501 | return 0; | 532 | return 0; |
502 | 533 | ||
503 | switch (pkt_type) { | 534 | switch (pkt_type) { |
504 | case SYN_NEWABS: | ||
505 | case SYN_NEWABS_RELAXED: | ||
506 | return (packet[idx] & newabs_rel_mask[idx]) == newabs_rslt[idx]; | ||
507 | 535 | ||
508 | case SYN_NEWABS_STRICT: | 536 | case SYN_NEWABS: |
509 | return (packet[idx] & newabs_mask[idx]) == newabs_rslt[idx]; | 537 | case SYN_NEWABS_RELAXED: |
538 | return (packet[idx] & newabs_rel_mask[idx]) == newabs_rslt[idx]; | ||
510 | 539 | ||
511 | case SYN_OLDABS: | 540 | case SYN_NEWABS_STRICT: |
512 | return (packet[idx] & oldabs_mask[idx]) == oldabs_rslt[idx]; | 541 | return (packet[idx] & newabs_mask[idx]) == newabs_rslt[idx]; |
513 | 542 | ||
514 | default: | 543 | case SYN_OLDABS: |
515 | printk(KERN_ERR "synaptics: unknown packet type %d\n", pkt_type); | 544 | return (packet[idx] & oldabs_mask[idx]) == oldabs_rslt[idx]; |
516 | return 0; | 545 | |
546 | default: | ||
547 | printk(KERN_ERR "synaptics: unknown packet type %d\n", pkt_type); | ||
548 | return 0; | ||
517 | } | 549 | } |
518 | } | 550 | } |
519 | 551 | ||
@@ -559,8 +591,10 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) | |||
559 | int i; | 591 | int i; |
560 | 592 | ||
561 | __set_bit(EV_ABS, dev->evbit); | 593 | __set_bit(EV_ABS, dev->evbit); |
562 | input_set_abs_params(dev, ABS_X, XMIN_NOMINAL, XMAX_NOMINAL, 0, 0); | 594 | input_set_abs_params(dev, ABS_X, |
563 | input_set_abs_params(dev, ABS_Y, YMIN_NOMINAL, YMAX_NOMINAL, 0, 0); | 595 | XMIN_NOMINAL, priv->x_max ?: XMAX_NOMINAL, 0, 0); |
596 | input_set_abs_params(dev, ABS_Y, | ||
597 | YMIN_NOMINAL, priv->y_max ?: YMAX_NOMINAL, 0, 0); | ||
564 | input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); | 598 | input_set_abs_params(dev, ABS_PRESSURE, 0, 255, 0, 0); |
565 | __set_bit(ABS_TOOL_WIDTH, dev->absbit); | 599 | __set_bit(ABS_TOOL_WIDTH, dev->absbit); |
566 | 600 | ||
@@ -593,6 +627,12 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv) | |||
593 | 627 | ||
594 | dev->absres[ABS_X] = priv->x_res; | 628 | dev->absres[ABS_X] = priv->x_res; |
595 | dev->absres[ABS_Y] = priv->y_res; | 629 | dev->absres[ABS_Y] = priv->y_res; |
630 | |||
631 | if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { | ||
632 | /* Clickpads report only left button */ | ||
633 | __clear_bit(BTN_RIGHT, dev->keybit); | ||
634 | __clear_bit(BTN_MIDDLE, dev->keybit); | ||
635 | } | ||
596 | } | 636 | } |
597 | 637 | ||
598 | static void synaptics_disconnect(struct psmouse *psmouse) | 638 | static void synaptics_disconnect(struct psmouse *psmouse) |
@@ -697,10 +737,10 @@ int synaptics_init(struct psmouse *psmouse) | |||
697 | 737 | ||
698 | priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; | 738 | priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; |
699 | 739 | ||
700 | printk(KERN_INFO "Synaptics Touchpad, model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx\n", | 740 | printk(KERN_INFO "Synaptics Touchpad, model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx\n", |
701 | SYN_ID_MODEL(priv->identity), | 741 | SYN_ID_MODEL(priv->identity), |
702 | SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), | 742 | SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), |
703 | priv->model_id, priv->capabilities, priv->ext_cap); | 743 | priv->model_id, priv->capabilities, priv->ext_cap, priv->ext_cap_0c); |
704 | 744 | ||
705 | set_input_params(psmouse->dev, priv); | 745 | set_input_params(psmouse->dev, priv); |
706 | 746 | ||