Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/dtor/input

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
  Input: joydev - allow binding to button-only devices
  Input: elantech - ignore high bits in the position coordinates
  Input: elantech - allow forcing Elantech protocol
  Input: elantech - fix firmware version check
  Input: ati_remote - add some missing devices from lirc_atiusb
  Input: eeti_ts - cancel pending work when going to suspend
  Input: Add support of Synaptics Clickpad device
  Revert "Input: ALPS - add signature for HP Pavilion dm3 laptops"
  Input: psmouse - ignore parity error for basic protocols
  • Loading branch information
torvalds committed May 5, 2010
2 parents 5157b4a + 26a6931 commit 1d7aec3
Show file tree
Hide file tree
Showing 10 changed files with 183 additions and 56 deletions.
8 changes: 4 additions & 4 deletions Documentation/input/elantech.txt
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,14 @@ byte 0:
byte 1:

bit 7 6 5 4 3 2 1 0
x15 x14 x13 x12 x11 x10 x9 x8
. . . . . x10 x9 x8

byte 2:

bit 7 6 5 4 3 2 1 0
x7 x6 x5 x4 x4 x2 x1 x0

x15..x0 = absolute x value (horizontal)
x10..x0 = absolute x value (horizontal)

byte 3:

Expand All @@ -350,14 +350,14 @@ byte 3:
byte 4:

bit 7 6 5 4 3 2 1 0
y15 y14 y13 y12 y11 y10 y8 y8
. . . . . . y9 y8

byte 5:

bit 7 6 5 4 3 2 1 0
y7 y6 y5 y4 y3 y2 y1 y0

y15..y0 = absolute y value (vertical)
y9..y0 = absolute y value (vertical)


4.2.2 Two finger touch
Expand Down
18 changes: 18 additions & 0 deletions drivers/input/joydev.c
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,24 @@ static const struct input_device_id joydev_ids[] = {
.evbit = { BIT_MASK(EV_ABS) },
.absbit = { BIT_MASK(ABS_THROTTLE) },
},
{
.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
INPUT_DEVICE_ID_MATCH_KEYBIT,
.evbit = { BIT_MASK(EV_KEY) },
.keybit = {[BIT_WORD(BTN_JOYSTICK)] = BIT_MASK(BTN_JOYSTICK) },
},
{
.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
INPUT_DEVICE_ID_MATCH_KEYBIT,
.evbit = { BIT_MASK(EV_KEY) },
.keybit = { [BIT_WORD(BTN_GAMEPAD)] = BIT_MASK(BTN_GAMEPAD) },
},
{
.flags = INPUT_DEVICE_ID_MATCH_EVBIT |
INPUT_DEVICE_ID_MATCH_KEYBIT,
.evbit = { BIT_MASK(EV_KEY) },
.keybit = { [BIT_WORD(BTN_TRIGGER_HAPPY)] = BIT_MASK(BTN_TRIGGER_HAPPY) },
},
{ } /* Terminating entry */
};

Expand Down
14 changes: 9 additions & 5 deletions drivers/input/misc/ati_remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@
* Module and Version Information, Module Parameters
*/

#define ATI_REMOTE_VENDOR_ID 0x0bc7
#define ATI_REMOTE_PRODUCT_ID 0x004
#define LOLA_REMOTE_PRODUCT_ID 0x002
#define MEDION_REMOTE_PRODUCT_ID 0x006
#define ATI_REMOTE_VENDOR_ID 0x0bc7
#define LOLA_REMOTE_PRODUCT_ID 0x0002
#define LOLA2_REMOTE_PRODUCT_ID 0x0003
#define ATI_REMOTE_PRODUCT_ID 0x0004
#define NVIDIA_REMOTE_PRODUCT_ID 0x0005
#define MEDION_REMOTE_PRODUCT_ID 0x0006

