linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] input: elantech.c make sure touchpad is really in absolute mode
@ 2009-03-20  5:52 Arjan Opmeer
  2009-03-21  5:46 ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Arjan Opmeer @ 2009-03-20  5:52 UTC (permalink / raw)
  To: dtor, linux-input, linux-kernel

From: Arjan Opmeer <arjan@opmeer.net>

There exist laptops with Elantech touchpads where switching to absolute mode
does not happen, although writing the configuration register succeeds
without error. Reading back the register afterwards reveils that the
absolute mode bit is not set as if masked out by the touchpad firmware.

Always read back register 0x10, make sure that for hardware version 1 the
absolute mode bit is actually set and fail otherwise. This prevents the case
where the touchpad is claimed by the Elantech driver but is nonetheless not
working.

Signed-off-by: Arjan Opmeer <arjan@opmeer.net>
---

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 6ab0eb1..1de6fd6 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -363,9 +363,14 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
 			rc = -1;
 			break;
 		}
+	}
+
+	if (rc == 0) {
 		/*
-		 * Read back reg 0x10. The touchpad is probably initalising
-		 * and not ready until we read back the value we just wrote.
+		 * Read back reg 0x10. For hardware version 1 we must make
+		 * sure the absolute mode bit is set. For hardware version 2
+		 * the touchpad is probably initalising and not ready until
+		 * we read back the value we just wrote.
 		 */
 		do {
 			rc = elantech_read_reg(psmouse, 0x10, &val);
@@ -376,9 +381,17 @@ static int elantech_set_absolute_mode(struct psmouse *psmouse)
 				tries);
 			msleep(ETP_READ_BACK_DELAY);
 		} while (tries > 0);
-		if (rc)
+
+		if (rc) {
 			pr_err("elantech.c: failed to read back register 0x10.\n");
-		break;
+		} else {
+			if (etd->hw_version == 1 &&
+			    val & ETP_R10_ABSOLUTE_MODE == 0) {
+				pr_err("elantech.c: touchpad refuses "
+					"to have absolute mode bit set\n");
+				rc = -1;
+			}
+		}
 	}
 
 	if (rc)

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

* Re: [PATCH] input: elantech.c make sure touchpad is really in absolute mode
  2009-03-20  5:52 [PATCH] input: elantech.c make sure touchpad is really in absolute mode Arjan Opmeer
@ 2009-03-21  5:46 ` Dmitry Torokhov
  2009-03-21 12:04   ` Arjan Opmeer
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2009-03-21  5:46 UTC (permalink / raw)
  To: Arjan Opmeer; +Cc: linux-input, linux-kernel

Hi Arjan,

On Thursday 19 March 2009 22:52:39 Arjan Opmeer wrote:
> From: Arjan Opmeer <arjan@opmeer.net>
>
> There exist laptops with Elantech touchpads where switching to absolute
> mode does not happen, although writing the configuration register succeeds
> without error. Reading back the register afterwards reveils that the
> absolute mode bit is not set as if masked out by the touchpad firmware.
>
> Always read back register 0x10, make sure that for hardware version 1 the
> absolute mode bit is actually set and fail otherwise. This prevents the
> case where the touchpad is claimed by the Elantech driver but is
> nonetheless not working.
>

Makes sense, will apply. Although, have you tried repeating the switch or
maybe issuing full reset before trying again?

-- 
Dmitry


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

* Re: [PATCH] input: elantech.c make sure touchpad is really in absolute mode
  2009-03-21  5:46 ` Dmitry Torokhov
@ 2009-03-21 12:04   ` Arjan Opmeer
  0 siblings, 0 replies; 3+ messages in thread
From: Arjan Opmeer @ 2009-03-21 12:04 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel


On Fri, Mar 20, 2009 at 10:46:31PM -0700, Dmitry Torokhov wrote:
> On Thursday 19 March 2009 22:52:39 Arjan Opmeer wrote:
> >
> > There exist laptops with Elantech touchpads where switching to absolute
> > mode does not happen, although writing the configuration register
> > succeeds without error. Reading back the register afterwards reveils
> > that the absolute mode bit is not set as if masked out by the touchpad
> > firmware.
> >
> > Always read back register 0x10, make sure that for hardware version 1
> > the absolute mode bit is actually set and fail otherwise. This prevents
> > the case where the touchpad is claimed by the Elantech driver but is
> > nonetheless not working.
> 
> Makes sense, will apply. Although, have you tried repeating the switch or
> maybe issuing full reset before trying again?

No. I am sorry. I had this problem reported by two different users that both
kind of lost interest when I pointed out that the driver as it stands was
not able to support their laptops. Without access to the hardware and
without users willing to test I am rather stuck.

So I thought the sensible thing left to do was to put an extra check and
warning in the driver to prevent other users from falling in that trap where
their touchpad isn't working.


Arjan

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

end of thread, other threads:[~2009-03-21 12:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-20  5:52 [PATCH] input: elantech.c make sure touchpad is really in absolute mode Arjan Opmeer
2009-03-21  5:46 ` Dmitry Torokhov
2009-03-21 12:04   ` Arjan Opmeer

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).