aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
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
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')
-rw-r--r--drivers/input/mouse/synaptics.c35
-rw-r--r--drivers/input/mouse/synaptics.h4
2 files changed, 34 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
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index f0f40a331dc8..ae37c5d162a4 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -18,6 +18,7 @@
18#define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07 18#define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07
19#define SYN_QUE_RESOLUTION 0x08 19#define SYN_QUE_RESOLUTION 0x08
20#define SYN_QUE_EXT_CAPAB 0x09 20#define SYN_QUE_EXT_CAPAB 0x09
21#define SYN_QUE_EXT_CAPAB_0C 0x0c
21 22
22/* synatics modes */ 23/* synatics modes */
23#define SYN_BIT_ABSOLUTE_MODE (1 << 7) 24#define SYN_BIT_ABSOLUTE_MODE (1 << 7)
@@ -48,6 +49,8 @@
48#define SYN_CAP_VALID(c) ((((c) & 0x00ff00) >> 8) == 0x47) 49#define SYN_CAP_VALID(c) ((((c) & 0x00ff00) >> 8) == 0x47)
49#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) 50#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20)
50#define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) 51#define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12)
52#define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16)
53#define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100100)
51 54
52/* synaptics modes query bits */ 55/* synaptics modes query bits */
53#define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) 56#define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7))
@@ -96,6 +99,7 @@ struct synaptics_data {
96 unsigned long int model_id; /* Model-ID */ 99 unsigned long int model_id; /* Model-ID */
97 unsigned long int capabilities; /* Capabilities */ 100 unsigned long int capabilities; /* Capabilities */
98 unsigned long int ext_cap; /* Extended Capabilities */ 101 unsigned long int ext_cap; /* Extended Capabilities */
102 unsigned long int ext_cap_0c; /* Ext Caps from 0x0c query */
99 unsigned long int identity; /* Identification */ 103 unsigned long int identity; /* Identification */
100 int x_res; /* X resolution in units/mm */ 104 int x_res; /* X resolution in units/mm */
101 int y_res; /* Y resolution in units/mm */ 105 int y_res; /* Y resolution in units/mm */