linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kutay Uner <husnukutay@gmail.com>
To: dmitry.torokhov@gmail.com
Cc: rydberg@bitmath.org, benjamin.tissoires@redhat.com,
	kai.heng.feng@canonical.com, linux-input@vger.kernel.org
Subject: [PATCH 1/1] input: update max sizes after setting to absolute mode
Date: Mon, 27 Apr 2020 07:59:32 +0300	[thread overview]
Message-ID: <20200427045932.GA21183@hk.localdomain> (raw)

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;

                 reply	other threads:[~2020-04-27  4:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200427045932.GA21183@hk.localdomain \
    --to=husnukutay@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=linux-input@vger.kernel.org \
    --cc=rydberg@bitmath.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).