Skip to contentSkip to conversation

input: update max sizes after setting to absolute mode

PATCH New Kutay Uner 1 participant 1 message Apr 27, 2020

Subsystems (2)
lore
Share & tools
lore

Kutay Uner

author
#0 lore raw

PATCH 1/1 input: update max sizes after setting to absolute mode

x_max/y_max values change after we populate info struct. Using old values causes y scroll to be half of the size of pad area. Updating these values fixes that problem. This problem affects firmware 0x450f00 at least.

---

drivers/input/mouse/elantech.c +16 -0
@@ -1944,6 +1944,22 @@ static int elantech_setup_ps2(struct psmouse *psmouse,
 		goto init_fail;
 	}
 
+	/* elantech_set_absolute_mode(?) causes x_max/y_max to change
+	 * at least on models using this fw. Workaround that by requerying
+	 * and setting those values at both info struct to be safe.
+	 */
+	if (info->fw_version == 0x450f00) {
+		unsigned char param[3];
+
+		if (info->send_cmd(psmouse, ETP_FW_ID_QUERY, param))
+			goto init_fail;
+
+		info->x_max = (0x0f & param[0]) << 8 | param[1];
+		info->y_max = (0xf0 & param[0]) << 4 | param[2];
+		etd->info.x_max = info->x_max;
+		etd->info.y_max = info->y_max;
+	}
+
 	if (info->fw_version == 0x381f17) {
 		etd->original_set_rate = psmouse->set_rate;
 		psmouse->set_rate = elantech_set_rate_restore_reg_07;