Skip to content

Commit a230e95

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input subsystem fixes from Dmitry Torokhov: "Just small ALPS and Elan touchpads, and other driver fixups" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: elantech - add special check for fw_version 0x470f01 touchpad Input: twl4030-vibra - fix ERROR: Bad of_node_put() warning Input: alps - only Dell laptops have separate button bits for v2 dualpoint sticks Input: axp20x-pek - add module alias Input: turbografx - fix potential out of bound access
2 parents 3fbdc37 + 6b30c73 commit a230e95

File tree

7 files changed

+35
-8
lines changed

7 files changed

+35
-8
lines changed

Documentation/input/alps.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,10 @@ ALPS Absolute Mode - Protocol Version 2
119119
byte 5: 0 z6 z5 z4 z3 z2 z1 z0
120120

121121
Protocol Version 2 DualPoint devices send standard PS/2 mouse packets for
122-
the DualPoint Stick. For non interleaved dualpoint devices the pointingstick
123-
buttons get reported separately in the PSM, PSR and PSL bits.
122+
the DualPoint Stick. The M, R and L bits signal the combined status of both
123+
the pointingstick and touchpad buttons, except for Dell dualpoint devices
124+
where the pointingstick buttons get reported separately in the PSM, PSR
125+
and PSL bits.
124126

125127
Dualpoint device -- interleaved packet format
126128
---------------------------------------------

drivers/input/joystick/turbografx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs)
196196
if (n_buttons[i] < 1)
197197
continue;
198198

