aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2015-03-16 12:12:56 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-03-16 12:12:56 -0400
commit6067fe5e0bf29f525561c8281d01011cfc9ebbd4 (patch)
tree1bd13d4964140130ca28c995c7dc1196ac1f24e4
parent4eb8d6e7e5aa14572bc389e554aad9869188cdcd (diff)
parent8f004f3f4daf5dc98dc78f8e62497ad834053855 (diff)
Merge branch 'synaptics' into for-linus
Bring in changes needed to properly handle Lenovo 2015 lineup.
-rw-r--r--drivers/input/mouse/synaptics.c207
-rw-r--r--drivers/input/mouse/synaptics.h28
2 files changed, 184 insertions, 51 deletions
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index f2cceb6493a0..c74bfa1c05e3 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -123,32 +123,41 @@ void synaptics_reset(struct psmouse *psmouse)
123 123
124static bool cr48_profile_sensor; 124static bool cr48_profile_sensor;
125 125
126#define ANY_BOARD_ID 0
126struct min_max_quirk { 127struct min_max_quirk {
127 const char * const *pnp_ids; 128 const char * const *pnp_ids;
129 struct {
130 unsigned long int min, max;
131 } board_id;
128 int x_min, x_max, y_min, y_max; 132 int x_min, x_max, y_min, y_max;
129}; 133};
130 134
131static const struct min_max_quirk min_max_pnpid_table[] = { 135static const struct min_max_quirk min_max_pnpid_table[] = {
132 { 136 {
133 (const char * const []){"LEN0033", NULL}, 137 (const char * const []){"LEN0033", NULL},
138 {ANY_BOARD_ID, ANY_BOARD_ID},
134 1024, 5052, 2258, 4832 139 1024, 5052, 2258, 4832
135 }, 140 },
136 { 141 {
137 (const char * const []){"LEN0035", "LEN0042", NULL}, 142 (const char * const []){"LEN0042", NULL},
143 {ANY_BOARD_ID, ANY_BOARD_ID},
138 1232, 5710, 1156, 4696 144 1232, 5710, 1156, 4696
139 }, 145 },
140 { 146 {
141 (const char * const []){"LEN0034", "LEN0036", "LEN0037", 147 (const char * const []){"LEN0034", "LEN0036", "LEN0037",
142 "LEN0039", "LEN2002", "LEN2004", 148 "LEN0039", "LEN2002", "LEN2004",
143 NULL}, 149 NULL},
150 {ANY_BOARD_ID, 2961},
144 1024, 5112, 2024, 4832 151 1024, 5112, 2024, 4832
145 }, 152 },
146 { 153 {
147 (const char * const []){"LEN2001", NULL}, 154 (const char * const []){"LEN2001", NULL},
155 {ANY_BOARD_ID, ANY_BOARD_ID},
148 1024, 5022, 2508, 4832 156 1024, 5022, 2508, 4832
149 }, 157 },
150 { 158 {
151 (const char * const []){"LEN2006", NULL}, 159 (const char * const []){"LEN2006", NULL},
160 {ANY_BOARD_ID, ANY_BOARD_ID},
152 1264, 5675, 1171, 4688 161 1264, 5675, 1171, 4688
153 }, 162 },
154 { } 163 { }
@@ -175,9 +184,7 @@ static const char * const topbuttonpad_pnp_ids[] = {
175 "LEN0041", 184 "LEN0041",
176 "LEN0042", /* Yoga */ 185 "LEN0042", /* Yoga */
177 "LEN0045", 186 "LEN0045",
178 "LEN0046",
179 "LEN0047", 187 "LEN0047",
180 "LEN0048",
181 "LEN0049", 188 "LEN0049",
182 "LEN2000", 189 "LEN2000",
183 "LEN2001", /* Edge E431 */ 190 "LEN2001", /* Edge E431 */
@@ -235,18 +242,39 @@ static int synaptics_model_id(struct psmouse *psmouse)
235 return 0; 242 return 0;
236} 243}
237 244
245static int synaptics_more_extended_queries(struct psmouse *psmouse)
246{
247 struct synaptics_data *priv = psmouse->private;
248 unsigned char buf[3];
249
250 if (synaptics_send_cmd(psmouse, SYN_QUE_MEXT_CAPAB_10, buf))
251 return -1;
252
253 priv->ext_cap_10 = (buf[0]<<16) | (buf[1]<<8) | buf[2];
254
255 return 0;
256}
257
238/* 258/*
239 * Read the board id from the touchpad 259 * Read the board id and the "More Extended Queries" from the touchpad
240 * The board id is encoded in the "QUERY MODES" response 260 * The board id is encoded in the "QUERY MODES" response
241 */ 261 */
242static int synaptics_board_id(struct psmouse *psmouse) 262static int synaptics_query_modes(struct psmouse *psmouse)
243{ 263{
244 struct synaptics_data *priv = psmouse->private; 264 struct synaptics_data *priv = psmouse->private;
245 unsigned char bid[3]; 265 unsigned char bid[3];
246 266
267 /* firmwares prior 7.5 have no board_id encoded */
268 if (SYN_ID_FULL(priv->identity) < 0x705)
269 return 0;
270
247 if (synaptics_send_cmd(psmouse, SYN_QUE_MODES, bid)) 271 if (synaptics_send_cmd(psmouse, SYN_QUE_MODES, bid))
248 return -1; 272 return -1;
249 priv->board_id = ((bid[0] & 0xfc) << 6) | bid[1]; 273 priv->board_id = ((bid[0] & 0xfc) << 6) | bid[1];
274
275 if (SYN_MEXT_CAP_BIT(bid[0]))
276 return synaptics_more_extended_queries(psmouse);
277
250 return 0; 278 return 0;
251} 279}
252 280
@@ -346,7 +374,6 @@ static int synaptics_resolution(struct psmouse *psmouse)
346{ 374{
347 struct synaptics_data *priv = psmouse->private; 375 struct synaptics_data *priv = psmouse->private;
348 unsigned char resp[3]; 376 unsigned char resp[3];
349 int i;
350 377
351 if (SYN_ID_MAJOR(priv->identity) < 4) 378 if (SYN_ID_MAJOR(priv->identity) < 4)
352 return 0; 379 return 0;
@@ -358,17 +385,6 @@ static int synaptics_resolution(struct psmouse *psmouse)
358 } 385 }
359 } 386 }
360 387
361 for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
362 if (psmouse_matches_pnp_id(psmouse,
363 min_max_pnpid_table[i].pnp_ids)) {
364 priv->x_min = min_max_pnpid_table[i].x_min;
365 priv->x_max = min_max_pnpid_table[i].x_max;
366 priv->y_min = min_max_pnpid_table[i].y_min;
367 priv->y_max = min_max_pnpid_table[i].y_max;
368 return 0;
369 }
370 }
371
372 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 && 388 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 5 &&
373 SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) { 389 SYN_CAP_MAX_DIMENSIONS(priv->ext_cap_0c)) {
374 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) { 390 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MAX_COORDS, resp)) {
@@ -377,23 +393,69 @@ static int synaptics_resolution(struct psmouse *psmouse)
377 } else { 393 } else {
378 priv->x_max = (resp[0] << 5) | ((resp[1] & 0x0f) << 1); 394 priv->x_max = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
379 priv->y_max = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3); 395 priv->y_max = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
396 psmouse_info(psmouse,
397 "queried max coordinates: x [..%d], y [..%d]\n",
398 priv->x_max, priv->y_max);
380 } 399 }
381 } 400 }
382 401
383 if (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 && 402 if (SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c) &&
384 SYN_CAP_MIN_DIMENSIONS(priv->ext_cap_0c)) { 403 (SYN_EXT_CAP_REQUESTS(priv->capabilities) >= 7 ||
404 /*
405 * Firmware v8.1 does not report proper number of extended
406 * capabilities, but has been proven to report correct min
407 * coordinates.
408 */
409 SYN_ID_FULL(priv->identity) == 0x801)) {
385 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MIN_COORDS, resp)) { 410 if (synaptics_send_cmd(psmouse, SYN_QUE_EXT_MIN_COORDS, resp)) {
386 psmouse_warn(psmouse, 411 psmouse_warn(psmouse,
387 "device claims to have min coordinates query, but I'm not able to read it.\n"); 412 "device claims to have min coordinates query, but I'm not able to read it.\n");
388 } else { 413 } else {
389 priv->x_min = (resp[0] << 5) | ((resp[1] & 0x0f) << 1); 414 priv->x_min = (resp[0] << 5) | ((resp[1] & 0x0f) << 1);
390 priv->y_min = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3); 415 priv->y_min = (resp[2] << 5) | ((resp[1] & 0xf0) >> 3);
416 psmouse_info(psmouse,
417 "queried min coordinates: x [%d..], y [%d..]\n",
418 priv->x_min, priv->y_min);
391 } 419 }
392 } 420 }
393 421
394 return 0; 422 return 0;
395} 423}
396 424
425/*
426 * Apply quirk(s) if the hardware matches
427 */
428
429static void synaptics_apply_quirks(struct psmouse *psmouse)
430{
431 struct synaptics_data *priv = psmouse->private;
432 int i;
433
434 for (i = 0; min_max_pnpid_table[i].pnp_ids; i++) {
435 if (!psmouse_matches_pnp_id(psmouse,
436 min_max_pnpid_table[i].pnp_ids))
437 continue;
438
439 if (min_max_pnpid_table[i].board_id.min != ANY_BOARD_ID &&
440 priv->board_id < min_max_pnpid_table[i].board_id.min)
441 continue;
442
443 if (min_max_pnpid_table[i].board_id.max != ANY_BOARD_ID &&
444 priv->board_id > min_max_pnpid_table[i].board_id.max)
445 continue;
446
447 priv->x_min = min_max_pnpid_table[i].x_min;
448 priv->x_max = min_max_pnpid_table[i].x_max;
449 priv->y_min = min_max_pnpid_table[i].y_min;
450 priv->y_max = min_max_pnpid_table[i].y_max;
451 psmouse_info(psmouse,
452 "quirked min/max coordinates: x [%d..%d], y [%d..%d]\n",
453 priv->x_min, priv->x_max,
454 priv->y_min, priv->y_max);
455 break;
456 }
457}
458
397static int synaptics_query_hardware(struct psmouse *psmouse) 459static int synaptics_query_hardware(struct psmouse *psmouse)
398{ 460{
399 if (synaptics_identify(psmouse)) 461 if (synaptics_identify(psmouse))
@@ -402,13 +464,15 @@ static int synaptics_query_hardware(struct psmouse *psmouse)
402 return -1; 464 return -1;
403 if (synaptics_firmware_id(psmouse)) 465 if (synaptics_firmware_id(psmouse))
404 return -1; 466 return -1;
405 if (synaptics_board_id(psmouse)) 467 if (synaptics_query_modes(psmouse))
406 return -1; 468 return -1;
407 if (synaptics_capability(psmouse)) 469 if (synaptics_capability(psmouse))
408 return -1; 470 return -1;
409 if (synaptics_resolution(psmouse)) 471 if (synaptics_resolution(psmouse))
410 return -1; 472 return -1;
411 473
474 synaptics_apply_quirks(psmouse);
475
412 return 0; 476 return 0;
413} 477}
414 478
@@ -516,18 +580,22 @@ static int synaptics_is_pt_packet(unsigned char *buf)
516 return (buf[0] & 0xFC) == 0x84 && (buf[3] & 0xCC) == 0xC4; 580 return (buf[0] & 0xFC) == 0x84 && (buf[3] & 0xCC) == 0xC4;
517} 581}
518 582
519static void synaptics_pass_pt_packet(struct serio *ptport, unsigned char *packet) 583static void synaptics_pass_pt_packet(struct psmouse *psmouse,
584 struct serio *ptport,
585 unsigned char *packet)
520{ 586{
587 struct synaptics_data *priv = psmouse->private;
521 struct psmouse *child = serio_get_drvdata(ptport); 588 struct psmouse *child = serio_get_drvdata(ptport);
522 589
523 if (child && child->state == PSMOUSE_ACTIVATED) { 590 if (child && child->state == PSMOUSE_ACTIVATED) {
524 serio_interrupt(ptport, packet[1], 0); 591 serio_interrupt(ptport, packet[1] | priv->pt_buttons, 0);
525 serio_interrupt(ptport, packet[4], 0); 592 serio_interrupt(ptport, packet[4], 0);
526 serio_interrupt(ptport, packet[5], 0); 593 serio_interrupt(ptport, packet[5], 0);
527 if (child->pktsize == 4) 594 if (child->pktsize == 4)
528 serio_interrupt(ptport, packet[2], 0); 595 serio_interrupt(ptport, packet[2], 0);
529 } else 596 } else {
530 serio_interrupt(ptport, packet[1], 0); 597 serio_interrupt(ptport, packet[1], 0);
598 }
531} 599}
532 600
533static void synaptics_pt_activate(struct psmouse *psmouse) 601static void synaptics_pt_activate(struct psmouse *psmouse)
@@ -605,6 +673,18 @@ static void synaptics_parse_agm(const unsigned char buf[],
605 } 673 }
606} 674}
607 675
676static void synaptics_parse_ext_buttons(const unsigned char buf[],
677 struct synaptics_data *priv,
678 struct synaptics_hw_state *hw)
679{
680 unsigned int ext_bits =
681 (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1;
682 unsigned int ext_mask = GENMASK(ext_bits - 1, 0);
683
684 hw->ext_buttons = buf[4] & ext_mask;
685 hw->ext_buttons |= (buf[5] & ext_mask) << ext_bits;
686}
687
608static bool is_forcepad; 688static bool is_forcepad;
609 689
610static int synaptics_parse_hw_state(const unsigned char buf[], 690static int synaptics_parse_hw_state(const unsigned char buf[],
@@ -691,28 +771,9 @@ static int synaptics_parse_hw_state(const unsigned char buf[],
691 hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0; 771 hw->down = ((buf[0] ^ buf[3]) & 0x02) ? 1 : 0;
692 } 772 }
693 773
694 if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) && 774 if (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) > 0 &&
695 ((buf[0] ^ buf[3]) & 0x02)) { 775 ((buf[0] ^ buf[3]) & 0x02)) {
696 switch (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) & ~0x01) { 776 synaptics_parse_ext_buttons(buf, priv, hw);
697 default:
698 /*
699 * if nExtBtn is greater than 8 it should be
700 * considered invalid and treated as 0
701 */
702 break;
703 case 8:
704 hw->ext_buttons |= ((buf[5] & 0x08)) ? 0x80 : 0;
705 hw->ext_buttons |= ((buf[4] & 0x08)) ? 0x40 : 0;
706 case 6:
707 hw->ext_buttons |= ((buf[5] & 0x04)) ? 0x20 : 0;
708 hw->ext_buttons |= ((buf[4] & 0x04)) ? 0x10 : 0;
709 case 4:
710 hw->ext_buttons |= ((buf[5] & 0x02)) ? 0x08 : 0;
711 hw->ext_buttons |= ((buf[4] & 0x02)) ? 0x04 : 0;
712 case 2:
713 hw->ext_buttons |= ((buf[5] & 0x01)) ? 0x02 : 0;
714 hw->ext_buttons |= ((buf[4] & 0x01)) ? 0x01 : 0;
715 }
716 } 777 }
717 } else { 778 } else {
718 hw->x = (((buf[1] & 0x1f) << 8) | buf[2]); 779 hw->x = (((buf[1] & 0x1f) << 8) | buf[2]);
@@ -774,12 +835,54 @@ static void synaptics_report_semi_mt_data(struct input_dev *dev,
774 } 835 }
775} 836}
776 837
838static void synaptics_report_ext_buttons(struct psmouse *psmouse,
839 const struct synaptics_hw_state *hw)
840{
841 struct input_dev *dev = psmouse->dev;
842 struct synaptics_data *priv = psmouse->private;
843 int ext_bits = (SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap) + 1) >> 1;
844 char buf[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
845 int i;
846
847 if (!SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap))
848 return;
849
850 /* Bug in FW 8.1, buttons are reported only when ExtBit is 1 */
851 if (SYN_ID_FULL(priv->identity) == 0x801 &&
852 !((psmouse->packet[0] ^ psmouse->packet[3]) & 0x02))
853 return;
854
855 if (!SYN_CAP_EXT_BUTTONS_STICK(priv->ext_cap_10)) {
856 for (i = 0; i < ext_bits; i++) {
857 input_report_key(dev, BTN_0 + 2 * i,
858 hw->ext_buttons & (1 << i));
859 input_report_key(dev, BTN_1 + 2 * i,
860 hw->ext_buttons & (1 << (i + ext_bits)));
861 }
862 return;
863 }
864
865 /*
866 * This generation of touchpads has the trackstick buttons
867 * physically wired to the touchpad. Re-route them through
868 * the pass-through interface.
869 */
870 if (!priv->pt_port)
871 return;
872
873 /* The trackstick expects at most 3 buttons */
874 priv->pt_buttons = SYN_CAP_EXT_BUTTON_STICK_L(hw->ext_buttons) |
875 SYN_CAP_EXT_BUTTON_STICK_R(hw->ext_buttons) << 1 |
876 SYN_CAP_EXT_BUTTON_STICK_M(hw->ext_buttons) << 2;
877
878 synaptics_pass_pt_packet(psmouse, priv->pt_port, buf);
879}
880
777static void synaptics_report_buttons(struct psmouse *psmouse, 881static void synaptics_report_buttons(struct psmouse *psmouse,
778 const struct synaptics_hw_state *hw) 882 const struct synaptics_hw_state *hw)
779{ 883{
780 struct input_dev *dev = psmouse->dev; 884 struct input_dev *dev = psmouse->dev;
781 struct synaptics_data *priv = psmouse->private; 885 struct synaptics_data *priv = psmouse->private;
782 int i;
783 886
784 input_report_key(dev, BTN_LEFT, hw->left); 887 input_report_key(dev, BTN_LEFT, hw->left);
785 input_report_key(dev, BTN_RIGHT, hw->right); 888 input_report_key(dev, BTN_RIGHT, hw->right);
@@ -792,8 +895,7 @@ static void synaptics_report_buttons(struct psmouse *psmouse,
792 input_report_key(dev, BTN_BACK, hw->down); 895 input_report_key(dev, BTN_BACK, hw->down);
793 } 896 }
794 897
795 for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++) 898 synaptics_report_ext_buttons(psmouse, hw);
796 input_report_key(dev, BTN_0 + i, hw->ext_buttons & (1 << i));
797} 899}
798 900
799static void synaptics_report_mt_data(struct psmouse *psmouse, 901static void synaptics_report_mt_data(struct psmouse *psmouse,
@@ -1014,7 +1116,8 @@ static psmouse_ret_t synaptics_process_byte(struct psmouse *psmouse)
1014 if (SYN_CAP_PASS_THROUGH(priv->capabilities) && 1116 if (SYN_CAP_PASS_THROUGH(priv->capabilities) &&
1015 synaptics_is_pt_packet(psmouse->packet)) { 1117 synaptics_is_pt_packet(psmouse->packet)) {
1016 if (priv->pt_port) 1118 if (priv->pt_port)
1017 synaptics_pass_pt_packet(priv->pt_port, psmouse->packet); 1119 synaptics_pass_pt_packet(psmouse, priv->pt_port,
1120 psmouse->packet);
1018 } else 1121 } else
1019 synaptics_process_packet(psmouse); 1122 synaptics_process_packet(psmouse);
1020 1123
@@ -1116,8 +1219,9 @@ static void set_input_params(struct psmouse *psmouse,
1116 __set_bit(BTN_BACK, dev->keybit); 1219 __set_bit(BTN_BACK, dev->keybit);
1117 } 1220 }
1118 1221
1119 for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++) 1222 if (!SYN_CAP_EXT_BUTTONS_STICK(priv->ext_cap_10))
1120 __set_bit(BTN_0 + i, dev->keybit); 1223 for (i = 0; i < SYN_CAP_MULTI_BUTTON_NO(priv->ext_cap); i++)
1224 __set_bit(BTN_0 + i, dev->keybit);
1121 1225
1122 __clear_bit(EV_REL, dev->evbit); 1226 __clear_bit(EV_REL, dev->evbit);
1123 __clear_bit(REL_X, dev->relbit); 1227 __clear_bit(REL_X, dev->relbit);
@@ -1125,7 +1229,8 @@ static void set_input_params(struct psmouse *psmouse,
1125 1229
1126 if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) { 1230 if (SYN_CAP_CLICKPAD(priv->ext_cap_0c)) {
1127 __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit); 1231 __set_bit(INPUT_PROP_BUTTONPAD, dev->propbit);
1128 if (psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids)) 1232 if (psmouse_matches_pnp_id(psmouse, topbuttonpad_pnp_ids) &&
1233 !SYN_CAP_EXT_BUTTONS_STICK(priv->ext_cap_10))
1129 __set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit); 1234 __set_bit(INPUT_PROP_TOPBUTTONPAD, dev->propbit);
1130 /* Clickpads report only left button */ 1235 /* Clickpads report only left button */
1131 __clear_bit(BTN_RIGHT, dev->keybit); 1236 __clear_bit(BTN_RIGHT, dev->keybit);
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index aedc3299b14e..ee4bd0d12b26 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -22,6 +22,7 @@
22#define SYN_QUE_EXT_CAPAB_0C 0x0c 22#define SYN_QUE_EXT_CAPAB_0C 0x0c
23#define SYN_QUE_EXT_MAX_COORDS 0x0d 23#define SYN_QUE_EXT_MAX_COORDS 0x0d
24#define SYN_QUE_EXT_MIN_COORDS 0x0f 24#define SYN_QUE_EXT_MIN_COORDS 0x0f
25#define SYN_QUE_MEXT_CAPAB_10 0x10
25 26
26/* synatics modes */ 27/* synatics modes */
27#define SYN_BIT_ABSOLUTE_MODE (1 << 7) 28#define SYN_BIT_ABSOLUTE_MODE (1 << 7)
@@ -53,6 +54,7 @@
53#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) 54#define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20)
54#define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) 55#define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12)
55#define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) 56#define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16)
57#define SYN_MEXT_CAP_BIT(m) ((m) & (1 << 1))
56 58
57/* 59/*
58 * The following describes response for the 0x0c query. 60 * The following describes response for the 0x0c query.
@@ -89,6 +91,30 @@
89#define SYN_CAP_REDUCED_FILTERING(ex0c) ((ex0c) & 0x000400) 91#define SYN_CAP_REDUCED_FILTERING(ex0c) ((ex0c) & 0x000400)
90#define SYN_CAP_IMAGE_SENSOR(ex0c) ((ex0c) & 0x000800) 92#define SYN_CAP_IMAGE_SENSOR(ex0c) ((ex0c) & 0x000800)
91 93
94/*
95 * The following descibes response for the 0x10 query.
96 *
97 * byte mask name meaning
98 * ---- ---- ------- ------------
99 * 1 0x01 ext buttons are stick buttons exported in the extended
100 * capability are actually meant to be used
101 * by the tracktick (pass-through).
102 * 1 0x02 SecurePad the touchpad is a SecurePad, so it
103 * contains a built-in fingerprint reader.
104 * 1 0xe0 more ext count how many more extented queries are
105 * available after this one.
106 * 2 0xff SecurePad width the width of the SecurePad fingerprint
107 * reader.
108 * 3 0xff SecurePad height the height of the SecurePad fingerprint
109 * reader.
110 */
111#define SYN_CAP_EXT_BUTTONS_STICK(ex10) ((ex10) & 0x010000)
112#define SYN_CAP_SECUREPAD(ex10) ((ex10) & 0x020000)
113
114#define SYN_CAP_EXT_BUTTON_STICK_L(eb) (!!((eb) & 0x01))
115#define SYN_CAP_EXT_BUTTON_STICK_M(eb) (!!((eb) & 0x02))
116#define SYN_CAP_EXT_BUTTON_STICK_R(eb) (!!((eb) & 0x04))
117
92/* synaptics modes query bits */ 118/* synaptics modes query bits */
93#define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7)) 119#define SYN_MODE_ABSOLUTE(m) ((m) & (1 << 7))
94#define SYN_MODE_RATE(m) ((m) & (1 << 6)) 120#define SYN_MODE_RATE(m) ((m) & (1 << 6))
@@ -143,6 +169,7 @@ struct synaptics_data {
143 unsigned long int capabilities; /* Capabilities */ 169 unsigned long int capabilities; /* Capabilities */
144 unsigned long int ext_cap; /* Extended Capabilities */ 170 unsigned long int ext_cap; /* Extended Capabilities */
145 unsigned long int ext_cap_0c; /* Ext Caps from 0x0c query */ 171 unsigned long int ext_cap_0c; /* Ext Caps from 0x0c query */
172 unsigned long int ext_cap_10; /* Ext Caps from 0x10 query */
146 unsigned long int identity; /* Identification */ 173 unsigned long int identity; /* Identification */
147 unsigned int x_res, y_res; /* X/Y resolution in units/mm */ 174 unsigned int x_res, y_res; /* X/Y resolution in units/mm */
148 unsigned int x_max, y_max; /* Max coordinates (from FW) */ 175 unsigned int x_max, y_max; /* Max coordinates (from FW) */
@@ -156,6 +183,7 @@ struct synaptics_data {
156 bool disable_gesture; /* disable gestures */ 183 bool disable_gesture; /* disable gestures */
157 184
158 struct serio *pt_port; /* Pass-through serio port */ 185 struct serio *pt_port; /* Pass-through serio port */
186 unsigned char pt_buttons; /* Pass-through buttons */
159 187
160 /* 188 /*
161 * Last received Advanced Gesture Mode (AGM) packet. An AGM packet 189 * Last received Advanced Gesture Mode (AGM) packet. An AGM packet