Commit 2a0bd75e authored by Arjan Opmeer's avatar Arjan Opmeer Committed by Dmitry Torokhov

Input: psmouse - add support for Elantech touchpads

This is version 5 of the driver. Relative mode support has been
dropped (users wishing to use touchpad in relative mode can use
standard PS/2 protocol emulation done in hardware). The driver
supports both original version of Elantech protocol and the newer
one used by touchpads installed in EeePC.
Signed-off-by: default avatarArjan Opmeer <arjan@opmeer.net>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 2c6f2cb8
This diff is collapsed.
...@@ -25,8 +25,8 @@ config MOUSE_PS2 ...@@ -25,8 +25,8 @@ config MOUSE_PS2
mice with wheels and extra buttons, Microsoft, Logitech or Genius mice with wheels and extra buttons, Microsoft, Logitech or Genius
compatible. compatible.
Synaptics TouchPad users might be interested in a specialized Synaptics, ALPS or Elantech TouchPad users might be interested
XFree86 driver at: in a specialized Xorg/XFree86 driver at:
<http://w1.894.telia.com/~u89404340/touchpad/index.html> <http://w1.894.telia.com/~u89404340/touchpad/index.html>
and a new version of GPM at: and a new version of GPM at:
<http://www.geocities.com/dt_or/gpm/gpm.html> <http://www.geocities.com/dt_or/gpm/gpm.html>
...@@ -87,6 +87,27 @@ config MOUSE_PS2_TRACKPOINT ...@@ -87,6 +87,27 @@ config MOUSE_PS2_TRACKPOINT
If unsure, say Y. If unsure, say Y.
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.
Note that if you enable this driver you will need an updated
X.org Synaptics driver that does not require ABS_PRESSURE
reports from the touchpad (i.e. post 1.5.0 version). You can
grab a patch for the driver here:
http://userweb.kernel.org/~dtor/synaptics-no-abspressure.patch
If unsure, say N.
This driver exposes some configuration registers via sysfs
entries. For further information,
see <file:Documentation/input/elantech.txt>.
config MOUSE_PS2_TOUCHKIT config MOUSE_PS2_TOUCHKIT
bool "eGalax TouchKit PS/2 protocol extension" bool "eGalax TouchKit PS/2 protocol extension"
depends on MOUSE_PS2 depends on MOUSE_PS2
......
...@@ -21,6 +21,7 @@ obj-$(CONFIG_MOUSE_GPIO) += gpio_mouse.o ...@@ -21,6 +21,7 @@ obj-$(CONFIG_MOUSE_GPIO) += gpio_mouse.o
psmouse-objs := psmouse-base.o synaptics.o psmouse-objs := psmouse-base.o synaptics.o
psmouse-$(CONFIG_MOUSE_PS2_ALPS) += alps.o psmouse-$(CONFIG_MOUSE_PS2_ALPS) += alps.o
psmouse-$(CONFIG_MOUSE_PS2_ELANTECH) += elantech.o
psmouse-$(CONFIG_MOUSE_PS2_OLPC) += hgpk.o psmouse-$(CONFIG_MOUSE_PS2_OLPC) += hgpk.o
psmouse-$(CONFIG_MOUSE_PS2_LOGIPS2PP) += logips2pp.o psmouse-$(CONFIG_MOUSE_PS2_LOGIPS2PP) += logips2pp.o
psmouse-$(CONFIG_MOUSE_PS2_LIFEBOOK) += lifebook.o psmouse-$(CONFIG_MOUSE_PS2_LIFEBOOK) += lifebook.o
......
This diff is collapsed.
/*
* Elantech Touchpad driver (v5)
*
* Copyright (C) 2007-2008 Arjan Opmeer <arjan@opmeer.net>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published
* by the Free Software Foundation.
*
* Trademarks are the property of their respective owners.
*/
#ifndef _ELANTECH_H
#define _ELANTECH_H
/*
* Command values for Synaptics style queries
*/
#define ETP_FW_VERSION_QUERY 0x01
#define ETP_CAPABILITIES_QUERY 0x02
/*
* Command values for register reading or writing
*/
#define ETP_REGISTER_READ 0x10
#define ETP_REGISTER_WRITE 0x11
/*
* Hardware version 2 custom PS/2 command value
*/
#define ETP_PS2_CUSTOM_COMMAND 0xf8
/*
* Times to retry a ps2_command and millisecond delay between tries
*/
#define ETP_PS2_COMMAND_TRIES 3
#define ETP_PS2_COMMAND_DELAY 500
/*
* Times to try to read back a register and millisecond delay between tries
*/
#define ETP_READ_BACK_TRIES 5
#define ETP_READ_BACK_DELAY 2000
/*
* Register bitmasks for hardware version 1
*/
#define ETP_R10_ABSOLUTE_MODE 0x04
#define ETP_R11_4_BYTE_MODE 0x02
/*
* Capability bitmasks
*/
#define ETP_CAP_HAS_ROCKER 0x04
/*
* One hard to find application note states that X axis range is 0 to 576
* and Y axis range is 0 to 384 for harware version 1.
* Edge fuzz might be necessary because of bezel around the touchpad
*/
#define ETP_EDGE_FUZZ_V1 32
#define ETP_XMIN_V1 ( 0 + ETP_EDGE_FUZZ_V1)
#define ETP_XMAX_V1 (576 - ETP_EDGE_FUZZ_V1)
#define ETP_YMIN_V1 ( 0 + ETP_EDGE_FUZZ_V1)
#define ETP_YMAX_V1 (384 - ETP_EDGE_FUZZ_V1)
/*
* It seems the resolution for hardware version 2 doubled.
* Hence the X and Y ranges are doubled too.
* The bezel around the pad also appears to be smaller
*/
#define ETP_EDGE_FUZZ_V2 8
#define ETP_XMIN_V2 ( 0 + ETP_EDGE_FUZZ_V2)
#define ETP_XMAX_V2 (1152 - ETP_EDGE_FUZZ_V2)
#define ETP_YMIN_V2 ( 0 + ETP_EDGE_FUZZ_V2)
#define ETP_YMAX_V2 ( 768 - ETP_EDGE_FUZZ_V2)
/*
* For two finger touches the coordinate of each finger gets reported
* separately but with reduced resolution.
*/
#define ETP_2FT_FUZZ 4
#define ETP_2FT_XMIN ( 0 + ETP_2FT_FUZZ)
#define ETP_2FT_XMAX (288 - ETP_2FT_FUZZ)
#define ETP_2FT_YMIN ( 0 + ETP_2FT_FUZZ)
#define ETP_2FT_YMAX (192 - ETP_2FT_FUZZ)
struct elantech_data {
unsigned char reg_10;
unsigned char reg_11;
unsigned char reg_20;
unsigned char reg_21;
unsigned char reg_22;
unsigned char reg_23;
unsigned char reg_24;
unsigned char reg_25;
unsigned char reg_26;
unsigned char debug;
unsigned char capabilities;
unsigned char fw_version_maj;
unsigned char fw_version_min;
unsigned char hw_version;
unsigned char paritycheck;
unsigned char parity[256];
};
#ifdef CONFIG_MOUSE_PS2_ELANTECH
int elantech_detect(struct psmouse *psmouse, int set_properties);
int elantech_init(struct psmouse *psmouse);
#else
static inline int elantech_detect(struct psmouse *psmouse, int set_properties)
{
return -ENOSYS;
}
static inline int elantech_init(struct psmouse *psmouse)
{
return -ENOSYS;
}
#endif /* CONFIG_MOUSE_PS2_ELANTECH */
#endif
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "lifebook.h" #include "lifebook.h"
#include "trackpoint.h" #include "trackpoint.h"
#include "touchkit_ps2.h" #include "touchkit_ps2.h"
#include "elantech.h"
#define DRIVER_DESC "PS/2 mouse driver" #define DRIVER_DESC "PS/2 mouse driver"
...@@ -650,6 +651,19 @@ static int psmouse_extensions(struct psmouse *psmouse, ...@@ -650,6 +651,19 @@ static int psmouse_extensions(struct psmouse *psmouse,
max_proto = PSMOUSE_IMEX; max_proto = PSMOUSE_IMEX;
} }
/*
* Try Elantech touchpad.
*/
if (max_proto > PSMOUSE_IMEX &&
elantech_detect(psmouse, set_properties) == 0) {
if (!set_properties || elantech_init(psmouse) == 0)
return PSMOUSE_ELANTECH;
/*
* Init failed, try basic relative protocols
*/
max_proto = PSMOUSE_IMEX;
}
if (max_proto > PSMOUSE_IMEX) { if (max_proto > PSMOUSE_IMEX) {
if (genius_detect(psmouse, set_properties) == 0) if (genius_detect(psmouse, set_properties) == 0)
return PSMOUSE_GENPS; return PSMOUSE_GENPS;
...@@ -789,6 +803,15 @@ static const struct psmouse_protocol psmouse_protocols[] = { ...@@ -789,6 +803,15 @@ static const struct psmouse_protocol psmouse_protocols[] = {
.detect = hgpk_detect, .detect = hgpk_detect,
}, },
#endif #endif
#ifdef CONFIG_MOUSE_PS2_ELANTECH
{
.type = PSMOUSE_ELANTECH,
.name = "ETPS/2",
.alias = "elantech",
.detect = elantech_detect,
.init = elantech_init,
},
#endif
{ {
.type = PSMOUSE_CORTRON, .type = PSMOUSE_CORTRON,
.name = "CortronPS/2", .name = "CortronPS/2",
......
...@@ -90,6 +90,7 @@ enum psmouse_type { ...@@ -90,6 +90,7 @@ enum psmouse_type {
PSMOUSE_TOUCHKIT_PS2, PSMOUSE_TOUCHKIT_PS2,
PSMOUSE_CORTRON, PSMOUSE_CORTRON,
PSMOUSE_HGPK, PSMOUSE_HGPK,
PSMOUSE_ELANTECH,
PSMOUSE_AUTO /* This one should always be last */ PSMOUSE_AUTO /* This one should always be last */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment