linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] input: update max sizes after setting to absolute mode
@ 2020-04-27  4:59 Kutay Uner
  0 siblings, 0 replies; only message in thread
From: Kutay Uner @ 2020-04-27  4:59 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: rydberg, benjamin.tissoires, kai.heng.feng, linux-input

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.

Signed-off-by: Kutay Uner <husnukutay@gmail.com>
---
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-27  4:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-27  4:59 [PATCH 1/1] input: update max sizes after setting to absolute mode Kutay Uner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).