Skip to content

Commit 80212ed

Browse files
bentissdtor
authored andcommitted
Input: elantech - query the resolution in query_info
The command ETP_RESOLUTION_QUERY also contains the bus information. It is better to fetch it once, while we are querying for device information. Signed-off-by: Benjamin Tissoires <[email protected]> Acked-by: KT Liao <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent f078759 commit 80212ed

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

drivers/input/mouse/elantech.c

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,6 @@ static int elantech_set_input_params(struct psmouse *psmouse)
11791179
struct elantech_data *etd = psmouse->private;
11801180
struct elantech_device_info *info = &etd->info;
11811181
unsigned int x_min = 0, y_min = 0, x_max = 0, y_max = 0, width = 0;
1182-
unsigned int x_res = 31, y_res = 31;
11831182

11841183
if (elantech_set_range(psmouse, &x_min, &y_min, &x_max, &y_max, &width))
11851184
return -1;
@@ -1232,13 +1231,6 @@ static int elantech_set_input_params(struct psmouse *psmouse)
12321231
break;
12331232

12341233
case 4:
1235-
if (elantech_get_resolution_v4(psmouse, &x_res, &y_res)) {
1236-
/*
1237-
* if query failed, print a warning and leave the values
1238-
* zero to resemble synaptics.c behavior.
1239-
*/
1240-
psmouse_warn(psmouse, "couldn't query resolution data.\n");
1241-
}
12421234
elantech_set_buttonpad_prop(psmouse);
12431235
__set_bit(BTN_TOOL_QUADTAP, dev->keybit);
12441236
/* For X to recognize me as touchpad. */
@@ -1267,11 +1259,11 @@ static int elantech_set_input_params(struct psmouse *psmouse)
12671259
break;
12681260
}
12691261

1270-
input_abs_set_res(dev, ABS_X, x_res);
1271-
input_abs_set_res(dev, ABS_Y, y_res);
1262+
input_abs_set_res(dev, ABS_X, info->x_res);
1263+
input_abs_set_res(dev, ABS_Y, info->y_res);
12721264
if (info->hw_version > 1) {
1273-
input_abs_set_res(dev, ABS_MT_POSITION_X, x_res);
1274-
input_abs_set_res(dev, ABS_MT_POSITION_Y, y_res);
1265+
input_abs_set_res(dev, ABS_MT_POSITION_X, info->x_res);
1266+
input_abs_set_res(dev, ABS_MT_POSITION_Y, info->y_res);
12751267
}
12761268

12771269
etd->y_max = y_max;
@@ -1720,6 +1712,17 @@ static int elantech_query_info(struct psmouse *psmouse,
17201712
/* The MSB indicates the presence of the trackpoint */
17211713
info->has_trackpoint = (info->capabilities[0] & 0x80) == 0x80;
17221714

1715+
info->x_res = 31;
1716+
info->y_res = 31;
1717+
if (info->hw_version == 4) {
1718+
if (elantech_get_resolution_v4(psmouse,
1719+
&info->x_res,
1720+
&info->y_res)) {
1721+
psmouse_warn(psmouse,
1722+
"failed to query resolution data.\n");
1723+
}
1724+
}
1725+
17231726
return 0;
17241727
}
17251728

drivers/input/mouse/elantech.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ struct elantech_device_info {
120120
unsigned char debug;
121121
unsigned char hw_version;
122122
unsigned int fw_version;
123+
unsigned int x_res;
124+
unsigned int y_res;
123125
bool paritycheck;
124126
bool jumpy_cursor;
125127
bool reports_pressure;

0 commit comments

Comments
 (0)