aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/input/gpio-keys.txt2
-rw-r--r--MAINTAINERS8
-rw-r--r--drivers/input/evdev.c1
-rw-r--r--drivers/input/joystick/xpad.c5
-rw-r--r--drivers/input/keyboard/atakbd.c74
-rw-r--r--drivers/input/misc/uinput.c3
-rw-r--r--drivers/input/mouse/elan_i2c.h2
-rw-r--r--drivers/input/mouse/elan_i2c_core.c7
-rw-r--r--drivers/input/mouse/elan_i2c_smbus.c12
-rw-r--r--drivers/input/mouse/elantech.c13
-rw-r--r--drivers/input/mouse/psmouse-base.c12
-rw-r--r--drivers/input/mousedev.c1
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h7
-rw-r--r--drivers/input/serio/i8042.c29
-rw-r--r--drivers/input/touchscreen/egalax_ts.c6
-rw-r--r--drivers/input/touchscreen/silead.c1
-rw-r--r--include/linux/suspend.h2
-rw-r--r--kernel/power/suspend.c6
18 files changed, 121 insertions, 70 deletions
diff --git a/Documentation/devicetree/bindings/input/gpio-keys.txt b/Documentation/devicetree/bindings/input/gpio-keys.txt
index 996ce84352cb..7cccc49b6bea 100644
--- a/Documentation/devicetree/bindings/input/gpio-keys.txt
+++ b/Documentation/devicetree/bindings/input/gpio-keys.txt
@@ -1,4 +1,4 @@
1Device-Tree bindings for input/gpio_keys.c keyboard driver 1Device-Tree bindings for input/keyboard/gpio_keys.c keyboard driver
2 2
3Required properties: 3Required properties:
4 - compatible = "gpio-keys"; 4 - compatible = "gpio-keys";
diff --git a/MAINTAINERS b/MAINTAINERS
index 18e96de359e4..fb742af44430 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7010,6 +7010,7 @@ F: include/uapi/linux/input.h
7010F: include/uapi/linux/input-event-codes.h 7010F: include/uapi/linux/input-event-codes.h
7011F: include/linux/input/ 7011F: include/linux/input/
7012F: Documentation/devicetree/bindings/input/ 7012F: Documentation/devicetree/bindings/input/
7013F: Documentation/devicetree/bindings/serio/
7013F: Documentation/input/ 7014F: Documentation/input/
7014 7015
7015INPUT MULTITOUCH (MT) PROTOCOL 7016INPUT MULTITOUCH (MT) PROTOCOL
@@ -11044,6 +11045,13 @@ S: Maintained
11044F: include/linux/personality.h 11045F: include/linux/personality.h
11045F: include/uapi/linux/personality.h 11046F: include/uapi/linux/personality.h
11046 11047
11048PHOENIX RC FLIGHT CONTROLLER ADAPTER
11049M: Marcus Folkesson <marcus.folkesson@gmail.com>
11050L: linux-input@vger.kernel.org
11051S: Maintained
11052F: Documentation/input/devices/pxrc.rst
11053F: drivers/input/joystick/pxrc.c
11054
11047PHONET PROTOCOL 11055PHONET PROTOCOL
11048M: Remi Denis-Courmont <courmisch@gmail.com> 11056M: Remi Denis-Courmont <courmisch@gmail.com>
11049S: Supported 11057S: Supported
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 370206f987f9..f48369d6f3a0 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -564,6 +564,7 @@ static ssize_t evdev_write(struct file *file, const char __user *buffer,
564 564
565 input_inject_event(&evdev->handle, 565 input_inject_event(&evdev->handle,
566 event.type, event.code, event.value); 566 event.type, event.code, event.value);
567 cond_resched();
567 } 568 }
568 569
569 out: 570 out:
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 48e36acbeb49..d4b9db487b16 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -125,7 +125,7 @@ static const struct xpad_device {
125 u8 mapping; 125 u8 mapping;
126 u8 xtype; 126 u8 xtype;
127} xpad_device[] = { 127} xpad_device[] = {
128 { 0x0079, 0x18d4, "GPD Win 2 Controller", 0, XTYPE_XBOX360 }, 128 { 0x0079, 0x18d4, "GPD Win 2 X-Box Controller", 0, XTYPE_XBOX360 },
129 { 0x044f, 0x0f00, "Thrustmaster Wheel", 0, XTYPE_XBOX }, 129 { 0x044f, 0x0f00, "Thrustmaster Wheel", 0, XTYPE_XBOX },
130 { 0x044f, 0x0f03, "Thrustmaster Wheel", 0, XTYPE_XBOX }, 130 { 0x044f, 0x0f03, "Thrustmaster Wheel", 0, XTYPE_XBOX },
131 { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX }, 131 { 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX },
@@ -231,6 +231,7 @@ static const struct xpad_device {
231 { 0x0e6f, 0x0246, "Rock Candy Gamepad for Xbox One 2015", 0, XTYPE_XBOXONE }, 231 { 0x0e6f, 0x0246, "Rock Candy Gamepad for Xbox One 2015", 0, XTYPE_XBOXONE },
232 { 0x0e6f, 0x02ab, "PDP Controller for Xbox One", 0, XTYPE_XBOXONE }, 232 { 0x0e6f, 0x02ab, "PDP Controller for Xbox One", 0, XTYPE_XBOXONE },
233 { 0x0e6f, 0x02a4, "PDP Wired Controller for Xbox One - Stealth Series", 0, XTYPE_XBOXONE }, 233 { 0x0e6f, 0x02a4, "PDP Wired Controller for Xbox One - Stealth Series", 0, XTYPE_XBOXONE },
234 { 0x0e6f, 0x02a6, "PDP Wired Controller for Xbox One - Camo Series", 0, XTYPE_XBOXONE },
234 { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 }, 235 { 0x0e6f, 0x0301, "Logic3 Controller", 0, XTYPE_XBOX360 },
235 { 0x0e6f, 0x0346, "Rock Candy Gamepad for Xbox One 2016", 0, XTYPE_XBOXONE }, 236 { 0x0e6f, 0x0346, "Rock Candy Gamepad for Xbox One 2016", 0, XTYPE_XBOXONE },
236 { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 }, 237 { 0x0e6f, 0x0401, "Logic3 Controller", 0, XTYPE_XBOX360 },
@@ -530,6 +531,8 @@ static const struct xboxone_init_packet xboxone_init_packets[] = {
530 XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2), 531 XBOXONE_INIT_PKT(0x0e6f, 0x02ab, xboxone_pdp_init2),
531 XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init1), 532 XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init1),
532 XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init2), 533 XBOXONE_INIT_PKT(0x0e6f, 0x02a4, xboxone_pdp_init2),
534 XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init1),
535 XBOXONE_INIT_PKT(0x0e6f, 0x02a6, xboxone_pdp_init2),
533 XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init), 536 XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init),
534 XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init), 537 XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init),
535 XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init), 538 XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init),
diff --git a/drivers/input/keyboard/atakbd.c b/drivers/input/keyboard/atakbd.c
index 6f62da2909ec..6caee807cafa 100644
--- a/drivers/input/keyboard/atakbd.c
+++ b/drivers/input/keyboard/atakbd.c
@@ -75,8 +75,7 @@ MODULE_LICENSE("GPL");
75 */ 75 */
76 76
77 77
78static unsigned char atakbd_keycode[0x72] = { /* American layout */ 78static unsigned char atakbd_keycode[0x73] = { /* American layout */
79 [0] = KEY_GRAVE,
80 [1] = KEY_ESC, 79 [1] = KEY_ESC,
81 [2] = KEY_1, 80 [2] = KEY_1,
82 [3] = KEY_2, 81 [3] = KEY_2,
@@ -117,9 +116,9 @@ static unsigned char atakbd_keycode[0x72] = { /* American layout */
117 [38] = KEY_L, 116 [38] = KEY_L,
118 [39] = KEY_SEMICOLON, 117 [39] = KEY_SEMICOLON,
119 [40] = KEY_APOSTROPHE, 118 [40] = KEY_APOSTROPHE,
120 [41] = KEY_BACKSLASH, /* FIXME, '#' */ 119 [41] = KEY_GRAVE,
121 [42] = KEY_LEFTSHIFT, 120 [42] = KEY_LEFTSHIFT,
122 [43] = KEY_GRAVE, /* FIXME: '~' */ 121 [43] = KEY_BACKSLASH,
123 [44] = KEY_Z, 122 [44] = KEY_Z,
124 [45] = KEY_X, 123 [45] = KEY_X,
125 [46] = KEY_C, 124 [46] = KEY_C,
@@ -145,45 +144,34 @@ static unsigned char atakbd_keycode[0x72] = { /* American layout */
145 [66] = KEY_F8, 144 [66] = KEY_F8,
146 [67] = KEY_F9, 145 [67] = KEY_F9,
147 [68] = KEY_F10, 146 [68] = KEY_F10,
148 [69] = KEY_ESC, 147 [71] = KEY_HOME,
149 [70] = KEY_DELETE, 148 [72] = KEY_UP,
150 [71] = KEY_KP7,
151 [72] = KEY_KP8,
152 [73] = KEY_KP9,
153 [74] = KEY_KPMINUS, 149 [74] = KEY_KPMINUS,
154 [75] = KEY_KP4, 150 [75] = KEY_LEFT,
155 [76] = KEY_KP5, 151 [77] = KEY_RIGHT,
156 [77] = KEY_KP6,
157 [78] = KEY_KPPLUS, 152 [78] = KEY_KPPLUS,
158 [79] = KEY_KP1, 153 [80] = KEY_DOWN,
159 [80] = KEY_KP2, 154 [82] = KEY_INSERT,
160 [81] = KEY_KP3, 155 [83] = KEY_DELETE,
161 [82] = KEY_KP0,
162 [83] = KEY_KPDOT,
163 [90] = KEY_KPLEFTPAREN,
164 [91] = KEY_KPRIGHTPAREN,
165 [92] = KEY_KPASTERISK, /* FIXME */
166 [93] = KEY_KPASTERISK,
167 [94] = KEY_KPPLUS,
168 [95] = KEY_HELP,
169 [96] = KEY_102ND, 156 [96] = KEY_102ND,
170 [97] = KEY_KPASTERISK, /* FIXME */ 157 [97] = KEY_UNDO,
171 [98] = KEY_KPSLASH, 158 [98] = KEY_HELP,
172 [99] = KEY_KPLEFTPAREN, 159 [99] = KEY_KPLEFTPAREN,
173 [100] = KEY_KPRIGHTPAREN, 160 [100] = KEY_KPRIGHTPAREN,
174 [101] = KEY_KPSLASH, 161 [101] = KEY_KPSLASH,
175 [102] = KEY_KPASTERISK, 162 [102] = KEY_KPASTERISK,
176 [103] = KEY_UP, 163 [103] = KEY_KP7,
177 [104] = KEY_KPASTERISK, /* FIXME */ 164 [104] = KEY_KP8,
178 [105] = KEY_LEFT, 165 [105] = KEY_KP9,
179 [106] = KEY_RIGHT, 166 [106] = KEY_KP4,
180 [107] = KEY_KPASTERISK, /* FIXME */ 167 [107] = KEY_KP5,
181 [108] = KEY_DOWN, 168 [108] = KEY_KP6,
182 [109] = KEY_KPASTERISK, /* FIXME */ 169 [109] = KEY_KP1,
183 [110] = KEY_KPASTERISK, /* FIXME */ 170 [110] = KEY_KP2,
184 [111] = KEY_KPASTERISK, /* FIXME */ 171 [111] = KEY_KP3,
185 [112] = KEY_KPASTERISK, /* FIXME */ 172 [112] = KEY_KP0,
186 [113] = KEY_KPASTERISK /* FIXME */ 173 [113] = KEY_KPDOT,
174 [114] = KEY_KPENTER,
187}; 175};
188 176
189static struct input_dev *atakbd_dev; 177static struct input_dev *atakbd_dev;
@@ -191,21 +179,15 @@ static struct input_dev *atakbd_dev;
191static void atakbd_interrupt(unsigned char scancode, char down) 179static void atakbd_interrupt(unsigned char scancode, char down)
192{ 180{
193 181
194 if (scancode < 0x72) { /* scancodes < 0xf2 are keys */ 182 if (scancode < 0x73) { /* scancodes < 0xf3 are keys */
195 183
196 // report raw events here? 184 // report raw events here?
197 185
198 scancode = atakbd_keycode[scancode]; 186 scancode = atakbd_keycode[scancode];
199 187
200 if (scancode == KEY_CAPSLOCK) { /* CapsLock is a toggle switch key on Amiga */ 188 input_report_key(atakbd_dev, scancode, down);
201 input_report_key(atakbd_dev, scancode, 1); 189 input_sync(atakbd_dev);
202 input_report_key(atakbd_dev, scancode, 0); 190 } else /* scancodes >= 0xf3 are mouse data, most likely */
203 input_sync(atakbd_dev);
204 } else {
205 input_report_key(atakbd_dev, scancode, down);
206 input_sync(atakbd_dev);
207 }
208 } else /* scancodes >= 0xf2 are mouse data, most likely */
209 printk(KERN_INFO "atakbd: unhandled scancode %x\n", scancode); 191 printk(KERN_INFO "atakbd: unhandled scancode %x\n", scancode);
210 192
211 return; 193 return;
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index 96a887f33698..8ec483e8688b 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -410,7 +410,7 @@ static int uinput_validate_absinfo(struct input_dev *dev, unsigned int code,
410 min = abs->minimum; 410 min = abs->minimum;
411 max = abs->maximum; 411 max = abs->maximum;
412 412
413 if ((min != 0 || max != 0) && max <= min) { 413 if ((min != 0 || max != 0) && max < min) {
414 printk(KERN_DEBUG 414 printk(KERN_DEBUG
415 "%s: invalid abs[%02x] min:%d max:%d\n", 415 "%s: invalid abs[%02x] min:%d max:%d\n",
416 UINPUT_NAME, code, min, max); 416 UINPUT_NAME, code, min, max);
@@ -598,6 +598,7 @@ static ssize_t uinput_inject_events(struct uinput_device *udev,
598 598
599 input_event(udev->dev, ev.type, ev.code, ev.value); 599 input_event(udev->dev, ev.type, ev.code, ev.value);
600 bytes += input_event_size(); 600 bytes += input_event_size();
601 cond_resched();
601 } 602 }
602 603
603 return bytes; 604 return bytes;
diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h
index 599544c1a91c..243e0fa6e3e3 100644
--- a/drivers/input/mouse/elan_i2c.h
+++ b/drivers/input/mouse/elan_i2c.h
@@ -27,6 +27,8 @@
27#define ETP_DISABLE_POWER 0x0001 27#define ETP_DISABLE_POWER 0x0001
28#define ETP_PRESSURE_OFFSET 25 28#define ETP_PRESSURE_OFFSET 25
29 29
30#define ETP_CALIBRATE_MAX_LEN 3
31
30/* IAP Firmware handling */ 32/* IAP Firmware handling */
31#define ETP_PRODUCT_ID_FORMAT_STRING "%d.0" 33#define ETP_PRODUCT_ID_FORMAT_STRING "%d.0"
32#define ETP_FW_NAME "elan_i2c_" ETP_PRODUCT_ID_FORMAT_STRING ".bin" 34#define ETP_FW_NAME "elan_i2c_" ETP_PRODUCT_ID_FORMAT_STRING ".bin"
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index 2690a4b7ed53..b0f9d19b3410 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -613,7 +613,7 @@ static ssize_t calibrate_store(struct device *dev,
613 int tries = 20; 613 int tries = 20;
614 int retval; 614 int retval;
615 int error; 615 int error;
616 u8 val[3]; 616 u8 val[ETP_CALIBRATE_MAX_LEN];
617 617
618 retval = mutex_lock_interruptible(&data->sysfs_mutex); 618 retval = mutex_lock_interruptible(&data->sysfs_mutex);
619 if (retval) 619 if (retval)
@@ -1344,6 +1344,11 @@ static const struct acpi_device_id elan_acpi_id[] = {
1344 { "ELAN060B", 0 }, 1344 { "ELAN060B", 0 },
1345 { "ELAN060C", 0 }, 1345 { "ELAN060C", 0 },
1346 { "ELAN0611", 0 }, 1346 { "ELAN0611", 0 },
1347 { "ELAN0612", 0 },
1348 { "ELAN0618", 0 },
1349 { "ELAN061C", 0 },
1350 { "ELAN061D", 0 },
1351 { "ELAN0622", 0 },
1347 { "ELAN1000", 0 }, 1352 { "ELAN1000", 0 },
1348 { } 1353 { }
1349}; 1354};
diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c
index cfcb32559925..88e315d2cfd3 100644
--- a/drivers/input/mouse/elan_i2c_smbus.c
+++ b/drivers/input/mouse/elan_i2c_smbus.c
@@ -56,7 +56,7 @@
56static int elan_smbus_initialize(struct i2c_client *client) 56static int elan_smbus_initialize(struct i2c_client *client)
57{ 57{
58 u8 check[ETP_SMBUS_HELLOPACKET_LEN] = { 0x55, 0x55, 0x55, 0x55, 0x55 }; 58 u8 check[ETP_SMBUS_HELLOPACKET_LEN] = { 0x55, 0x55, 0x55, 0x55, 0x55 };
59 u8 values[ETP_SMBUS_HELLOPACKET_LEN] = { 0, 0, 0, 0, 0 }; 59 u8 values[I2C_SMBUS_BLOCK_MAX] = {0};
60 int len, error; 60 int len, error;
61 61
62 /* Get hello packet */ 62 /* Get hello packet */
@@ -117,12 +117,16 @@ static int elan_smbus_calibrate(struct i2c_client *client)
117static int elan_smbus_calibrate_result(struct i2c_client *client, u8 *val) 117static int elan_smbus_calibrate_result(struct i2c_client *client, u8 *val)
118{ 118{
119 int error; 119 int error;
120 u8 buf[I2C_SMBUS_BLOCK_MAX] = {0};
121
122 BUILD_BUG_ON(ETP_CALIBRATE_MAX_LEN > sizeof(buf));
120 123
121 error = i2c_smbus_read_block_data(client, 124 error = i2c_smbus_read_block_data(client,
122 ETP_SMBUS_CALIBRATE_QUERY, val); 125 ETP_SMBUS_CALIBRATE_QUERY, buf);
123 if (error < 0) 126 if (error < 0)
124 return error; 127 return error;
125 128
129 memcpy(val, buf, ETP_CALIBRATE_MAX_LEN);
126 return 0; 130 return 0;
127} 131}
128 132
@@ -383,7 +387,7 @@ static int elan_smbus_prepare_fw_update(struct i2c_client *client)
383 len = i2c_smbus_read_block_data(client, 387 len = i2c_smbus_read_block_data(client,
384 ETP_SMBUS_IAP_PASSWORD_READ, 388 ETP_SMBUS_IAP_PASSWORD_READ,
385 val); 389 val);
386 if (len < sizeof(u16)) { 390 if (len < (int)sizeof(u16)) {
387 error = len < 0 ? len : -EIO; 391 error = len < 0 ? len : -EIO;
388 dev_err(dev, "failed to read iap password: %d\n", 392 dev_err(dev, "failed to read iap password: %d\n",
389 error); 393 error);
@@ -472,6 +476,8 @@ static int elan_smbus_get_report(struct i2c_client *client, u8 *report)
472{ 476{
473 int len; 477 int len;
474 478
479 BUILD_BUG_ON(I2C_SMBUS_BLOCK_MAX > ETP_SMBUS_REPORT_LEN);
480
475 len = i2c_smbus_read_block_data(client, 481 len = i2c_smbus_read_block_data(client,
476 ETP_SMBUS_PACKET_QUERY, 482 ETP_SMBUS_PACKET_QUERY,
477 &report[ETP_SMBUS_REPORT_OFFSET]); 483 &report[ETP_SMBUS_REPORT_OFFSET]);
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index d443067fc837..2d95e8d93cc7 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -799,7 +799,7 @@ static int elantech_packet_check_v4(struct psmouse *psmouse)
799 else if (ic_version == 7 && etd->info.samples[1] == 0x2A) 799 else if (ic_version == 7 && etd->info.samples[1] == 0x2A)
800 sanity_check = ((packet[3] & 0x1c) == 0x10); 800 sanity_check = ((packet[3] & 0x1c) == 0x10);
801 else 801 else
802 sanity_check = ((packet[0] & 0x0c) == 0x04 && 802 sanity_check = ((packet[0] & 0x08) == 0x00 &&
803 (packet[3] & 0x1c) == 0x10); 803 (packet[3] & 0x1c) == 0x10);
804 804
805 if (!sanity_check) 805 if (!sanity_check)
@@ -1175,6 +1175,14 @@ static const struct dmi_system_id elantech_dmi_has_middle_button[] = {
1175 { } 1175 { }
1176}; 1176};
1177 1177
1178static const char * const middle_button_pnp_ids[] = {
1179 "LEN2131", /* ThinkPad P52 w/ NFC */
1180 "LEN2132", /* ThinkPad P52 */
1181 "LEN2133", /* ThinkPad P72 w/ NFC */
1182 "LEN2134", /* ThinkPad P72 */
1183 NULL
1184};
1185
1178/* 1186/*
1179 * Set the appropriate event bits for the input subsystem 1187 * Set the appropriate event bits for the input subsystem
1180 */ 1188 */
@@ -1194,7 +1202,8 @@ static int elantech_set_input_params(struct psmouse *psmouse)
1194 __clear_bit(EV_REL, dev->evbit); 1202 __clear_bit(EV_REL, dev->evbit);
1195 1203
1196 __set_bit(BTN_LEFT, dev->keybit); 1204 __set_bit(BTN_LEFT, dev->keybit);
1197 if (dmi_check_system(elantech_dmi_has_middle_button)) 1205 if (dmi_check_system(elantech_dmi_has_middle_button) ||
1206 psmouse_matches_pnp_id(psmouse, middle_button_pnp_ids))
1198 __set_bit(BTN_MIDDLE, dev->keybit); 1207 __set_bit(BTN_MIDDLE, dev->keybit);
1199 __set_bit(BTN_RIGHT, dev->keybit); 1208 __set_bit(BTN_RIGHT, dev->keybit);
1200 1209
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 5ff5b1952be0..d3ff1fc09af7 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -192,8 +192,8 @@ psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse)
192 else 192 else
193 input_report_rel(dev, REL_WHEEL, -wheel); 193 input_report_rel(dev, REL_WHEEL, -wheel);
194 194
195 input_report_key(dev, BTN_SIDE, BIT(4)); 195 input_report_key(dev, BTN_SIDE, packet[3] & BIT(4));
196 input_report_key(dev, BTN_EXTRA, BIT(5)); 196 input_report_key(dev, BTN_EXTRA, packet[3] & BIT(5));
197 break; 197 break;
198 } 198 }
199 break; 199 break;
@@ -203,13 +203,13 @@ psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse)
203 input_report_rel(dev, REL_WHEEL, -(s8) packet[3]); 203 input_report_rel(dev, REL_WHEEL, -(s8) packet[3]);
204 204
205 /* Extra buttons on Genius NewNet 3D */ 205 /* Extra buttons on Genius NewNet 3D */
206 input_report_key(dev, BTN_SIDE, BIT(6)); 206 input_report_key(dev, BTN_SIDE, packet[0] & BIT(6));
207 input_report_key(dev, BTN_EXTRA, BIT(7)); 207 input_report_key(dev, BTN_EXTRA, packet[0] & BIT(7));
208 break; 208 break;
209 209
210 case PSMOUSE_THINKPS: 210 case PSMOUSE_THINKPS:
211 /* Extra button on ThinkingMouse */ 211 /* Extra button on ThinkingMouse */
212 input_report_key(dev, BTN_EXTRA, BIT(3)); 212 input_report_key(dev, BTN_EXTRA, packet[0] & BIT(3));
213 213
214 /* 214 /*
215 * Without this bit of weirdness moving up gives wildly 215 * Without this bit of weirdness moving up gives wildly
@@ -223,7 +223,7 @@ psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse)
223 * Cortron PS2 Trackball reports SIDE button in the 223 * Cortron PS2 Trackball reports SIDE button in the
224 * 4th bit of the first byte. 224 * 4th bit of the first byte.
225 */ 225 */
226 input_report_key(dev, BTN_SIDE, BIT(3)); 226 input_report_key(dev, BTN_SIDE, packet[0] & BIT(3));
227 packet[0] |= BIT(3); 227 packet[0] |= BIT(3);
228 break; 228 break;
229 229
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index e08228061bcd..412fa71245af 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -707,6 +707,7 @@ static ssize_t mousedev_write(struct file *file, const char __user *buffer,
707 mousedev_generate_response(client, c); 707 mousedev_generate_response(client, c);
708 708
709 spin_unlock_irq(&client->packet_lock); 709 spin_unlock_irq(&client->packet_lock);
710 cond_resched();
710 } 711 }
711 712
712 kill_fasync(&client->fasync, SIGIO, POLL_IN); 713 kill_fasync(&client->fasync, SIGIO, POLL_IN);
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index b353d494ad40..136f6e7bf797 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -527,6 +527,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = {
527 DMI_MATCH(DMI_PRODUCT_NAME, "N24_25BU"), 527 DMI_MATCH(DMI_PRODUCT_NAME, "N24_25BU"),
528 }, 528 },
529 }, 529 },
530 {
531 /* Lenovo LaVie Z */
532 .matches = {
533 DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
534 DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo LaVie Z"),
535 },
536 },
530 { } 537 { }
531}; 538};
532 539
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index b8bc71569349..95a78ccbd847 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -1395,15 +1395,26 @@ static void __init i8042_register_ports(void)
1395 for (i = 0; i < I8042_NUM_PORTS; i++) { 1395 for (i = 0; i < I8042_NUM_PORTS; i++) {
1396 struct serio *serio = i8042_ports[i].serio; 1396 struct serio *serio = i8042_ports[i].serio;
1397 1397
1398 if (serio) { 1398 if (!serio)
1399 printk(KERN_INFO "serio: %s at %#lx,%#lx irq %d\n", 1399 continue;
1400 serio->name, 1400
1401 (unsigned long) I8042_DATA_REG, 1401 printk(KERN_INFO "serio: %s at %#lx,%#lx irq %d\n",
1402 (unsigned long) I8042_COMMAND_REG, 1402 serio->name,
1403 i8042_ports[i].irq); 1403 (unsigned long) I8042_DATA_REG,
1404 serio_register_port(serio); 1404 (unsigned long) I8042_COMMAND_REG,
1405 device_set_wakeup_capable(&serio->dev, true); 1405 i8042_ports[i].irq);
1406 } 1406 serio_register_port(serio);
1407 device_set_wakeup_capable(&serio->dev, true);
1408
1409 /*
1410 * On platforms using suspend-to-idle, allow the keyboard to
1411 * wake up the system from sleep by enabling keyboard wakeups
1412 * by default. This is consistent with keyboard wakeup
1413 * behavior on many platforms using suspend-to-RAM (ACPI S3)
1414 * by default.
1415 */
1416 if (pm_suspend_via_s2idle() && i == I8042_KBD_PORT_NO)
1417 device_set_wakeup_enable(&serio->dev, true);
1407 } 1418 }
1408} 1419}
1409 1420
diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c
index 80e69bb8283e..83ac8c128192 100644
--- a/drivers/input/touchscreen/egalax_ts.c
+++ b/drivers/input/touchscreen/egalax_ts.c
@@ -241,6 +241,9 @@ static int __maybe_unused egalax_ts_suspend(struct device *dev)
241 struct i2c_client *client = to_i2c_client(dev); 241 struct i2c_client *client = to_i2c_client(dev);
242 int ret; 242 int ret;
243 243
244 if (device_may_wakeup(dev))
245 return enable_irq_wake(client->irq);
246
244 ret = i2c_master_send(client, suspend_cmd, MAX_I2C_DATA_LEN); 247 ret = i2c_master_send(client, suspend_cmd, MAX_I2C_DATA_LEN);
245 return ret > 0 ? 0 : ret; 248 return ret > 0 ? 0 : ret;
246} 249}
@@ -249,6 +252,9 @@ static int __maybe_unused egalax_ts_resume(struct device *dev)
249{ 252{
250 struct i2c_client *client = to_i2c_client(dev); 253 struct i2c_client *client = to_i2c_client(dev);
251 254
255 if (device_may_wakeup(dev))
256 return disable_irq_wake(client->irq);
257
252 return egalax_wake_up_device(client); 258 return egalax_wake_up_device(client);
253} 259}
254 260
diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c
index da1fdd16855e..09241d4cdebc 100644
--- a/drivers/input/touchscreen/silead.c
+++ b/drivers/input/touchscreen/silead.c
@@ -616,6 +616,7 @@ static const struct acpi_device_id silead_ts_acpi_match[] = {
616 { "GSL3692", 0 }, 616 { "GSL3692", 0 },
617 { "MSSL1680", 0 }, 617 { "MSSL1680", 0 },
618 { "MSSL0001", 0 }, 618 { "MSSL0001", 0 },
619 { "MSSL0002", 0 },
619 { } 620 { }
620}; 621};
621MODULE_DEVICE_TABLE(acpi, silead_ts_acpi_match); 622MODULE_DEVICE_TABLE(acpi, silead_ts_acpi_match);
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 440b62f7502e..206b735f383f 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -251,6 +251,7 @@ static inline bool idle_should_enter_s2idle(void)
251 return unlikely(s2idle_state == S2IDLE_STATE_ENTER); 251 return unlikely(s2idle_state == S2IDLE_STATE_ENTER);
252} 252}
253 253
254extern bool pm_suspend_via_s2idle(void);
254extern void __init pm_states_init(void); 255extern void __init pm_states_init(void);
255extern void s2idle_set_ops(const struct platform_s2idle_ops *ops); 256extern void s2idle_set_ops(const struct platform_s2idle_ops *ops);
256extern void s2idle_wake(void); 257extern void s2idle_wake(void);
@@ -282,6 +283,7 @@ static inline void pm_set_suspend_via_firmware(void) {}
282static inline void pm_set_resume_via_firmware(void) {} 283static inline void pm_set_resume_via_firmware(void) {}
283static inline bool pm_suspend_via_firmware(void) { return false; } 284static inline bool pm_suspend_via_firmware(void) { return false; }
284static inline bool pm_resume_via_firmware(void) { return false; } 285static inline bool pm_resume_via_firmware(void) { return false; }
286static inline bool pm_suspend_via_s2idle(void) { return false; }
285 287
286static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {} 288static inline void suspend_set_ops(const struct platform_suspend_ops *ops) {}
287static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; } 289static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 4c10be0f4843..be3d0d477661 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -62,6 +62,12 @@ static DECLARE_WAIT_QUEUE_HEAD(s2idle_wait_head);
62enum s2idle_states __read_mostly s2idle_state; 62enum s2idle_states __read_mostly s2idle_state;
63static DEFINE_SPINLOCK(s2idle_lock); 63static DEFINE_SPINLOCK(s2idle_lock);
64 64
65bool pm_suspend_via_s2idle(void)
66{
67 return mem_sleep_current == PM_SUSPEND_TO_IDLE;
68}
69EXPORT_SYMBOL_GPL(pm_suspend_via_s2idle);
70
65void s2idle_set_ops(const struct platform_s2idle_ops *ops) 71void s2idle_set_ops(const struct platform_s2idle_ops *ops)
66{ 72{
67 lock_system_sleep(); 73 lock_system_sleep();