aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorduson <dusonlin@emc.com.tw>2015-07-07 13:25:39 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2015-07-07 14:28:31 -0400
commit539c4b88146cc320aee18b08ebb43ab57d523dcc (patch)
tree6615ce7086cc07d2529ffc793f2027aa41e6109a
parenta5cba18c4de288335a975b5d57b68f6787330985 (diff)
Input: elan_i2c - change the hover event from MT to ST
The firmware only reports hover condition while the very first contact is approaching the surface; the hover is not reported for the subsequent contacts. Therefore we should not be using ABS_MT_DISTANCE to report hover but rather its single-touch counterpart ABS_DISTANCE. Signed-off-by: Duson Lin <dusonlin@emc.com.tw> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/mouse/elan_i2c_core.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index 62641f2adaf7..5b5f403d8ce6 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -771,7 +771,7 @@ static const struct attribute_group *elan_sysfs_groups[] = {
771 */ 771 */
772static void elan_report_contact(struct elan_tp_data *data, 772static void elan_report_contact(struct elan_tp_data *data,
773 int contact_num, bool contact_valid, 773 int contact_num, bool contact_valid,
774 bool hover_event, u8 *finger_data) 774 u8 *finger_data)
775{ 775{
776 struct input_dev *input = data->input; 776 struct input_dev *input = data->input;
777 unsigned int pos_x, pos_y; 777 unsigned int pos_x, pos_y;
@@ -815,9 +815,7 @@ static void elan_report_contact(struct elan_tp_data *data,
815 input_mt_report_slot_state(input, MT_TOOL_FINGER, true); 815 input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
816 input_report_abs(input, ABS_MT_POSITION_X, pos_x); 816 input_report_abs(input, ABS_MT_POSITION_X, pos_x);
817 input_report_abs(input, ABS_MT_POSITION_Y, data->max_y - pos_y); 817 input_report_abs(input, ABS_MT_POSITION_Y, data->max_y - pos_y);
818 input_report_abs(input, ABS_MT_DISTANCE, hover_event); 818 input_report_abs(input, ABS_MT_PRESSURE, scaled_pressure);
819 input_report_abs(input, ABS_MT_PRESSURE,
820 hover_event ? 0 : scaled_pressure);
821 input_report_abs(input, ABS_TOOL_WIDTH, mk_x); 819 input_report_abs(input, ABS_TOOL_WIDTH, mk_x);
822 input_report_abs(input, ABS_MT_TOUCH_MAJOR, major); 820 input_report_abs(input, ABS_MT_TOUCH_MAJOR, major);
823 input_report_abs(input, ABS_MT_TOUCH_MINOR, minor); 821 input_report_abs(input, ABS_MT_TOUCH_MINOR, minor);
@@ -839,14 +837,14 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet)
839 hover_event = hover_info & 0x40; 837 hover_event = hover_info & 0x40;
840 for (i = 0; i < ETP_MAX_FINGERS; i++) { 838 for (i = 0; i < ETP_MAX_FINGERS; i++) {
841 contact_valid = tp_info & (1U << (3 + i)); 839 contact_valid = tp_info & (1U << (3 + i));
842 elan_report_contact(data, i, contact_valid, hover_event, 840 elan_report_contact(data, i, contact_valid, finger_data);
843 finger_data);
844 841
845 if (contact_valid) 842 if (contact_valid)
846 finger_data += ETP_FINGER_DATA_LEN; 843 finger_data += ETP_FINGER_DATA_LEN;
847 } 844 }
848 845
849 input_report_key(input, BTN_LEFT, tp_info & 0x01); 846 input_report_key(input, BTN_LEFT, tp_info & 0x01);
847 input_report_abs(input, ABS_DISTANCE, hover_event != 0);
850 input_mt_report_pointer_emulation(input, true); 848 input_mt_report_pointer_emulation(input, true);
851 input_sync(input); 849 input_sync(input);
852} 850}
@@ -922,6 +920,7 @@ static int elan_setup_input_device(struct elan_tp_data *data)
922 input_abs_set_res(input, ABS_Y, data->y_res); 920 input_abs_set_res(input, ABS_Y, data->y_res);
923 input_set_abs_params(input, ABS_PRESSURE, 0, ETP_MAX_PRESSURE, 0, 0); 921 input_set_abs_params(input, ABS_PRESSURE, 0, ETP_MAX_PRESSURE, 0, 0);
924 input_set_abs_params(input, ABS_TOOL_WIDTH, 0, ETP_FINGER_WIDTH, 0, 0); 922 input_set_abs_params(input, ABS_TOOL_WIDTH, 0, ETP_FINGER_WIDTH, 0, 0);
923 input_set_abs_params(input, ABS_DISTANCE, 0, 1, 0, 0);
925 924
926 /* And MT parameters */ 925 /* And MT parameters */
927 input_set_abs_params(input, ABS_MT_POSITION_X, 0, data->max_x, 0, 0); 926 input_set_abs_params(input, ABS_MT_POSITION_X, 0, data->max_x, 0, 0);
@@ -934,7 +933,6 @@ static int elan_setup_input_device(struct elan_tp_data *data)
934 ETP_FINGER_WIDTH * max_width, 0, 0); 933 ETP_FINGER_WIDTH * max_width, 0, 0);
935 input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0, 934 input_set_abs_params(input, ABS_MT_TOUCH_MINOR, 0,
936 ETP_FINGER_WIDTH * min_width, 0, 0); 935 ETP_FINGER_WIDTH * min_width, 0, 0);
937 input_set_abs_params(input, ABS_MT_DISTANCE, 0, 1, 0, 0);
938 936
939 data->input = input; 937 data->input = input;
940 938