qubes-linux-kernel/patches.suse/linux-2.6.29-touchkit.patch
2010-07-07 13:12:45 +02:00

136 lines
4.0 KiB
Diff

From: someone at intel <someone@intel.com>
Subject: some new touch screen device ids
Patch-mainline: not yet
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/input/mouse/psmouse-base.c | 9 +++++++
drivers/input/mouse/psmouse.h | 1
drivers/input/mouse/touchkit_ps2.c | 45 +++++++++++++++++++++++++++++++++++--
drivers/input/mouse/touchkit_ps2.h | 6 ++++
4 files changed, 59 insertions(+), 2 deletions(-)
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -703,6 +703,9 @@ static int psmouse_extensions(struct psm
if (touchkit_ps2_detect(psmouse, set_properties) == 0)
return PSMOUSE_TOUCHKIT_PS2;
+
+ if (elftouch_ps2_detect(psmouse, set_properties) == 0)
+ return PSMOUSE_ELFTOUCH_PS2;
}
/*
@@ -828,6 +831,12 @@ static const struct psmouse_protocol psm
.alias = "trackpoint",
.detect = trackpoint_detect,
},
+ {
+ .type = PSMOUSE_ELFTOUCH_PS2,
+ .name = "elftouchPS2",
+ .alias = "elftouch",
+ .detect = elftouch_ps2_detect,
+ },
#endif
#ifdef CONFIG_MOUSE_PS2_TOUCHKIT
{
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -89,6 +89,7 @@ enum psmouse_type {
PSMOUSE_TRACKPOINT,
PSMOUSE_TOUCHKIT_PS2,
PSMOUSE_CORTRON,
+ PSMOUSE_ELFTOUCH_PS2,
PSMOUSE_HGPK,
PSMOUSE_ELANTECH,
PSMOUSE_FSP,
--- a/drivers/input/mouse/touchkit_ps2.c
+++ b/drivers/input/mouse/touchkit_ps2.c
@@ -51,6 +51,11 @@
#define TOUCHKIT_GET_X(packet) (((packet)[1] << 7) | (packet)[2])
#define TOUCHKIT_GET_Y(packet) (((packet)[3] << 7) | (packet)[4])
+#define ELFTOUCH_MAX_XC 0x0fff
+#define ELFTOUCH_MAX_YC 0x0fff
+#define ELFTOUCH_GET_X(packet) (((packet)[3] << 7) | (packet)[4])
+#define ELFTOUCH_GET_Y(packet) (((packet)[1] << 7) | (packet)[2])
+
static psmouse_ret_t touchkit_ps2_process_byte(struct psmouse *psmouse)
{
unsigned char *packet = psmouse->packet;
@@ -59,9 +64,15 @@ static psmouse_ret_t touchkit_ps2_proces
if (psmouse->pktcnt != 5)
return PSMOUSE_GOOD_DATA;
- input_report_abs(dev, ABS_X, TOUCHKIT_GET_X(packet));
- input_report_abs(dev, ABS_Y, TOUCHKIT_GET_Y(packet));
+ if(psmouse->type==PSMOUSE_ELFTOUCH_PS2) {
+ input_report_abs(dev, ABS_X, ELFTOUCH_GET_X(packet));
+ input_report_abs(dev, ABS_Y, ELFTOUCH_GET_Y(packet));
+ } else {
+ input_report_abs(dev, ABS_X, TOUCHKIT_GET_X(packet));
+ input_report_abs(dev, ABS_Y, TOUCHKIT_GET_Y(packet));
+ }
input_report_key(dev, BTN_TOUCH, TOUCHKIT_GET_TOUCHED(packet));
+
input_sync(dev);
return PSMOUSE_FULL_PACKET;
@@ -99,3 +110,33 @@ int touchkit_ps2_detect(struct psmouse *
return 0;
}
+
+int elftouch_ps2_detect(struct psmouse *psmouse, bool set_properties)
+{
+ struct input_dev *dev = psmouse->dev;
+ unsigned char param[16];
+ int command, res;
+
+ param[0]=0x0f4;
+ command = TOUCHKIT_SEND_PARMS(1, 0, TOUCHKIT_CMD);
+ res=ps2_command(&psmouse->ps2dev, param, command);
+ if(res) { return -ENODEV; }
+
+ param[0]=0x0b0;
+ command = TOUCHKIT_SEND_PARMS(1, 1, TOUCHKIT_CMD);
+ res=ps2_command(&psmouse->ps2dev, param, command);
+ if(res) { return -ENODEV; }
+
+ if (set_properties) {
+ dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
+ set_bit(BTN_TOUCH, dev->keybit);
+ input_set_abs_params(dev, ABS_X, 0, ELFTOUCH_MAX_XC, 0, 0);
+ input_set_abs_params(dev, ABS_Y, 0, ELFTOUCH_MAX_YC, 0, 0);
+
+ psmouse->vendor = "ElfTouch";
+ psmouse->name = "Touchscreen";
+ psmouse->protocol_handler = touchkit_ps2_process_byte;
+ psmouse->pktsize = 5;
+ }
+ return 0;
+}
--- a/drivers/input/mouse/touchkit_ps2.h
+++ b/drivers/input/mouse/touchkit_ps2.h
@@ -14,11 +14,17 @@
#ifdef CONFIG_MOUSE_PS2_TOUCHKIT
int touchkit_ps2_detect(struct psmouse *psmouse, bool set_properties);
+int elftouch_ps2_detect(struct psmouse *psmouse, bool set_properties);
#else
static inline int touchkit_ps2_detect(struct psmouse *psmouse,
bool set_properties)
{
return -ENOSYS;
+}
+static inline int elftouch_ps2_detect(struct psmouse *psmouse,
+ bool set_properties)
+{
+ return -ENOSYS;
}
#endif /* CONFIG_MOUSE_PS2_TOUCHKIT */