aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorNick Dyer <nick.dyer@itdev.co.uk>2014-05-19 02:22:22 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2014-05-26 22:08:23 -0400
commiteef820dc4faf25d004b3910322cfb85dfcd87611 (patch)
tree1acc4fb0ae98b40a6af3d24daa6a5107c08dcc20 /drivers/input
parentf3889ed1d4710d36082c5a96e8901bc57cbe7f1f (diff)
Input: atmel_mxt_ts - handle multiple input reports in one message
Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk> Acked-by: Benson Leung <bleung@chromium.org> Acked-by: Yufeng Shen <miletus@chromium.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c36
1 files changed, 28 insertions, 8 deletions
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 7951d9bcee4a..97495c7edae8 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -654,6 +654,12 @@ static void mxt_input_button(struct mxt_data *data, struct mxt_message *message)
654 } 654 }
655} 655}
656 656
657static void mxt_input_sync(struct input_dev *input_dev)
658{
659 input_mt_report_pointer_emulation(input_dev, false);
660 input_sync(input_dev);
661}
662
657static void mxt_input_touchevent(struct mxt_data *data, 663static void mxt_input_touchevent(struct mxt_data *data,
658 struct mxt_message *message, int id) 664 struct mxt_message *message, int id)
659{ 665{
@@ -667,10 +673,12 @@ static void mxt_input_touchevent(struct mxt_data *data,
667 673
668 x = (message->message[1] << 4) | ((message->message[3] >> 4) & 0xf); 674 x = (message->message[1] << 4) | ((message->message[3] >> 4) & 0xf);
669 y = (message->message[2] << 4) | ((message->message[3] & 0xf)); 675 y = (message->message[2] << 4) | ((message->message[3] & 0xf));
676
677 /* Handle 10/12 bit switching */
670 if (data->max_x < 1024) 678 if (data->max_x < 1024)
671 x = x >> 2; 679 x >>= 2;
672 if (data->max_y < 1024) 680 if (data->max_y < 1024)
673 y = y >> 2; 681 y >>= 2;
674 682
675 area = message->message[4]; 683 area = message->message[4];
676 amplitude = message->message[5]; 684 amplitude = message->message[5];
@@ -689,14 +697,28 @@ static void mxt_input_touchevent(struct mxt_data *data,
689 x, y, area, amplitude); 697 x, y, area, amplitude);
690 698
691 input_mt_slot(input_dev, id); 699 input_mt_slot(input_dev, id);
692 input_mt_report_slot_state(input_dev, MT_TOOL_FINGER,
693 status & MXT_T9_DETECT);
694 700
695 if (status & MXT_T9_DETECT) { 701 if (status & MXT_T9_DETECT) {
702 /*
703 * Multiple bits may be set if the host is slow to read
704 * the status messages, indicating all the events that
705 * have happened.
706 */
707 if (status & MXT_T9_RELEASE) {
708 input_mt_report_slot_state(input_dev,
709 MT_TOOL_FINGER, 0);
710 mxt_input_sync(input_dev);
711 }
712
713 /* Touch active */
714 input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, 1);
696 input_report_abs(input_dev, ABS_MT_POSITION_X, x); 715 input_report_abs(input_dev, ABS_MT_POSITION_X, x);
697 input_report_abs(input_dev, ABS_MT_POSITION_Y, y); 716 input_report_abs(input_dev, ABS_MT_POSITION_Y, y);
698 input_report_abs(input_dev, ABS_MT_PRESSURE, amplitude); 717 input_report_abs(input_dev, ABS_MT_PRESSURE, amplitude);
699 input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, area); 718 input_report_abs(input_dev, ABS_MT_TOUCH_MAJOR, area);
719 } else {
720 /* Touch no longer active, close out slot */
721 input_mt_report_slot_state(input_dev, MT_TOOL_FINGER, 0);
700 } 722 }
701} 723}
702 724
@@ -754,10 +776,8 @@ static irqreturn_t mxt_process_messages_until_invalid(struct mxt_data *data)
754 } 776 }
755 } while (reportid != 0xff); 777 } while (reportid != 0xff);
756 778
757 if (update_input) { 779 if (update_input)
758 input_mt_report_pointer_emulation(data->input_dev, false); 780 mxt_input_sync(data->input_dev);
759 input_sync(data->input_dev);
760 }
761 781
762 return IRQ_HANDLED; 782 return IRQ_HANDLED;
763} 783}