#define DRIVER_VERSION "2.2.1"
#define DRIVER_AUTHOR "Torrey Hoffman <[email protected]>"
Expand Down Expand Up @@ -142,8 +144,10 @@ MODULE_PARM_DESC(repeat_delay, "Delay before sending repeats, default = 500 msec
#define err(format, arg...) printk(KERN_ERR format , ## arg)

static struct usb_device_id ati_remote_table[] = {
{ USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID) },
{ USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID) },
{ USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA2_REMOTE_PRODUCT_ID) },
{ USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID) },
{ USB_DEVICE(ATI_REMOTE_VENDOR_ID, NVIDIA_REMOTE_PRODUCT_ID) },
{ USB_DEVICE(ATI_REMOTE_VENDOR_ID, MEDION_REMOTE_PRODUCT_ID) },
{} /* Terminating entry */
};
Expand Down
1 change: 0 additions & 1 deletion drivers/input/mouse/alps.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ static const struct alps_model_info alps_model_data[] = {
{ { 0x62, 0x02, 0x14 }, 0xcf, 0xcf,
ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED },
{ { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */
{ { 0x73, 0x02, 0x64 }, 0xf8, 0xf8, 0 }, /* HP Pavilion dm3 */
{ { 0x52, 0x01, 0x14 }, 0xff, 0xff,
ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */
};
Expand Down
84 changes: 56 additions & 28 deletions drivers/input/mouse/elantech.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
printk(KERN_DEBUG format, ##arg); \
} while (0)

static bool force_elantech;
module_param_named(force_elantech, force_elantech, bool, 0644);
MODULE_PARM_DESC(force_elantech, "Force the Elantech PS/2 protocol extension to be used, 1 = enabled, 0 = disabled (default).");

/*
* Send a Synaptics style sliced query command
*/
Expand Down Expand Up @@ -182,13 +186,17 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)
static int old_fingers;

if (etd->fw_version_maj == 0x01) {
/* byte 0: D U p1 p2 1 p3 R L
byte 1: f 0 th tw x9 x8 y9 y8 */
/*
* byte 0: D U p1 p2 1 p3 R L
* byte 1: f 0 th tw x9 x8 y9 y8
*/
fingers = ((packet[1] & 0x80) >> 7) +
((packet[1] & 0x30) >> 4);
} else {
/* byte 0: n1 n0 p2 p1 1 p3 R L
byte 1: 0 0 0 0 x9 x8 y9 y8 */
/*
* byte 0: n1 n0 p2 p1 1 p3 R L
* byte 1: 0 0 0 0 x9 x8 y9 y8
*/
fingers = (packet[0] & 0xc0) >> 6;
}

Expand All @@ -202,13 +210,15 @@ static void elantech_report_absolute_v1(struct psmouse *psmouse)

input_report_key(dev, BTN_TOUCH, fingers != 0);

/* byte 2: x7 x6 x5 x4 x3 x2 x1 x0
byte 3: y7 y6 y5 y4 y3 y2 y1 y0 */
/*
* byte 2: x7 x6 x5 x4 x3 x2 x1 x0
* byte 3: y7 y6 y5 y4 y3 y2 y1 y0
*/
if (fingers) {
input_report_abs(dev, ABS_X,
((packet[1] & 0x0c) << 6) | packet[2]);
input_report_abs(dev, ABS_Y, ETP_YMAX_V1 -
(((packet[1] & 0x03) << 8) | packet[3]));
input_report_abs(dev, ABS_Y,
ETP_YMAX_V1 - (((packet[1] & 0x03) << 8) | packet[3]));
}

input_report_key(dev, BTN_TOOL_FINGER, fingers == 1);
Expand Down Expand Up @@ -247,34 +257,47 @@ static void elantech_report_absolute_v2(struct psmouse *psmouse)

switch (fingers) {
case 1:
/* byte 1: x15 x14 x13 x12 x11 x10 x9 x8
byte 2: x7 x6 x5 x4 x4 x2 x1 x0 */
input_report_abs(dev, ABS_X, (packet[1] << 8) | packet[2]);
/* byte 4: y15 y14 y13 y12 y11 y10 y8 y8
byte 5: y7 y6 y5 y4 y3 y2 y1 y0 */
input_report_abs(dev, ABS_Y, ETP_YMAX_V2 -
((packet[4] << 8) | packet[5]));
/*
* byte 1: . . . . . x10 x9 x8
* byte 2: x7 x6 x5 x4 x4 x2 x1 x0
*/
input_report_abs(dev, ABS_X,
((packet[1] & 0x07) << 8) | packet[2]);
/*
* byte 4: . . . . . . y9 y8
* byte 5: y7 y6 y5 y4 y3 y2 y1 y0
*/
input_report_abs(dev, ABS_Y,
ETP_YMAX_V2 - (((packet[4] & 0x03) << 8) | packet[5]));
break;

case 2:
/* The coordinate of each finger is reported separately with
a lower resolution for two finger touches */
/* byte 0: . . ay8 ax8 . . . .
byte 1: ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0 */
/*
* The coordinate of each finger is reported separately
* with a lower resolution for two finger touches:
* byte 0: . . ay8 ax8 . . . .
* byte 1: ax7 ax6 ax5 ax4 ax3 ax2 ax1 ax0
*/
x1 = ((packet[0] & 0x10) << 4) | packet[1];
/* byte 2: ay7 ay6 ay5 ay4 ay3 ay2 ay1 ay0 */
y1 = ETP_2FT_YMAX - (((packet[0] & 0x20) << 3) | packet[2]);
/* byte 3: . . by8 bx8 . . . .
byte 4: bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0 */
/*
* byte 3: . . by8 bx8 . . . .
* byte 4: bx7 bx6 bx5 bx4 bx3 bx2 bx1 bx0
*/
x2 = ((packet[3] & 0x10) << 4) | packet[4];
/* byte 5: by7 by8 by5 by4 by3 by2 by1 by0 */
y2 = ETP_2FT_YMAX - (((packet[3] & 0x20) << 3) | packet[5]);
/* For compatibility with the X Synaptics driver scale up one
coordinate and report as ordinary mouse movent */
/*
* For compatibility with the X Synaptics driver scale up
* one coordinate and report as ordinary mouse movent
*/
input_report_abs(dev, ABS_X, x1 << 2);
input_report_abs(dev, ABS_Y, y1 << 2);
/* For compatibility with the proprietary X Elantech driver
report both coordinates as hat coordinates */
/*
* For compatibility with the proprietary X Elantech driver
* report both coordinates as hat coordinates
*/
input_report_abs(dev, ABS_HAT0X, x1);
input_report_abs(dev, ABS_HAT0Y, y1);
input_report_abs(dev, ABS_HAT1X, x2);
Expand Down Expand Up @@ -596,8 +619,12 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
param[0], param[1], param[2]);

if (param[0] == 0 || param[1] != 0) {
pr_debug("elantech.c: Probably not a real Elantech touchpad. Aborting.\n");
return -1;
if (!force_elantech) {
pr_debug("elantech.c: Probably not a real Elantech touchpad. Aborting.\n");
return -1;
}

pr_debug("elantech.c: Probably not a real Elantech touchpad. Enabling anyway due to force_elantech.\n");
}

if (set_properties) {
Expand Down Expand Up @@ -666,7 +693,8 @@ int elantech_init(struct psmouse *psmouse)
* Assume every version greater than this is new EeePC style
* hardware with 6 byte packets
*/
if (etd->fw_version_maj >= 0x02 && etd->fw_version_min >= 0x30) {
if ((etd->fw_version_maj == 0x02 && etd->fw_version_min >= 0x30) ||
etd->fw_version_maj > 0x02) {
etd->hw_version = 2;
/* For now show extra debug information */
etd->debug = 1;
Expand Down
18 changes: 15 additions & 3 deletions drivers/input/mouse/psmouse-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ static struct workqueue_struct *kpsmoused_wq;
struct psmouse_protocol {
enum psmouse_type type;
bool maxproto;
bool ignore_parity; /* Protocol should ignore parity errors from KBC */
const char *name;
const char *alias;
int (*detect)(struct psmouse *, bool);
Expand Down Expand Up @@ -288,7 +289,9 @@ static irqreturn_t psmouse_interrupt(struct serio *serio,
if (psmouse->state == PSMOUSE_IGNORE)
goto out;

if (flags & (SERIO_PARITY|SERIO_TIMEOUT)) {
if (unlikely((flags & SERIO_TIMEOUT) ||
((flags & SERIO_PARITY) && !psmouse->ignore_parity))) {

if (psmouse->state == PSMOUSE_ACTIVATED)
printk(KERN_WARNING "psmouse.c: bad data from KBC -%s%s\n",
flags & SERIO_TIMEOUT ? " timeout" : "",
Expand Down Expand Up @@ -759,6 +762,7 @@ static const struct psmouse_protocol psmouse_protocols[] = {
.name = "PS/2",
.alias = "bare",
.maxproto = true,
.ignore_parity = true,
.detect = ps2bare_detect,
},
#ifdef CONFIG_MOUSE_PS2_LOGIPS2PP
Expand Down Expand Up @@ -786,13 +790,15 @@ static const struct psmouse_protocol psmouse_protocols[] = {
.name = "ImPS/2",
.alias = "imps",
.maxproto = true,
.ignore_parity = true,
.detect = intellimouse_detect,
},
{
.type = PSMOUSE_IMEX,
.name = "ImExPS/2",
.alias = "exps",
.maxproto = true,
.ignore_parity = true,
.detect = im_explorer_detect,
},
#ifdef CONFIG_MOUSE_PS2_SYNAPTICS
Expand Down Expand Up @@ -1222,6 +1228,7 @@ static void psmouse_disconnect(struct serio *serio)
static int psmouse_switch_protocol(struct psmouse *psmouse,
const struct psmouse_protocol *proto)
{
const struct psmouse_protocol *selected_proto;
struct input_dev *input_dev = psmouse->dev;

input_dev->dev.parent = &psmouse->ps2dev.serio->dev;
Expand All @@ -1245,9 +1252,14 @@ static int psmouse_switch_protocol(struct psmouse *psmouse,
return -1;

psmouse->type = proto->type;
} else
selected_proto = proto;
} else {
psmouse->type = psmouse_extensions(psmouse,
psmouse_max_proto, true);
selected_proto = psmouse_protocol_by_type(psmouse->type);
}

psmouse->ignore_parity = selected_proto->ignore_parity;

/*
* If mouse's packet size is 3 there is no point in polling the
Expand All @@ -1267,7 +1279,7 @@ static int psmouse_switch_protocol(struct psmouse *psmouse,
psmouse->resync_time = 0;

snprintf(psmouse->devname, sizeof(psmouse->devname), "%s %s %s",
psmouse_protocol_by_type(psmouse->type)->name, psmouse->vendor, psmouse->name);
selected_proto->name, psmouse->vendor, psmouse->name);

input_dev->name = psmouse->devname;
input_dev->phys = psmouse->phys;
Expand Down
1 change: 1 addition & 0 deletions drivers/input/mouse/psmouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct psmouse {
unsigned char pktcnt;
unsigned char pktsize;
unsigned char type;
bool ignore_parity;
bool acks_disable_command;
unsigned int model;
unsigned long last;
Expand Down
Loading

0 comments on commit 1d7aec3

Please sign in to comment.