aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/alps.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-24 13:34:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-24 13:34:29 -0400
commit2c01e7bc46f10e9190818437e564f7e0db875ae9 (patch)
tree8b06c85d69754f7df27f7fb42520f6e2ceaea907 /drivers/input/mouse/alps.c
parentab11ca34eea8fda7a1a9302d86f6ef6108ffd68f (diff)
parente644dae645e167d154c0526358940986682a72b0 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input layer updates from Dmitry Torokhov: - a bunch of new drivers (DA9052/53 touchscreenn controller, Synaptics Navpoint, LM8333 keypads, Wacom I2C touhscreen); - updates to existing touchpad drivers (ALPS, Sntelic); - Wacom driver now supports Intuos5; - device-tree bindings in numerous drivers; - other cleanups and fixes. Fix annoying conflict in drivers/input/tablet/wacom_wac.c that I think implies that the input layer device naming is broken, but let's see. I brough it up with Dmitry. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (57 commits) Input: matrix-keymap - fix building keymaps Input: spear-keyboard - document DT bindings Input: spear-keyboard - add device tree bindings Input: matrix-keymap - wire up device tree support Input: matrix-keymap - uninline and prepare for device tree support Input: adp5588 - add support for gpio names Input: omap-keypad - dynamically handle register offsets Input: synaptics - fix compile warning MAINTAINERS: adjust input-related patterns Input: ALPS - switch to using input_mt_report_finger_count Input: ALPS - add semi-MT support for v4 protocol Input: Add Synaptics NavPoint (PXA27x SSP/SPI) driver Input: atmel_mxt_ts - dump each message on just 1 line Input: atmel_mxt_ts - do not read extra (checksum) byte Input: atmel_mxt_ts - verify object size in mxt_write_object Input: atmel_mxt_ts - only allow root to update firmware Input: atmel_mxt_ts - use CONFIG_PM_SLEEP Input: sentelic - report device's production serial number Input: tl6040-vibra - Device Tree support Input: evdev - properly handle read/write with count 0 ...
Diffstat (limited to 'drivers/input/mouse/alps.c')
-rw-r--r--drivers/input/mouse/alps.c81
1 files changed, 71 insertions, 10 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index 4c6a72d3d48c..4a1347e91bdc 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -553,10 +553,7 @@ static void alps_process_touchpad_packet_v3(struct psmouse *psmouse)
553 553
554 alps_report_semi_mt_data(dev, fingers, x1, y1, x2, y2); 554 alps_report_semi_mt_data(dev, fingers, x1, y1, x2, y2);
555 555
556 input_report_key(dev, BTN_TOOL_FINGER, fingers == 1); 556 input_mt_report_finger_count(dev, fingers);
557 input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2);
558 input_report_key(dev, BTN_TOOL_TRIPLETAP, fingers == 3);
559 input_report_key(dev, BTN_TOOL_QUADTAP, fingers == 4);
560 557
561 input_report_key(dev, BTN_LEFT, left); 558 input_report_key(dev, BTN_LEFT, left);
562 input_report_key(dev, BTN_RIGHT, right); 559 input_report_key(dev, BTN_RIGHT, right);
@@ -604,10 +601,54 @@ static void alps_process_packet_v3(struct psmouse *psmouse)
604 601
605static void alps_process_packet_v4(struct psmouse *psmouse) 602static void alps_process_packet_v4(struct psmouse *psmouse)
606{ 603{
604 struct alps_data *priv = psmouse->private;
607 unsigned char *packet = psmouse->packet; 605 unsigned char *packet = psmouse->packet;
608 struct input_dev *dev = psmouse->dev; 606 struct input_dev *dev = psmouse->dev;
607 int offset;
609 int x, y, z; 608 int x, y, z;
610 int left, right; 609 int left, right;
610 int x1, y1, x2, y2;
611 int fingers = 0;
612 unsigned int x_bitmap, y_bitmap;
613
614 /*
615 * v4 has a 6-byte encoding for bitmap data, but this data is
616 * broken up between 3 normal packets. Use priv->multi_packet to
617 * track our position in the bitmap packet.
618 */
619 if (packet[6] & 0x40) {
620 /* sync, reset position */
621 priv->multi_packet = 0;
622 }
623
624 if (WARN_ON_ONCE(priv->multi_packet > 2))
625 return;
626
627 offset = 2 * priv->multi_packet;
628 priv->multi_data[offset] = packet[6];
629 priv->multi_data[offset + 1] = packet[7];
630
631 if (++priv->multi_packet > 2) {
632 priv->multi_packet = 0;
633
634 x_bitmap = ((priv->multi_data[2] & 0x1f) << 10) |
635 ((priv->multi_data[3] & 0x60) << 3) |
636 ((priv->multi_data[0] & 0x3f) << 2) |
637 ((priv->multi_data[1] & 0x60) >> 5);
638 y_bitmap = ((priv->multi_data[5] & 0x01) << 10) |
639 ((priv->multi_data[3] & 0x1f) << 5) |
640 (priv->multi_data[1] & 0x1f);
641
642 fingers = alps_process_bitmap(x_bitmap, y_bitmap,
643 &x1, &y1, &x2, &y2);
644
645 /* Store MT data.*/
646 priv->fingers = fingers;
647 priv->x1 = x1;
648 priv->x2 = x2;
649 priv->y1 = y1;
650 priv->y2 = y2;
651 }
611 652
612 left = packet[4] & 0x01; 653 left = packet[4] & 0x01;
613 right = packet[4] & 0x02; 654 right = packet[4] & 0x02;
@@ -617,21 +658,41 @@ static void alps_process_packet_v4(struct psmouse *psmouse)
617 y = ((packet[2] & 0x7f) << 4) | (packet[3] & 0x0f); 658 y = ((packet[2] & 0x7f) << 4) | (packet[3] & 0x0f);
618 z = packet[5] & 0x7f; 659 z = packet[5] & 0x7f;
619 660
661 /*
662 * If there were no contacts in the bitmap, use ST
663 * points in MT reports.
664 * If there were two contacts or more, report MT data.
665 */
666 if (priv->fingers < 2) {
667 x1 = x;
668 y1 = y;
669 fingers = z > 0 ? 1 : 0;
670 } else {
671 fingers = priv->fingers;
672 x1 = priv->x1;
673 x2 = priv->x2;
674 y1 = priv->y1;
675 y2 = priv->y2;
676 }
677
620 if (z >= 64) 678 if (z >= 64)
621 input_report_key(dev, BTN_TOUCH, 1); 679 input_report_key(dev, BTN_TOUCH, 1);
622 else 680 else
623 input_report_key(dev, BTN_TOUCH, 0); 681 input_report_key(dev, BTN_TOUCH, 0);
624 682
683 alps_report_semi_mt_data(dev, fingers, x1, y1, x2, y2);
684
685 input_mt_report_finger_count(dev, fingers);
686
687 input_report_key(dev, BTN_LEFT, left);
688 input_report_key(dev, BTN_RIGHT, right);
689
625 if (z > 0) { 690 if (z > 0) {
626 input_report_abs(dev, ABS_X, x); 691 input_report_abs(dev, ABS_X, x);
627 input_report_abs(dev, ABS_Y, y); 692 input_report_abs(dev, ABS_Y, y);
628 } 693 }
629 input_report_abs(dev, ABS_PRESSURE, z); 694 input_report_abs(dev, ABS_PRESSURE, z);
630 695
631 input_report_key(dev, BTN_TOOL_FINGER, z > 0);
632 input_report_key(dev, BTN_LEFT, left);
633 input_report_key(dev, BTN_RIGHT, right);
634
635 input_sync(dev); 696 input_sync(dev);
636} 697}
637 698
@@ -1557,6 +1618,7 @@ int alps_init(struct psmouse *psmouse)
1557 input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0); 1618 input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0);
1558 break; 1619 break;
1559 case ALPS_PROTO_V3: 1620 case ALPS_PROTO_V3:
1621 case ALPS_PROTO_V4:
1560 set_bit(INPUT_PROP_SEMI_MT, dev1->propbit); 1622 set_bit(INPUT_PROP_SEMI_MT, dev1->propbit);
1561 input_mt_init_slots(dev1, 2); 1623 input_mt_init_slots(dev1, 2);
1562 input_set_abs_params(dev1, ABS_MT_POSITION_X, 0, ALPS_V3_X_MAX, 0, 0); 1624 input_set_abs_params(dev1, ABS_MT_POSITION_X, 0, ALPS_V3_X_MAX, 0, 0);
@@ -1565,8 +1627,7 @@ int alps_init(struct psmouse *psmouse)
1565 set_bit(BTN_TOOL_DOUBLETAP, dev1->keybit); 1627 set_bit(BTN_TOOL_DOUBLETAP, dev1->keybit);
1566 set_bit(BTN_TOOL_TRIPLETAP, dev1->keybit); 1628 set_bit(BTN_TOOL_TRIPLETAP, dev1->keybit);
1567 set_bit(BTN_TOOL_QUADTAP, dev1->keybit); 1629 set_bit(BTN_TOOL_QUADTAP, dev1->keybit);
1568 /* fall through */ 1630
1569 case ALPS_PROTO_V4:
1570 input_set_abs_params(dev1, ABS_X, 0, ALPS_V3_X_MAX, 0, 0); 1631 input_set_abs_params(dev1, ABS_X, 0, ALPS_V3_X_MAX, 0, 0);
1571 input_set_abs_params(dev1, ABS_Y, 0, ALPS_V3_Y_MAX, 0, 0); 1632 input_set_abs_params(dev1, ABS_Y, 0, ALPS_V3_Y_MAX, 0, 0);
1572 break; 1633 break;