Commit a86a8e7e authored by Peter Osterlund's avatar Peter Osterlund Committed by Vojtech Pavlik

input: Add ALPS touchpad driver, driver by Neil Brown, Peter Osterlund

       and Dmitry Torokhov, some fixes by Vojtech Pavlik.
Signed-off-by: default avatarVojtech Pavlik <vojtech@suse.cz>
Patch-by: default avatarPeter Osterlund <petero2@telia.com>
parent 3fdeafe9
...@@ -14,4 +14,4 @@ obj-$(CONFIG_MOUSE_PS2) += psmouse.o ...@@ -14,4 +14,4 @@ obj-$(CONFIG_MOUSE_PS2) += psmouse.o
obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o obj-$(CONFIG_MOUSE_SERIAL) += sermouse.o
obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o obj-$(CONFIG_MOUSE_VSXXXAA) += vsxxxaa.o
psmouse-objs := psmouse-base.o logips2pp.o synaptics.o psmouse-objs := psmouse-base.o alps.o logips2pp.o synaptics.o
This diff is collapsed.
/*
* ALPS touchpad PS/2 mouse driver
*
* Copyright (c) 2003 Peter Osterlund <petero2@telia.com>
*
* 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.
*/
#ifndef _ALPS_H
#define _ALPS_H
int alps_detect(struct psmouse *psmouse);
int alps_init(struct psmouse *psmouse);
#endif
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* PS/2 mouse driver * PS/2 mouse driver
* *
* Copyright (c) 1999-2002 Vojtech Pavlik * Copyright (c) 1999-2002 Vojtech Pavlik
* Copyright (c) 2003-2004 Dmitry Torokhov
*/ */
/* /*
...@@ -21,6 +22,7 @@ ...@@ -21,6 +22,7 @@
#include "psmouse.h" #include "psmouse.h"
#include "synaptics.h" #include "synaptics.h"
#include "logips2pp.h" #include "logips2pp.h"
#include "alps.h"
#define DRIVER_DESC "PS/2 mouse driver" #define DRIVER_DESC "PS/2 mouse driver"
...@@ -55,7 +57,7 @@ __obsolete_setup("psmouse_smartscroll="); ...@@ -55,7 +57,7 @@ __obsolete_setup("psmouse_smartscroll=");
__obsolete_setup("psmouse_resetafter="); __obsolete_setup("psmouse_resetafter=");
__obsolete_setup("psmouse_rate="); __obsolete_setup("psmouse_rate=");
static char *psmouse_protocols[] = { "None", "PS/2", "PS2++", "PS2T++", "ThinkPS/2", "GenPS/2", "ImPS/2", "ImExPS/2", "SynPS/2"}; static char *psmouse_protocols[] = { "None", "PS/2", "PS2++", "PS2T++", "ThinkPS/2", "GenPS/2", "ImPS/2", "ImExPS/2", "SynPS/2", "AlpsPS/2" };
/* /*
* psmouse_process_byte() analyzes the PS/2 data stream and reports * psmouse_process_byte() analyzes the PS/2 data stream and reports
...@@ -539,6 +541,25 @@ static int psmouse_extensions(struct psmouse *psmouse, ...@@ -539,6 +541,25 @@ static int psmouse_extensions(struct psmouse *psmouse,
synaptics_reset(psmouse); synaptics_reset(psmouse);
} }
/*
* Try ALPS TouchPad
*/
if (max_proto > PSMOUSE_IMEX && alps_detect(psmouse)) {
if (set_properties) {
psmouse->vendor = "ALPS";
psmouse->name = "TouchPad";
}
if (!set_properties || alps_init(psmouse) == 0)
return PSMOUSE_ALPS;
/*
* Init failed, try basic relative protocols
*/
max_proto = PSMOUSE_IMEX;
}
if (max_proto > PSMOUSE_IMEX && genius_detect(psmouse)) { if (max_proto > PSMOUSE_IMEX && genius_detect(psmouse)) {
if (set_properties) { if (set_properties) {
......
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
#define _PSMOUSE_H #define _PSMOUSE_H
#define PSMOUSE_CMD_SETSCALE11 0x00e6 #define PSMOUSE_CMD_SETSCALE11 0x00e6
#define PSMOUSE_CMD_SETSCALE21 0x00e7
#define PSMOUSE_CMD_SETRES 0x10e8 #define PSMOUSE_CMD_SETRES 0x10e8
#define PSMOUSE_CMD_GETINFO 0x03e9 #define PSMOUSE_CMD_GETINFO 0x03e9
#define PSMOUSE_CMD_SETSTREAM 0x00ea #define PSMOUSE_CMD_SETSTREAM 0x00ea
#define PSMOUSE_CMD_SETPOLL 0x00f0
#define PSMOUSE_CMD_POLL 0x03eb #define PSMOUSE_CMD_POLL 0x03eb
#define PSMOUSE_CMD_GETID 0x02f2 #define PSMOUSE_CMD_GETID 0x02f2
#define PSMOUSE_CMD_SETRATE 0x10f3 #define PSMOUSE_CMD_SETRATE 0x10f3
...@@ -79,6 +81,7 @@ enum psmouse_type { ...@@ -79,6 +81,7 @@ enum psmouse_type {
PSMOUSE_IMPS, PSMOUSE_IMPS,
PSMOUSE_IMEX, PSMOUSE_IMEX,
PSMOUSE_SYNAPTICS, PSMOUSE_SYNAPTICS,
PSMOUSE_ALPS,
}; };
int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command); int psmouse_command(struct psmouse *psmouse, unsigned char *param, int command);
......
...@@ -115,20 +115,26 @@ static struct mousedev mousedev_mix; ...@@ -115,20 +115,26 @@ static struct mousedev mousedev_mix;
#define fx(i) (mousedev->old_x[(mousedev->pkt_count - (i)) & 03]) #define fx(i) (mousedev->old_x[(mousedev->pkt_count - (i)) & 03])
#define fy(i) (mousedev->old_y[(mousedev->pkt_count - (i)) & 03]) #define fy(i) (mousedev->old_y[(mousedev->pkt_count - (i)) & 03])
static void mousedev_touchpad_event(struct mousedev *mousedev, unsigned int code, int value) static void mousedev_touchpad_event(struct input_dev *dev, struct mousedev *mousedev, unsigned int code, int value)
{ {
int size;
if (mousedev->touch) { if (mousedev->touch) {
switch (code) { switch (code) {
case ABS_X: case ABS_X:
size = dev->absmax[ABS_X] - dev->absmin[ABS_X];
if (size == 0) size = xres;
fx(0) = value; fx(0) = value;
if (mousedev->pkt_count >= 2) if (mousedev->pkt_count >= 2)
mousedev->packet.dx = ((fx(0) - fx(1)) / 2 + (fx(1) - fx(2)) / 2) / 8; mousedev->packet.dx = ((fx(0) - fx(1)) / 2 + (fx(1) - fx(2)) / 2) * xres / (size * 2);
break; break;
case ABS_Y: case ABS_Y:
size = dev->absmax[ABS_Y] - dev->absmin[ABS_Y];
if (size == 0) size = yres;
fy(0) = value; fy(0) = value;
if (mousedev->pkt_count >= 2) if (mousedev->pkt_count >= 2)
mousedev->packet.dy = -((fy(0) - fy(1)) / 2 + (fy(1) - fy(2)) / 2) / 8; mousedev->packet.dy = -((fy(0) - fy(1)) / 2 + (fy(1) - fy(2)) / 2) * yres / (size * 2);
break; break;
} }
} }
...@@ -279,7 +285,7 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig ...@@ -279,7 +285,7 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig
return; return;
if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit)) if (test_bit(BTN_TOOL_FINGER, handle->dev->keybit))
mousedev_touchpad_event(mousedev, code, value); mousedev_touchpad_event(handle->dev, mousedev, code, value);
else else
mousedev_abs_event(handle->dev, mousedev, code, value); mousedev_abs_event(handle->dev, mousedev, code, value);
......
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