aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/elantech.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/mouse/elantech.c')
-rw-r--r--drivers/input/mouse/elantech.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 24bb2b5f5667..59bfb70d330a 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -931,6 +931,30 @@ static int elantech_set_range(struct psmouse *psmouse,
931} 931}
932 932
933/* 933/*
934 * (value from firmware) * 10 + 790 = dpi
935 * we also have to convert dpi to dots/mm (*10/254 to avoid floating point)
936 */
937static unsigned int elantech_convert_res(unsigned int val)
938{
939 return (val * 10 + 790) * 10 / 254;
940}
941
942static int elantech_get_resolution_v4(struct psmouse *psmouse,
943 unsigned int *x_res,
944 unsigned int *y_res)
945{
946 unsigned char param[3];
947
948 if (elantech_send_cmd(psmouse, ETP_RESOLUTION_QUERY, param))
949 return -1;
950
951 *x_res = elantech_convert_res(param[1] & 0x0f);
952 *y_res = elantech_convert_res((param[1] & 0xf0) >> 4);
953
954 return 0;
955}
956
957/*
934 * Set the appropriate event bits for the input subsystem 958 * Set the appropriate event bits for the input subsystem
935 */ 959 */
936static int elantech_set_input_params(struct psmouse *psmouse) 960static int elantech_set_input_params(struct psmouse *psmouse)
@@ -938,6 +962,7 @@ static int elantech_set_input_params(struct psmouse *psmouse)
938 struct input_dev *dev = psmouse->dev; 962 struct input_dev *dev = psmouse->dev;
939 struct elantech_data *etd = psmouse->private; 963 struct elantech_data *etd = psmouse->private;
940 unsigned int x_min = 0, y_min = 0, x_max = 0, y_max = 0, width = 0; 964 unsigned int x_min = 0, y_min = 0, x_max = 0, y_max = 0, width = 0;
965 unsigned int x_res = 0, y_res = 0;
941 966
942 if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width)) 967 if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width))
943 return -1; 968 return -1;
@@ -985,10 +1010,20 @@ static int elantech_set_input_params(struct psmouse *psmouse)
985 break; 1010 break;
986 1011
987 case 4: 1012 case 4:
1013 if (elantech_get_resolution_v4(psmouse, &x_res, &y_res)) {
1014 /*
1015 * if query failed, print a warning and leave the values
1016 * zero to resemble synaptics.c behavior.
1017 */
1018 psmouse_warn(psmouse, "couldn't query resolution data.\n");
1019 }
1020
988 __set_bit(BTN_TOOL_QUADTAP, dev->keybit); 1021 __set_bit(BTN_TOOL_QUADTAP, dev->keybit);
989 /* For X to recognize me as touchpad. */ 1022 /* For X to recognize me as touchpad. */
990 input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0); 1023 input_set_abs_params(dev, ABS_X, x_min, x_max, 0, 0);
991 input_set_abs_params(dev, ABS_Y, y_min, y_max, 0, 0); 1024 input_set_abs_params(dev, ABS_Y, y_min, y_max, 0, 0);
1025 input_abs_set_res(dev, ABS_X, x_res);
1026 input_abs_set_res(dev, ABS_Y, y_res);
992 /* 1027 /*
993 * range of pressure and width is the same as v2, 1028 * range of pressure and width is the same as v2,
994 * report ABS_PRESSURE, ABS_TOOL_WIDTH for compatibility. 1029 * report ABS_PRESSURE, ABS_TOOL_WIDTH for compatibility.
@@ -1001,6 +1036,8 @@ static int elantech_set_input_params(struct psmouse *psmouse)
1001 input_mt_init_slots(dev, ETP_MAX_FINGERS); 1036 input_mt_init_slots(dev, ETP_MAX_FINGERS);
1002 input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0); 1037 input_set_abs_params(dev, ABS_MT_POSITION_X, x_min, x_max, 0, 0);
1003 input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0); 1038 input_set_abs_params(dev, ABS_MT_POSITION_Y, y_min, y_max, 0, 0);
1039 input_abs_set_res(dev, ABS_MT_POSITION_X, x_res);
1040 input_abs_set_res(dev, ABS_MT_POSITION_Y, y_res);
1004 input_set_abs_params(dev, ABS_MT_PRESSURE, ETP_PMIN_V2, 1041 input_set_abs_params(dev, ABS_MT_PRESSURE, ETP_PMIN_V2,
1005 ETP_PMAX_V2, 0, 0); 1042 ETP_PMAX_V2, 0, 0);
1006 /* 1043 /*