199-
if (n_buttons[i] > 6) {
199+
if (n_buttons[i] > ARRAY_SIZE(tgfx_buttons)) {
200200
printk(KERN_ERR "turbografx.c: Invalid number of buttons %d\n", n_buttons[i]);
201201
err = -EINVAL;
202202
goto err_unreg_devs;

drivers/input/misc/axp20x-pek.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,3 +292,4 @@ module_platform_driver(axp20x_pek_driver);
292292
MODULE_DESCRIPTION("axp20x Power Button");
293293
MODULE_AUTHOR("Carlo Caione <carlo@caione.org>");
294294
MODULE_LICENSE("GPL");
295+
MODULE_ALIAS("platform:axp20x-pek");

drivers/input/misc/twl4030-vibra.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ static bool twl4030_vibra_check_coexist(struct twl4030_vibra_data *pdata,
183183
if (pdata && pdata->coexist)
184184
return true;
185185

186-
if (of_find_node_by_name(node, "codec")) {
186+
node = of_find_node_by_name(node, "codec");
187+
if (node) {
187188
of_node_put(node);
188189
return true;
189190
}

drivers/input/mouse/alps.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/input/mt.h>
2121
#include <linux/serio.h>
2222
#include <linux/libps2.h>
23+
#include <linux/dmi.h>
2324

2425
#include "psmouse.h"
2526
#include "alps.h"
@@ -99,6 +100,7 @@ static const struct alps_nibble_commands alps_v6_nibble_commands[] = {
99100
#define ALPS_FOUR_BUTTONS 0x40 /* 4 direction button present */
100101
#define ALPS_PS2_INTERLEAVED 0x80 /* 3-byte PS/2 packet interleaved with
101102
6-byte ALPS packet */
103+
#define ALPS_DELL 0x100 /* device is a Dell laptop */
102104
#define ALPS_BUTTONPAD 0x200 /* device is a clickpad */
103105

104106
static const struct alps_model_info alps_model_data[] = {
@@ -251,9 +253,9 @@ static void alps_process_packet_v1_v2(struct psmouse *psmouse)
251253
return;
252254
}
253255

254-
/* Non interleaved V2 dualpoint has separate stick button bits */
256+
/* Dell non interleaved V2 dualpoint has separate stick button bits */
255257
if (priv->proto_version == ALPS_PROTO_V2 &&
256-
priv->flags == (ALPS_PASS | ALPS_DUALPOINT)) {
258+
priv->flags == (ALPS_DELL | ALPS_PASS | ALPS_DUALPOINT)) {
257259
left |= packet[0] & 1;
258260
right |= packet[0] & 2;
259261
middle |= packet[0] & 4;
@@ -2550,6 +2552,8 @@ static int alps_set_protocol(struct psmouse *psmouse,
25502552
priv->byte0 = protocol->byte0;
25512553
priv->mask0 = protocol->mask0;
25522554
priv->flags = protocol->flags;
2555+
if (dmi_name_in_vendors("Dell"))
2556+
priv->flags |= ALPS_DELL;
25532557

25542558
priv->x_max = 2000;
25552559
priv->y_max = 1400;

drivers/input/mouse/elantech.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,19 +783,26 @@ static int elantech_packet_check_v4(struct psmouse *psmouse)
783783
struct elantech_data *etd = psmouse->private;
784784
unsigned char *packet = psmouse->packet;
785785
unsigned char packet_type = packet[3] & 0x03;
786+
unsigned int ic_version;
786787
bool sanity_check;
787788

788789
if (etd->tp_dev && (packet[3] & 0x0f) == 0x06)
789790
return PACKET_TRACKPOINT;
790791

792+
/* This represents the version of IC body. */
793+
ic_version = (etd->fw_version & 0x0f0000) >> 16;
794+
791795
/*
792796
* Sanity check based on the constant bits of a packet.
793797
* The constant bits change depending on the value of
794-
* the hardware flag 'crc_enabled' but are the same for
795-
* every packet, regardless of the type.
798+
* the hardware flag 'crc_enabled' and the version of
799+
* the IC body, but are the same for every packet,
800+
* regardless of the type.
796801
*/
797802
if (etd->crc_enabled)
798803
sanity_check = ((packet[3] & 0x08) == 0x00);
804+
else if (ic_version == 7 && etd->samples[1] == 0x2A)
805+
sanity_check = ((packet[3] & 0x1c) == 0x10);
799806
else
800807
sanity_check = ((packet[0] & 0x0c) == 0x04 &&
801808
(packet[3] & 0x1c) == 0x10);
@@ -1116,6 +1123,7 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse,
11161123
* Avatar AVIU-145A2 0x361f00 ? clickpad
11171124
* Fujitsu LIFEBOOK E544 0x470f00 d0, 12, 09 2 hw buttons
11181125
* Fujitsu LIFEBOOK E554 0x570f01 40, 14, 0c 2 hw buttons
1126+
* Fujitsu T725 0x470f01 05, 12, 09 2 hw buttons
11191127
* Fujitsu H730 0x570f00 c0, 14, 0c 3 hw buttons (**)
11201128
* Gigabyte U2442 0x450f01 58, 17, 0c 2 hw buttons
11211129
* Lenovo L430 0x350f02 b9, 15, 0c 2 hw buttons (*)
@@ -1651,6 +1659,16 @@ int elantech_init(struct psmouse *psmouse)
16511659
etd->capabilities[0], etd->capabilities[1],
16521660
etd->capabilities[2]);
16531661

1662+
if (etd->hw_version != 1) {
1663+
if (etd->send_cmd(psmouse, ETP_SAMPLE_QUERY, etd->samples)) {
1664+
psmouse_err(psmouse, "failed to query sample data\n");
1665+
goto init_fail;
1666+
}
1667+
psmouse_info(psmouse,
1668+
"Elan sample query result %02x, %02x, %02x\n",
1669+
etd->samples[0], etd->samples[1], etd->samples[2]);
1670+
}
1671+
16541672
if (elantech_set_absolute_mode(psmouse)) {
16551673
psmouse_err(psmouse,
16561674
"failed to put touchpad into absolute mode.\n");

drivers/input/mouse/elantech.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ struct elantech_data {
129129
unsigned char reg_26;
130130
unsigned char debug;
131131
unsigned char capabilities[3];
132+
unsigned char samples[3];
132133
bool paritycheck;
133134
bool jumpy_cursor;
134135
bool reports_pressure;

0 commit comments

Comments
 (0)