aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/synaptics.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-04-19 13:37:21 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-04-20 03:42:40 -0400
commit5f57d67da87332a9a1ba8fa7a33bf0680e1c76e7 (patch)
tree73e0fc85b06daada963ab14d0ae33681edfd9b20 /drivers/input/mouse/synaptics.c
parent6d327cb03fbc64cac36571c9bc8a1576d2b3ea00 (diff)
Input: Add support of Synaptics Clickpad device
The new type of touchpads can be detected via a new query command 0x0c. The clickpad flags are in cap[0]:4 and cap[1]:0 bits. When the device is detected, the driver now reports only the left button as the supported buttons so that X11 driver can detect that the device is Clickpad. A Clickpad device gives the button events only as the middle button. The kernel driver morphs to the left button. The real handling of Clickpad is done rather in X driver side. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse/synaptics.c')
-rw-r--r--drivers/input/mouse/synaptics.c35
1 files changed, 30 insertions, 5 deletions
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index d3f5243fa093..9ab9ff072320 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -136,7 +136,8 @@ static int synaptics_capability(struct psmouse *psmouse)
136 if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap)) 136 if (synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, cap))
137 return -1; 137 return -1;
138 priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2]; 138 priv->capabilities = (cap[0] << 16) | (cap[1] << 8) | cap[2];
139 priv->ext_cap = 0; 139 priv->ext_cap = priv->ext_cap_0c = 0;
140
140 if (!SYN_CAP_VALID(priv->capabilities)) 141 if (!SYN_CAP_VALID(priv->capabilities))
141 return -1; 142 return -1;
142 143
@@ -149,7 +150,7 @@ static int synaptics_capability(struct psmouse *psmouse)
149 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) { 150 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 1) {
150 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) { 151 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB, cap)) {
151 printk(KERN_ERR "Synaptics claims to have extended capabilities," 152 printk(KERN_ERR "Synaptics claims to have extended capabilities,"
152 " but I'm not able to read them."); 153 " but I'm not able to read them.\n");
153 } else { 154 } else {
154 priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2]; 155 priv->ext_cap = (cap[0] << 16) | (cap[1] << 8) | cap[2];
155 156
@@ -161,6 +162,16 @@ static int synaptics_capability(struct psmouse *psmouse)
161 priv->ext_cap &= 0xff0fff; 162 priv->ext_cap &= 0xff0fff;
162 } 163 }
163 } 164 }
165
166 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 4) {
167 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_CAPAB_0C, cap)) {
168 printk(KERN_ERR "Synaptics claims to have extended capability 0x0c,"
169 " but I'm not able to read it.\n");
170 } else {
171 priv->ext_cap_0c = (cap[0] << 16) | (cap[1] << 8) | cap[2];
172 }
173 }
174
164 return 0; 175 return 0;
165} 176}
166 177
@@ -347,7 +358,15 @@ static void synaptics_parse_hw_state(unsigned char buf[], struct synaptics_data
347 hw->left = (buf[0] & 0x01) ? 1 : 0; 358 hw->left = (buf[0] & 0x01) ? 1 : 0;
348 hw->right = (buf[0] & 0x02) ? 1 : 0; 359 hw->right = (buf[0] & 0x02) ? 1 : 0;
349 360
350 if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) { 361 if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
362 /*
363 * Clickpad's button is transmitted as middle button,
364 * however, since it is primary button, we will report
365 * it as BTN_LEFT.
366 */
367 hw->left = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0;
368
369 } else if (SYN_CAP_MIDDLE_BUTTON(priv->capabilities)) {
351 hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0; 370 hw->middle = ((buf[0] ^ buf[3]) & 0x01) ? 1 : 0;
352 if (hw->w == 2) 371 if (hw->w == 2)
353 hw->scroll = (signed char)(buf[1]); 372 hw->scroll = (signed char)(buf[1]);
@@ -592,6 +611,12 @@ static void set_input_params(struct input_dev *dev, struct synaptics_data *priv)
592 611
593 dev->absres[ABS_X] = priv->x_res; 612 dev->absres[ABS_X] = priv->x_res;
594 dev->absres[ABS_Y] = priv->y_res; 613 dev->absres[ABS_Y] = priv->y_res;
614
615 if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
616 /* Clickpads report only left button */
617 __clear_bit(BTN_RIGHT, dev->keybit);
618 __clear_bit(BTN_MIDDLE, dev->keybit);
619 }
595} 620}
596 621
597static void synaptics_disconnect(struct psmouse *psmouse) 622static void synaptics_disconnect(struct psmouse *psmouse)
@@ -696,10 +721,10 @@ int synaptics_init(struct psmouse *psmouse)
696 721
697 priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; 722 priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS;
698 723
699 printk(KERN_INFO "Synaptics Touchpad, model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx\n", 724 printk(KERN_INFO "Synaptics Touchpad, model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx\n",
700 SYN_ID_MODEL(priv->identity), 725 SYN_ID_MODEL(priv->identity),
701 SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), 726 SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity),
702 priv->model_id, priv->capabilities, priv->ext_cap); 727 priv->model_id, priv->capabilities, priv->ext_cap, priv->ext_cap_0c);
703 728
704 set_input_params(psmouse->dev, priv); 729 set_input_params(psmouse->dev, priv);
705 730