All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/4] Input - elantech: Add special check for fw_version  0x470f01 touchpad
@ 2015-08-07  9:38 duson
  2015-08-22 21:43 ` [PATCH v1 1/1] Input: elantech - Remove the ETP_SAMPLE_QUERY read that is now redundant Ulrik De Bie
  0 siblings, 1 reply; 2+ messages in thread
From: duson @ 2015-08-07  9:38 UTC (permalink / raw)
  To: linux-input, linux-kernel, Dmitry Torokhov

It is no need to check the packet[0] for sanity check when doing
elantech_packet_check_v4() function for fw_version = 0x470f01 touchpad.

Signed-off by: Duson Lin <dusonlin@emc.com.tw>
---
 drivers/input/mouse/elantech.c |   20 ++++++++++++++++++++
 drivers/input/mouse/elantech.h |    1 +
 2 files changed, 21 insertions(+)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 22b9ca9..2a0f883 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -785,6 +785,9 @@ static int elantech_packet_check_v4(struct psmouse *psmouse)
 	unsigned char packet_type = packet[3] & 0x03;
 	bool sanity_check;
 
+	/* This represents the version of IC body. */
+	int ver = (etd->fw_version & 0x0f0000) >> 16;
+
 	if (etd->tp_dev && (packet[3] & 0x0f) == 0x06)
 		return PACKET_TRACKPOINT;
 
@@ -796,6 +799,12 @@ static int elantech_packet_check_v4(struct psmouse *psmouse)
 	 */
 	if (etd->crc_enabled)
 		sanity_check = ((packet[3] & 0x08) == 0x00);
+	/*
+	 * The sanity check only need to check packet[3]
+	 * when IC_body = 7 and PID = 0x2A
+	 */
+	else if (ver == 7 && etd->samples[1] == 0x2A)
+		sanity_check = ((packet[3] & 0x1c) == 0x10);
 	else
 		sanity_check = ((packet[0] & 0x0c) == 0x04 &&
 				(packet[3] & 0x1c) == 0x10);
@@ -1116,6 +1125,7 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse,
  * Avatar AVIU-145A2       0x361f00        ?               clickpad
  * Fujitsu LIFEBOOK E544   0x470f00        d0, 12, 09      2 hw buttons
  * Fujitsu LIFEBOOK E554   0x570f01        40, 14, 0c      2 hw buttons
+ * Fujitsu T725	           0x470f01        05, 12, 09      2 hw buttons
  * Fujitsu H730            0x570f00        c0, 14, 0c      3 hw buttons (**)
  * Gigabyte U2442          0x450f01        58, 17, 0c      2 hw buttons
  * Lenovo L430             0x350f02        b9, 15, 0c      2 hw buttons (*)
@@ -1651,6 +1661,16 @@ int elantech_init(struct psmouse *psmouse)
 		     etd->capabilities[0], etd->capabilities[1],
 		     etd->capabilities[2]);
 
+	if (etd->hw_version != 1) {
+		if (etd->send_cmd(psmouse, ETP_SAMPLE_QUERY, etd->samples)) {
+			psmouse_err(psmouse, "failed to query sample data\n");
+			goto init_fail;
+		}
+		psmouse_info(psmouse,
+			    "Elan sample query result %02x, %02x, %02x\n",
+			    etd->samples[0], etd->samples[1], etd->samples[2]);
+	}
+
 	if (elantech_set_absolute_mode(psmouse)) {
 		psmouse_err(psmouse,
 			    "failed to put touchpad into absolute mode.\n");
diff --git a/drivers/input/mouse/elantech.h b/drivers/input/mouse/elantech.h
index f965d15..e1cbf40 100644
--- a/drivers/input/mouse/elantech.h
+++ b/drivers/input/mouse/elantech.h
@@ -129,6 +129,7 @@ struct elantech_data {
 	unsigned char reg_26;
 	unsigned char debug;
 	unsigned char capabilities[3];
+	unsigned char samples[3];
 	bool paritycheck;
 	bool jumpy_cursor;
 	bool reports_pressure;







^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH v1  1/1] Input: elantech - Remove the ETP_SAMPLE_QUERY read that is now redundant
  2015-08-07  9:38 [PATCH 4/4] Input - elantech: Add special check for fw_version 0x470f01 touchpad duson
@ 2015-08-22 21:43 ` Ulrik De Bie
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrik De Bie @ 2015-08-22 21:43 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, Hans de Goede, ulrik.debie-os, Duson Lin

commit 6b30c73e9f37183ad60c7f7050acf8e8edf91e9c introduced a read of
ETP_SAMPLE_QUERY to etd->samples on line 1662. Because of that
introduction, this other read of ETP_SAMPLE_QUERY at line 1040 becomes
redundant and the already read etd->samples can be used instead.

This line 1040 read will only be called when
(etd->fw_version >> 16) == 0x14 and consequentially
hardware version != 1 so the line 1662 read is also called.

Signed-off-by: Ulrik De Bie <ulrik.debie-os@e2big.org>
CC: Duson Lin <dusonlin@emc.com.tw>
---
 drivers/input/mouse/elantech.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 2955f1d..825be4b 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1037,11 +1037,10 @@ static int elantech_set_range(struct psmouse *psmouse,
 			fixed_dpi = param[1] & 0x10;
 
 			if (((etd->fw_version >> 16) == 0x14) && fixed_dpi) {
-				if (etd->send_cmd(psmouse, ETP_SAMPLE_QUERY, param))
-					return -1;
-
-				*x_max = (etd->capabilities[1] - i) * param[1] / 2;
-				*y_max = (etd->capabilities[2] - i) * param[2] / 2;
+				*x_max = (etd->capabilities[1] - i) *
+					etd->samples[1] / 2;
+				*y_max = (etd->capabilities[2] - i) *
+					etd->samples[2] / 2;
 			} else if (etd->fw_version == 0x040216) {
 				*x_max = 819;
 				*y_max = 405;
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-22 21:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-07  9:38 [PATCH 4/4] Input - elantech: Add special check for fw_version 0x470f01 touchpad duson
2015-08-22 21:43 ` [PATCH v1 1/1] Input: elantech - Remove the ETP_SAMPLE_QUERY read that is now redundant Ulrik De Bie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.