Elantech touchpad driver
Subsystems (3)
PATCH 3/7 Elantech touchpad driver
From: Arjan Opmeer <[email protected]>
- needs a changelog
- needs a signed-off-by:
Cc Dmitry Torokhov <[email protected]>
Cc Jiri Kosina <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
Documentation/input/elantech.txt | 172 +++++++++ drivers/input/mouse/Kconfig | 15 drivers/input/mouse/Makefile | 1 drivers/input/mouse/elantech.c | 485 +++++++++++++++++++++++++++ drivers/input/mouse/elantech.h | 82 ++++ drivers/input/mouse/psmouse-base.c | 17 drivers/input/mouse/psmouse.h | 1 7 files changed, 773 insertions(+)
Documentation/input/elantech.txt new file +172 -0
@@ -0,0 +1,172 @@ +Elantech Touchpad Driver +======================== + Copyright (C) 2007 Arjan Opmeer <[email protected]> + + Extra information found and provided by Steve Havelka + +Configuration of the touchpad is performed by writing values to registers +found under sysfs entries /sys/bus/serio/drivers/psmouse/serio?/reg_*. + +E.g. to disable tapping while leaving the other settings to the default +Windows driver value one would: + + echo -n 0x32 > reg_10 + + +Registers +~~~~~~~~~ + +* reg_10 (Windows driver default value 0x12) + + bit 7 6 5 4 3 2 1 0 + B C T D L A S E + + E: 1 = enable smart edges in other cases + S: 1 = enable smart edges only when dragging + A: 1 = absolute mode (needs 4 byte packets, see reg_11) + L: 1 = enable drag lock (see reg_22) + D: 1 = disable dynamic resolution + T: 1 = disable tapping + C: 1 = enable corner tap + B: 1 = swap left and right button + +* reg_11 (Windows driver default value 0x8f) + + bit 7 6 5 4 3 2 1 0 + 1 0 0 H V 1 F P + + P: 1 = enable parity checking for relative mode + F: 1 = enable native 4 byte packet mode + V: 1 = enable vertical scroll area + H: 1 = enable horizonal scroll area + + +* reg_20 (Windows driver default value 0x0a) + + single finger width? + +* reg_21 (Windows driver default value 0x60) + + scroll area width (small: 0x40 ... wide: 0xff) + +* reg_22 (Windows driver default value 0xff) + + drag lock time out (short: 0x14 ... long: 0xfe; 0xff =never) + +* reg_23 (Windows driver default value 0x10) + + tap make timeout? + + Note: the Windows driver does not write this register + +* reg_24 (Windows driver default value 0x10) + + tap release timeout? + + Note: the Windows driver does not write this register + +* reg_25 (Windows driver default value 0x03) + + smart edge cursor speed (0x02 = slow, 0x03 = medium, 0x04 = fast) + +* reg_26 (Windows driver default value 0x00 ?? ) + + smart edge activation area width? + + Note: the Windows driver does not write this register + Note: the Windows driver default value of 0x00 disables smart edges + when it would get written + Note: the Windows driver sets bit 0 of the registry value to disable + tapping when typing, but never actually writes the register. + Only used as an internal driver flag? + + + +Initially the Elantouch Touchpad is in emulation mode and reports 3 byte +standard PS/2 packets and hence works with a standard mouse driver. +However, it can be configured to talk its native 4 byte relative mode and 4 +byte absolute mode both for which a dedicated driver is needed. + + +Native 4 byte relative mode packet format +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +byte 0: + bit 7 6 5 4 3 2 1 0 + c c p2 p1 1 M R L + + L, R, M = 1 when Left, Right, Middle mouse button pressed + some models have M as byte 3 odd parity + when parity checking is enabled (P = 1): + p1 = byte 1 odd parity + p2 = byte 2 odd parity + c = 1 when corner tap detected + +byte 1: + bit 7 6 5 4 3 2 1 0 + dx7 dx6 dx5 dx4 dx3 dx2 dx1 dx0 + + dx7..dx0 = x movement; positive = right, negative = left + byte 1 = 0xf0 when corner tap detected + +byte 2: + bit 7 6 5 4 3 2 1 0 + dy7 dy6 dy5 dy4 dy3 dy2 dy1 dy0 + + dy7..dy0 = y movement; positive = up, negative = down + +byte 3: + bit 7 6 5 4 3 2 1 0 + w h n1 n0 d3 d2 d1 d0 + + when parity checking is enabled (P = 1): + normally: + d3..d0 = scroll wheel amount and direction + positive = down or left + negative = up or right + when corner tap detected: + d0 = 1 when top right corner tapped + d1 = 1 when bottom right corner tapped + d2 = 1 when bottom left corner tapped + d3 = 1 when top left corner tapped + n1..n0 = number of fingers on touchpad + not all models report this but map one, two and three + finger taps directly to L, M and R mouse buttons + w = 1 when wide finger touch? + h = 1 when horizontal scroll action + otherwise (P = 0): + all of byte 3 is vertical scroll amount and direction + negative = up + positive = down + + +Native 4 byte absolute mode packet format +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +byte 0: + bit 7 6 5 4 3 2 1 0 + D U p1 p2 1 p3 R L + + L, R = 1 when Left, Right mouse button pressed + p1..p3 = parity bit of bytes 1..3 + D, U = 1 when rocker switch pressed Up, Down + +byte 1: + bit 7 6 5 4 3 2 1 0 + f 0 th tw x9 x8 y9 y8 + + tw = 1 when two finger touch + th = 1 when three finger touch + f = 1 when finger touch + +byte 2: + bit 7 6 5 4 3 2 1 0 + x7 x6 x5 x4 x3 x2 x1 x0 + + x9..x0 = absolute x value (horizontal) + +byte 3: + bit 7 6 5 4 3 2 1 0 + y7 y6 y5 y4 y3 y2 y1 y0 + + y9..y0 = absolute y value (vertical)
drivers/input/mouse/Kconfig renamed from drivers/input/mouse/Kconfig~elantech-touchpad-driver +15 -0
@@ -96,6 +96,21 @@ config MOUSE_PS2_TOUCHKIT If unsure, say N. +config MOUSE_PS2_ELANTECH + bool "Elantech PS/2 protocol extension" + depends on MOUSE_PS2 + help + Say Y here if you have an Elantech PS/2 touchpad connected + to your system. + + If unsure, say N. + + This driver exposes some configuration registers via sysfs + entries. + + For further information, see + <file:Documentation/input/elantech.txt>. + config MOUSE_SERIAL tristate "Serial mouse" select SERIO
drivers/input/mouse/Makefile renamed from drivers/input/mouse/Makefile~elantech-touchpad-driver +1 -0
@@ -24,3 +24,4 @@ psmouse-$(CONFIG_MOUSE_PS2_LOGIPS2PP) += psmouse-$(CONFIG_MOUSE_PS2_LIFEBOOK) += lifebook.o psmouse-$(CONFIG_MOUSE_PS2_TRACKPOINT) += trackpoint.o psmouse-$(CONFIG_MOUSE_PS2_TOUCHKIT) += touchkit_ps2.o +psmouse-$(CONFIG_MOUSE_PS2_ELANTECH) += elantech.o
drivers/input/mouse/elantech.c new file +485 -0
485 lines not on this page · raw message
drivers/input/mouse/elantech.h new file +82 -0
82 lines not on this page · raw message
drivers/input/mouse/psmouse-base.c renamed from drivers/input/mouse/psmouse-base.c~elantech-touchpad-driver +17 -0
@@ -28,6 +28,7 @@#include "lifebook.h" #include "trackpoint.h" #include "touchkit_ps2.h" +#include "elantech.h" #define DRIVER_DESC "PS/2 mouse driver"
@@ -653,6 +654,13 @@ static int psmouse_extensions(struct psmps2_command (&psmouse->ps2dev,NULL ,PSMOUSE_CMD_RESET_DIS );psmouse_reset (psmouse); +if (elantech_detect (psmouse, set_properties) ==0 ) { +if (max_proto >PSMOUSE_IMEX ) { +if (!set_properties ||elantech_init (psmouse) ==0 ) +return PSMOUSE_ELANTECH ; + } + } +if (max_proto >=PSMOUSE_IMEX &&im_explorer_detect (psmouse, set_properties) ==0 )return PSMOUSE_IMEX ;
@@ -762,6 +770,15 @@ static const struct psmouse_protocol psm .detect = touchkit_ps2_detect, },#endif +#ifdef CONFIG_MOUSE_PS2_ELANTECH + { + .type = PSMOUSE_ELANTECH, + .name = "ETPS/2", + .alias = "elantech", + .detect = elantech_detect, + .init = elantech_init, + }, +#endif { .type = PSMOUSE_CORTRON, .name = "CortronPS/2",
drivers/input/mouse/psmouse.h renamed from drivers/input/mouse/psmouse.h~elantech-touchpad-driver +1 -0
@@ -89,6 +89,7 @@ enum psmouse_type {PSMOUSE_TRACKPOINT ,PSMOUSE_TOUCHKIT_PS2 ,PSMOUSE_CORTRON , +PSMOUSE_ELANTECH , PSMOUSE_AUTO /* This one should always be last */ };
_