aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2013-12-16 05:04:49 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2013-12-16 05:04:49 -0500
commit348324c5b10bcba8d9daabdfb85a6927311be34f (patch)
treed06ca3a264407a14a1f36c1b798d6dc0dc1582d8 /drivers/input
parent1e63bd9cc43db5400a1423a7ec8266b4e7c54bd0 (diff)
parent319e2e3f63c348a9b66db4667efa73178e18b17d (diff)
Merge tag 'v3.13-rc4' into next
Synchronize with mainline to bring in the new keycode definitions and new hwmon API.
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/gameport/gameport.c17
-rw-r--r--drivers/input/input.c10
-rw-r--r--drivers/input/keyboard/adp5588-keys.c3
-rw-r--r--drivers/input/keyboard/adp5589-keys.c3
-rw-r--r--drivers/input/keyboard/bf54x-keys.c3
-rw-r--r--drivers/input/keyboard/pxa27x_keypad.c11
-rw-r--r--drivers/input/misc/adxl34x.c2
-rw-r--r--drivers/input/misc/cm109.c14
-rw-r--r--drivers/input/misc/ixp4xx-beeper.c25
-rw-r--r--drivers/input/misc/pcf8574_keypad.c7
-rw-r--r--drivers/input/mouse/alps.c206
-rw-r--r--drivers/input/mouse/alps.h1
-rw-r--r--drivers/input/mouse/elantech.c1
-rw-r--r--drivers/input/serio/Kconfig2
-rw-r--r--drivers/input/serio/i8042.c25
-rw-r--r--drivers/input/serio/serio.c80
-rw-r--r--drivers/input/serio/xilinx_ps2.c8
-rw-r--r--drivers/input/tablet/wacom_sys.c4
-rw-r--r--drivers/input/tablet/wacom_wac.c8
-rw-r--r--drivers/input/touchscreen/cyttsp_core.c2
-rw-r--r--drivers/input/touchscreen/sur40.c4
-rw-r--r--drivers/input/touchscreen/ti_am335x_tsc.c12
-rw-r--r--drivers/input/touchscreen/usbtouchscreen.c26
23 files changed, 375 insertions, 99 deletions
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index 922a7fea2ce6..24c41ba7d4e0 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -422,14 +422,15 @@ static struct gameport *gameport_get_pending_child(struct gameport *parent)
422 * Gameport port operations 422 * Gameport port operations
423 */ 423 */
424 424
425static ssize_t gameport_show_description(struct device *dev, struct device_attribute *attr, char *buf) 425static ssize_t gameport_description_show(struct device *dev, struct device_attribute *attr, char *buf)
426{ 426{
427 struct gameport *gameport = to_gameport_port(dev); 427 struct gameport *gameport = to_gameport_port(dev);
428 428
429 return sprintf(buf, "%s\n", gameport->name); 429 return sprintf(buf, "%s\n", gameport->name);
430} 430}
431static DEVICE_ATTR(description, S_IRUGO, gameport_description_show, NULL);
431 432
432static ssize_t gameport_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 433static ssize_t drvctl_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
433{ 434{
434 struct gameport *gameport = to_gameport_port(dev); 435 struct gameport *gameport = to_gameport_port(dev);
435 struct device_driver *drv; 436 struct device_driver *drv;
@@ -457,12 +458,14 @@ static ssize_t gameport_rebind_driver(struct device *dev, struct device_attribut
457 458
458 return error ? error : count; 459 return error ? error : count;
459} 460}
461static DEVICE_ATTR_WO(drvctl);
460 462
461static struct device_attribute gameport_device_attrs[] = { 463static struct attribute *gameport_device_attrs[] = {
462 __ATTR(description, S_IRUGO, gameport_show_description, NULL), 464 &dev_attr_description.attr,
463 __ATTR(drvctl, S_IWUSR, NULL, gameport_rebind_driver), 465 &dev_attr_drvctl.attr,
464 __ATTR_NULL 466 NULL,
465}; 467};
468ATTRIBUTE_GROUPS(gameport_device);
466 469
467static void gameport_release_port(struct device *dev) 470static void gameport_release_port(struct device *dev)
468{ 471{
@@ -750,7 +753,7 @@ static int gameport_bus_match(struct device *dev, struct device_driver *drv)
750 753
751static struct bus_type gameport_bus = { 754static struct bus_type gameport_bus = {
752 .name = "gameport", 755 .name = "gameport",
753 .dev_attrs = gameport_device_attrs, 756 .dev_groups = gameport_device_groups,
754 .drv_groups = gameport_driver_groups, 757 .drv_groups = gameport_driver_groups,
755 .match = gameport_bus_match, 758 .match = gameport_bus_match,
756 .probe = gameport_driver_probe, 759 .probe = gameport_driver_probe,
diff --git a/drivers/input/input.c b/drivers/input/input.c
index fb513daa40f7..846ccdd905b1 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1734,6 +1734,7 @@ EXPORT_SYMBOL_GPL(input_class);
1734 */ 1734 */
1735struct input_dev *input_allocate_device(void) 1735struct input_dev *input_allocate_device(void)
1736{ 1736{
1737 static atomic_t input_no = ATOMIC_INIT(0);
1737 struct input_dev *dev; 1738 struct input_dev *dev;
1738 1739
1739 dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL); 1740 dev = kzalloc(sizeof(struct input_dev), GFP_KERNEL);
@@ -1743,9 +1744,13 @@ struct input_dev *input_allocate_device(void)
1743 device_initialize(&dev->dev); 1744 device_initialize(&dev->dev);
1744 mutex_init(&dev->mutex); 1745 mutex_init(&dev->mutex);
1745 spin_lock_init(&dev->event_lock); 1746 spin_lock_init(&dev->event_lock);
1747 init_timer(&dev->timer);
1746 INIT_LIST_HEAD(&dev->h_list); 1748 INIT_LIST_HEAD(&dev->h_list);
1747 INIT_LIST_HEAD(&dev->node); 1749 INIT_LIST_HEAD(&dev->node);
1748 1750
1751 dev_set_name(&dev->dev, "input%ld",
1752 (unsigned long) atomic_inc_return(&input_no) - 1);
1753
1749 __module_get(THIS_MODULE); 1754 __module_get(THIS_MODULE);
1750 } 1755 }
1751 1756
@@ -2019,7 +2024,6 @@ static void devm_input_device_unregister(struct device *dev, void *res)
2019 */ 2024 */
2020int input_register_device(struct input_dev *dev) 2025int input_register_device(struct input_dev *dev)
2021{ 2026{
2022 static atomic_t input_no = ATOMIC_INIT(0);
2023 struct input_devres *devres = NULL; 2027 struct input_devres *devres = NULL;
2024 struct input_handler *handler; 2028 struct input_handler *handler;
2025 unsigned int packet_size; 2029 unsigned int packet_size;
@@ -2059,7 +2063,6 @@ int input_register_device(struct input_dev *dev)
2059 * If delay and period are pre-set by the driver, then autorepeating 2063 * If delay and period are pre-set by the driver, then autorepeating
2060 * is handled by the driver itself and we don't do it in input.c. 2064 * is handled by the driver itself and we don't do it in input.c.
2061 */ 2065 */
2062 init_timer(&dev->timer);
2063 if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) { 2066 if (!dev->rep[REP_DELAY] && !dev->rep[REP_PERIOD]) {
2064 dev->timer.data = (long) dev; 2067 dev->timer.data = (long) dev;
2065 dev->timer.function = input_repeat_key; 2068 dev->timer.function = input_repeat_key;
@@ -2073,9 +2076,6 @@ int input_register_device(struct input_dev *dev)
2073 if (!dev->setkeycode) 2076 if (!dev->setkeycode)
2074 dev->setkeycode = input_default_setkeycode; 2077 dev->setkeycode = input_default_setkeycode;
2075 2078
2076 dev_set_name(&dev->dev, "input%ld",
2077 (unsigned long) atomic_inc_return(&input_no) - 1);
2078
2079 error = device_add(&dev->dev); 2079 error = device_add(&dev->dev);
2080 if (error) 2080 if (error)
2081 goto err_free_vals; 2081 goto err_free_vals;
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index e3874d3410b4..a8f5f9216565 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -538,7 +538,8 @@ static int adp5588_probe(struct i2c_client *client,
538 __set_bit(EV_REP, input->evbit); 538 __set_bit(EV_REP, input->evbit);
539 539
540 for (i = 0; i < input->keycodemax; i++) 540 for (i = 0; i < input->keycodemax; i++)
541 __set_bit(kpad->keycode[i] & KEY_MAX, input->keybit); 541 if (kpad->keycode[i] <= KEY_MAX)
542 __set_bit(kpad->keycode[i], input->keybit);
542 __clear_bit(KEY_RESERVED, input->keybit); 543 __clear_bit(KEY_RESERVED, input->keybit);
543 544
544 if (kpad->gpimapsize) 545 if (kpad->gpimapsize)
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
index e43efa03f3e7..ff7725a00776 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -992,7 +992,8 @@ static int adp5589_probe(struct i2c_client *client,
992 __set_bit(EV_REP, input->evbit); 992 __set_bit(EV_REP, input->evbit);
993 993
994 for (i = 0; i < input->keycodemax; i++) 994 for (i = 0; i < input->keycodemax; i++)
995 __set_bit(kpad->keycode[i] & KEY_MAX, input->keybit); 995 if (kpad->keycode[i] <= KEY_MAX)
996 __set_bit(kpad->keycode[i], input->keybit);
996 __clear_bit(KEY_RESERVED, input->keybit); 997 __clear_bit(KEY_RESERVED, input->keybit);
997 998
998 if (kpad->gpimapsize) 999 if (kpad->gpimapsize)
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c
index 16fa3400d86a..16223f4599d4 100644
--- a/drivers/input/keyboard/bf54x-keys.c
+++ b/drivers/input/keyboard/bf54x-keys.c
@@ -289,7 +289,8 @@ static int bfin_kpad_probe(struct platform_device *pdev)
289 __set_bit(EV_REP, input->evbit); 289 __set_bit(EV_REP, input->evbit);
290 290
291 for (i = 0; i < input->keycodemax; i++) 291 for (i = 0; i < input->keycodemax; i++)
292 __set_bit(bf54x_kpad->keycode[i] & KEY_MAX, input->keybit); 292 if (bf54x_kpad->keycode[i] <= KEY_MAX)
293 __set_bit(bf54x_kpad->keycode[i], input->keybit);
293 __clear_bit(KEY_RESERVED, input->keybit); 294 __clear_bit(KEY_RESERVED, input->keybit);
294 295
295 error = input_register_device(input); 296 error = input_register_device(input);
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index 5446ad4e4aeb..186138c720c7 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -787,10 +787,17 @@ static int pxa27x_keypad_probe(struct platform_device *pdev)
787 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); 787 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
788 input_set_capability(input_dev, EV_MSC, MSC_SCAN); 788 input_set_capability(input_dev, EV_MSC, MSC_SCAN);
789 789
790 if (pdata) 790 if (pdata) {
791 error = pxa27x_keypad_build_keycode(keypad); 791 error = pxa27x_keypad_build_keycode(keypad);
792 else 792 } else {
793 error = pxa27x_keypad_build_keycode_from_dt(keypad); 793 error = pxa27x_keypad_build_keycode_from_dt(keypad);
794 /*
795 * Data that we get from DT resides in dynamically
796 * allocated memory so we need to update our pdata
797 * pointer.
798 */
799 pdata = keypad->pdata;
800 }
794 if (error) { 801 if (error) {
795 dev_err(&pdev->dev, "failed to build keycode\n"); 802 dev_err(&pdev->dev, "failed to build keycode\n");
796 goto failed_put_clk; 803 goto failed_put_clk;
diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c
index d2049972f70a..86c9ec48804f 100644
--- a/drivers/input/misc/adxl34x.c
+++ b/drivers/input/misc/adxl34x.c
@@ -158,7 +158,7 @@
158 158
159/* ORIENT ADXL346 only */ 159/* ORIENT ADXL346 only */
160#define ADXL346_2D_VALID (1 << 6) 160#define ADXL346_2D_VALID (1 << 6)
161#define ADXL346_2D_ORIENT(x) (((x) & 0x3) >> 4) 161#define ADXL346_2D_ORIENT(x) (((x) & 0x30) >> 4)
162#define ADXL346_3D_VALID (1 << 3) 162#define ADXL346_3D_VALID (1 << 3)
163#define ADXL346_3D_ORIENT(x) ((x) & 0x7) 163#define ADXL346_3D_ORIENT(x) ((x) & 0x7)
164#define ADXL346_2D_PORTRAIT_POS 0 /* +X */ 164#define ADXL346_2D_PORTRAIT_POS 0 /* +X */
diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
index 082684e7f390..9365535ba7f1 100644
--- a/drivers/input/misc/cm109.c
+++ b/drivers/input/misc/cm109.c
@@ -351,7 +351,9 @@ static void cm109_urb_irq_callback(struct urb *urb)
351 if (status) { 351 if (status) {
352 if (status == -ESHUTDOWN) 352 if (status == -ESHUTDOWN)
353 return; 353 return;
354 dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); 354 dev_err_ratelimited(&dev->intf->dev, "%s: urb status %d\n",
355 __func__, status);
356 goto out;
355 } 357 }
356 358
357 /* Special keys */ 359 /* Special keys */
@@ -418,8 +420,12 @@ static void cm109_urb_ctl_callback(struct urb *urb)
418 dev->ctl_data->byte[2], 420 dev->ctl_data->byte[2],
419 dev->ctl_data->byte[3]); 421 dev->ctl_data->byte[3]);
420 422
421 if (status) 423 if (status) {
422 dev_err(&dev->intf->dev, "%s: urb status %d\n", __func__, status); 424 if (status == -ESHUTDOWN)
425 return;
426 dev_err_ratelimited(&dev->intf->dev, "%s: urb status %d\n",
427 __func__, status);
428 }
423 429
424 spin_lock(&dev->ctl_submit_lock); 430 spin_lock(&dev->ctl_submit_lock);
425 431
@@ -427,7 +433,7 @@ static void cm109_urb_ctl_callback(struct urb *urb)
427 433
428 if (likely(!dev->shutdown)) { 434 if (likely(!dev->shutdown)) {
429 435
430 if (dev->buzzer_pending) { 436 if (dev->buzzer_pending || status) {
431 dev->buzzer_pending = 0; 437 dev->buzzer_pending = 0;
432 dev->ctl_urb_pending = 1; 438 dev->ctl_urb_pending = 1;
433 cm109_submit_buzz_toggle(dev); 439 cm109_submit_buzz_toggle(dev);
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c
index f34beb228d36..17ccba88d636 100644
--- a/drivers/input/misc/ixp4xx-beeper.c
+++ b/drivers/input/misc/ixp4xx-beeper.c
@@ -20,6 +20,7 @@
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/gpio.h>
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24 25
25MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>"); 26MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
@@ -35,15 +36,12 @@ static void ixp4xx_spkr_control(unsigned int pin, unsigned int count)
35 36
36 spin_lock_irqsave(&beep_lock, flags); 37 spin_lock_irqsave(&beep_lock, flags);
37 38
38 if (count) { 39 if (count) {
39 gpio_line_config(pin, IXP4XX_GPIO_OUT); 40 gpio_direction_output(pin, 0);
40 gpio_line_set(pin, IXP4XX_GPIO_LOW);
41
42 *IXP4XX_OSRT2 = (count & ~IXP4XX_OST_RELOAD_MASK) | IXP4XX_OST_ENABLE; 41 *IXP4XX_OSRT2 = (count & ~IXP4XX_OST_RELOAD_MASK) | IXP4XX_OST_ENABLE;
43 } else { 42 } else {
44 gpio_line_config(pin, IXP4XX_GPIO_IN); 43 gpio_direction_output(pin, 1);
45 gpio_line_set(pin, IXP4XX_GPIO_HIGH); 44 gpio_direction_input(pin);
46
47 *IXP4XX_OSRT2 = 0; 45 *IXP4XX_OSRT2 = 0;
48 } 46 }
49 47
@@ -78,11 +76,13 @@ static int ixp4xx_spkr_event(struct input_dev *dev, unsigned int type, unsigned
78 76
79static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id) 77static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id)
80{ 78{
79 unsigned int pin = (unsigned int) dev_id;
80
81 /* clear interrupt */ 81 /* clear interrupt */
82 *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND; 82 *IXP4XX_OSST = IXP4XX_OSST_TIMER_2_PEND;
83 83
84 /* flip the beeper output */ 84 /* flip the beeper output */
85 *IXP4XX_GPIO_GPOUTR ^= (1 << (unsigned int) dev_id); 85 gpio_set_value(pin, !gpio_get_value(pin));
86 86
87 return IRQ_HANDLED; 87 return IRQ_HANDLED;
88} 88}
@@ -110,11 +110,15 @@ static int ixp4xx_spkr_probe(struct platform_device *dev)
110 input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE); 110 input_dev->sndbit[0] = BIT_MASK(SND_BELL) | BIT_MASK(SND_TONE);
111 input_dev->event = ixp4xx_spkr_event; 111 input_dev->event = ixp4xx_spkr_event;
112 112
113 err = gpio_request(dev->id, "ixp4-beeper");
114 if (err)
115 goto err_free_device;
116
113 err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt, 117 err = request_irq(IRQ_IXP4XX_TIMER2, &ixp4xx_spkr_interrupt,
114 IRQF_NO_SUSPEND, "ixp4xx-beeper", 118 IRQF_NO_SUSPEND, "ixp4xx-beeper",
115 (void *) dev->id); 119 (void *) dev->id);
116 if (err) 120 if (err)
117 goto err_free_device; 121 goto err_free_gpio;
118 122
119 err = input_register_device(input_dev); 123 err = input_register_device(input_dev);
120 if (err) 124 if (err)
@@ -126,6 +130,8 @@ static int ixp4xx_spkr_probe(struct platform_device *dev)
126 130
127 err_free_irq: 131 err_free_irq:
128 free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id); 132 free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id);
133 err_free_gpio:
134 gpio_free(dev->id);
129 err_free_device: 135 err_free_device:
130 input_free_device(input_dev); 136 input_free_device(input_dev);
131 137
@@ -144,6 +150,7 @@ static int ixp4xx_spkr_remove(struct platform_device *dev)
144 ixp4xx_spkr_control(pin, 0); 150 ixp4xx_spkr_control(pin, 0);
145 151
146 free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id); 152 free_irq(IRQ_IXP4XX_TIMER2, (void *)dev->id);
153 gpio_free(dev->id);
147 154
148 return 0; 155 return 0;
149} 156}
diff --git a/drivers/input/misc/pcf8574_keypad.c b/drivers/input/misc/pcf8574_keypad.c
index e37392976fdd..0deca5a3c87f 100644
--- a/drivers/input/misc/pcf8574_keypad.c
+++ b/drivers/input/misc/pcf8574_keypad.c
@@ -113,9 +113,12 @@ static int pcf8574_kp_probe(struct i2c_client *client, const struct i2c_device_i
113 idev->keycodemax = ARRAY_SIZE(lp->btncode); 113 idev->keycodemax = ARRAY_SIZE(lp->btncode);
114 114
115 for (i = 0; i < ARRAY_SIZE(pcf8574_kp_btncode); i++) { 115 for (i = 0; i < ARRAY_SIZE(pcf8574_kp_btncode); i++) {
116 lp->btncode[i] = pcf8574_kp_btncode[i]; 116 if (lp->btncode[i] <= KEY_MAX) {
117 __set_bit(lp->btncode[i] & KEY_MAX, idev->keybit); 117 lp->btncode[i] = pcf8574_kp_btncode[i];
118 __set_bit(lp->btncode[i], idev->keybit);
119 }
118 } 120 }
121 __clear_bit(KEY_RESERVED, idev->keybit);
119 122
120 sprintf(lp->name, DRV_NAME); 123 sprintf(lp->name, DRV_NAME);
121 sprintf(lp->phys, "kp_data/input0"); 124 sprintf(lp->phys, "kp_data/input0");
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index ca7a26f1dce8..5cf62e315218 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -70,6 +70,25 @@ static const struct alps_nibble_commands alps_v4_nibble_commands[] = {
70 { PSMOUSE_CMD_SETSCALE11, 0x00 }, /* f */ 70 { PSMOUSE_CMD_SETSCALE11, 0x00 }, /* f */
71}; 71};
72 72
73static const struct alps_nibble_commands alps_v6_nibble_commands[] = {
74 { PSMOUSE_CMD_ENABLE, 0x00 }, /* 0 */
75 { PSMOUSE_CMD_SETRATE, 0x0a }, /* 1 */
76 { PSMOUSE_CMD_SETRATE, 0x14 }, /* 2 */
77 { PSMOUSE_CMD_SETRATE, 0x28 }, /* 3 */
78 { PSMOUSE_CMD_SETRATE, 0x3c }, /* 4 */
79 { PSMOUSE_CMD_SETRATE, 0x50 }, /* 5 */
80 { PSMOUSE_CMD_SETRATE, 0x64 }, /* 6 */
81 { PSMOUSE_CMD_SETRATE, 0xc8 }, /* 7 */
82 { PSMOUSE_CMD_GETID, 0x00 }, /* 8 */
83 { PSMOUSE_CMD_GETINFO, 0x00 }, /* 9 */
84 { PSMOUSE_CMD_SETRES, 0x00 }, /* a */
85 { PSMOUSE_CMD_SETRES, 0x01 }, /* b */
86 { PSMOUSE_CMD_SETRES, 0x02 }, /* c */
87 { PSMOUSE_CMD_SETRES, 0x03 }, /* d */
88 { PSMOUSE_CMD_SETSCALE21, 0x00 }, /* e */
89 { PSMOUSE_CMD_SETSCALE11, 0x00 }, /* f */
90};
91
73 92
74#define ALPS_DUALPOINT 0x02 /* touchpad has trackstick */ 93#define ALPS_DUALPOINT 0x02 /* touchpad has trackstick */
75#define ALPS_PASS 0x04 /* device has a pass-through port */ 94#define ALPS_PASS 0x04 /* device has a pass-through port */
@@ -103,6 +122,7 @@ static const struct alps_model_info alps_model_data[] = {
103 /* Dell Latitude E5500, E6400, E6500, Precision M4400 */ 122 /* Dell Latitude E5500, E6400, E6500, Precision M4400 */
104 { { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, 123 { { 0x62, 0x02, 0x14 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf,
105 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, 124 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED },
125 { { 0x73, 0x00, 0x14 }, 0x00, ALPS_PROTO_V6, 0xff, 0xff, ALPS_DUALPOINT }, /* Dell XT2 */
106 { { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */ 126 { { 0x73, 0x02, 0x50 }, 0x00, ALPS_PROTO_V2, 0xcf, 0xcf, ALPS_FOUR_BUTTONS }, /* Dell Vostro 1400 */
107 { { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff, 127 { { 0x52, 0x01, 0x14 }, 0x00, ALPS_PROTO_V2, 0xff, 0xff,
108 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */ 128 ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED }, /* Toshiba Tecra A11-11L */
@@ -645,6 +665,76 @@ static void alps_process_packet_v3(struct psmouse *psmouse)
645 alps_process_touchpad_packet_v3(psmouse); 665 alps_process_touchpad_packet_v3(psmouse);
646} 666}
647 667
668static void alps_process_packet_v6(struct psmouse *psmouse)
669{
670 struct alps_data *priv = psmouse->private;
671 unsigned char *packet = psmouse->packet;
672 struct input_dev *dev = psmouse->dev;
673 struct input_dev *dev2 = priv->dev2;
674 int x, y, z, left, right, middle;
675
676 /*
677 * We can use Byte5 to distinguish if the packet is from Touchpad
678 * or Trackpoint.
679 * Touchpad: 0 - 0x7E
680 * Trackpoint: 0x7F
681 */
682 if (packet[5] == 0x7F) {
683 /* It should be a DualPoint when received Trackpoint packet */
684 if (!(priv->flags & ALPS_DUALPOINT))
685 return;
686
687 /* Trackpoint packet */
688 x = packet[1] | ((packet[3] & 0x20) << 2);
689 y = packet[2] | ((packet[3] & 0x40) << 1);
690 z = packet[4];
691 left = packet[3] & 0x01;
692 right = packet[3] & 0x02;
693 middle = packet[3] & 0x04;
694
695 /* To prevent the cursor jump when finger lifted */
696 if (x == 0x7F && y == 0x7F && z == 0x7F)
697 x = y = z = 0;
698
699 /* Divide 4 since trackpoint's speed is too fast */
700 input_report_rel(dev2, REL_X, (char)x / 4);
701 input_report_rel(dev2, REL_Y, -((char)y / 4));
702
703 input_report_key(dev2, BTN_LEFT, left);
704 input_report_key(dev2, BTN_RIGHT, right);
705 input_report_key(dev2, BTN_MIDDLE, middle);
706
707 input_sync(dev2);
708 return;
709 }
710
711 /* Touchpad packet */
712 x = packet[1] | ((packet[3] & 0x78) << 4);
713 y = packet[2] | ((packet[4] & 0x78) << 4);
714 z = packet[5];
715 left = packet[3] & 0x01;
716 right = packet[3] & 0x02;
717
718 if (z > 30)
719 input_report_key(dev, BTN_TOUCH, 1);
720 if (z < 25)
721 input_report_key(dev, BTN_TOUCH, 0);
722
723 if (z > 0) {
724 input_report_abs(dev, ABS_X, x);
725 input_report_abs(dev, ABS_Y, y);
726 }
727
728 input_report_abs(dev, ABS_PRESSURE, z);
729 input_report_key(dev, BTN_TOOL_FINGER, z > 0);
730
731 /* v6 touchpad does not have middle button */
732 input_report_key(dev, BTN_LEFT, left);
733 input_report_key(dev, BTN_RIGHT, right);
734
735 input_sync(dev);
736}
737
648static void alps_process_packet_v4(struct psmouse *psmouse) 738static void alps_process_packet_v4(struct psmouse *psmouse)
649{ 739{
650 struct alps_data *priv = psmouse->private; 740 struct alps_data *priv = psmouse->private;
@@ -897,7 +987,7 @@ static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
897 } 987 }
898 988
899 /* Bytes 2 - pktsize should have 0 in the highest bit */ 989 /* Bytes 2 - pktsize should have 0 in the highest bit */
900 if (priv->proto_version != ALPS_PROTO_V5 && 990 if ((priv->proto_version < ALPS_PROTO_V5) &&
901 psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize && 991 psmouse->pktcnt >= 2 && psmouse->pktcnt <= psmouse->pktsize &&
902 (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) { 992 (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) {
903 psmouse_dbg(psmouse, "refusing packet[%i] = %x\n", 993 psmouse_dbg(psmouse, "refusing packet[%i] = %x\n",
@@ -1085,6 +1175,80 @@ static int alps_absolute_mode_v1_v2(struct psmouse *psmouse)
1085 return ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETPOLL); 1175 return ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETPOLL);
1086} 1176}
1087 1177
1178static int alps_monitor_mode_send_word(struct psmouse *psmouse, u16 word)
1179{
1180 int i, nibble;
1181
1182 /*
1183 * b0-b11 are valid bits, send sequence is inverse.
1184 * e.g. when word = 0x0123, nibble send sequence is 3, 2, 1
1185 */
1186 for (i = 0; i <= 8; i += 4) {
1187 nibble = (word >> i) & 0xf;
1188 if (alps_command_mode_send_nibble(psmouse, nibble))
1189 return -1;
1190 }
1191
1192 return 0;
1193}
1194
1195static int alps_monitor_mode_write_reg(struct psmouse *psmouse,
1196 u16 addr, u16 value)
1197{
1198 struct ps2dev *ps2dev = &psmouse->ps2dev;
1199
1200 /* 0x0A0 is the command to write the word */
1201 if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE) ||
1202 alps_monitor_mode_send_word(psmouse, 0x0A0) ||
1203 alps_monitor_mode_send_word(psmouse, addr) ||
1204 alps_monitor_mode_send_word(psmouse, value) ||
1205 ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE))
1206 return -1;
1207
1208 return 0;
1209}
1210
1211static int alps_monitor_mode(struct psmouse *psmouse, bool enable)
1212{
1213 struct ps2dev *ps2dev = &psmouse->ps2dev;
1214
1215 if (enable) {
1216 /* EC E9 F5 F5 E7 E6 E7 E9 to enter monitor mode */
1217 if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_WRAP) ||
1218 ps2_command(ps2dev, NULL, PSMOUSE_CMD_GETINFO) ||
1219 ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE) ||
1220 ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE) ||
1221 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE21) ||
1222 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
1223 ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE21) ||
1224 ps2_command(ps2dev, NULL, PSMOUSE_CMD_GETINFO))
1225 return -1;
1226 } else {
1227 /* EC to exit monitor mode */
1228 if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_WRAP))
1229 return -1;
1230 }
1231
1232 return 0;
1233}
1234
1235static int alps_absolute_mode_v6(struct psmouse *psmouse)
1236{
1237 u16 reg_val = 0x181;
1238 int ret = -1;
1239
1240 /* enter monitor mode, to write the register */
1241 if (alps_monitor_mode(psmouse, true))
1242 return -1;
1243
1244 ret = alps_monitor_mode_write_reg(psmouse, 0x000, reg_val);
1245
1246 if (alps_monitor_mode(psmouse, false))
1247 ret = -1;
1248
1249 return ret;
1250}
1251
1088static int alps_get_status(struct psmouse *psmouse, char *param) 1252static int alps_get_status(struct psmouse *psmouse, char *param)
1089{ 1253{
1090 /* Get status: 0xF5 0xF5 0xF5 0xE9 */ 1254 /* Get status: 0xF5 0xF5 0xF5 0xE9 */
@@ -1189,6 +1353,32 @@ static int alps_hw_init_v1_v2(struct psmouse *psmouse)
1189 return 0; 1353 return 0;
1190} 1354}
1191 1355
1356static int alps_hw_init_v6(struct psmouse *psmouse)
1357{
1358 unsigned char param[2] = {0xC8, 0x14};
1359
1360 /* Enter passthrough mode to let trackpoint enter 6byte raw mode */
1361 if (alps_passthrough_mode_v2(psmouse, true))
1362 return -1;
1363
1364 if (ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
1365 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
1366 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||
1367 ps2_command(&psmouse->ps2dev, &param[0], PSMOUSE_CMD_SETRATE) ||
1368 ps2_command(&psmouse->ps2dev, &param[1], PSMOUSE_CMD_SETRATE))
1369 return -1;
1370
1371 if (alps_passthrough_mode_v2(psmouse, false))
1372 return -1;
1373
1374 if (alps_absolute_mode_v6(psmouse)) {
1375 psmouse_err(psmouse, "Failed to enable absolute mode\n");
1376 return -1;
1377 }
1378
1379 return 0;
1380}
1381
1192/* 1382/*
1193 * Enable or disable passthrough mode to the trackstick. 1383 * Enable or disable passthrough mode to the trackstick.
1194 */ 1384 */
@@ -1553,6 +1743,8 @@ static void alps_set_defaults(struct alps_data *priv)
1553 priv->hw_init = alps_hw_init_v1_v2; 1743 priv->hw_init = alps_hw_init_v1_v2;
1554 priv->process_packet = alps_process_packet_v1_v2; 1744 priv->process_packet = alps_process_packet_v1_v2;
1555 priv->set_abs_params = alps_set_abs_params_st; 1745 priv->set_abs_params = alps_set_abs_params_st;
1746 priv->x_max = 1023;
1747 priv->y_max = 767;
1556 break; 1748 break;
1557 case ALPS_PROTO_V3: 1749 case ALPS_PROTO_V3:
1558 priv->hw_init = alps_hw_init_v3; 1750 priv->hw_init = alps_hw_init_v3;
@@ -1584,6 +1776,14 @@ static void alps_set_defaults(struct alps_data *priv)
1584 priv->x_bits = 23; 1776 priv->x_bits = 23;
1585 priv->y_bits = 12; 1777 priv->y_bits = 12;
1586 break; 1778 break;
1779 case ALPS_PROTO_V6:
1780 priv->hw_init = alps_hw_init_v6;
1781 priv->process_packet = alps_process_packet_v6;
1782 priv->set_abs_params = alps_set_abs_params_st;
1783 priv->nibble_commands = alps_v6_nibble_commands;
1784 priv->x_max = 2047;
1785 priv->y_max = 1535;
1786 break;
1587 } 1787 }
1588} 1788}
1589 1789
@@ -1705,8 +1905,8 @@ static void alps_disconnect(struct psmouse *psmouse)
1705static void alps_set_abs_params_st(struct alps_data *priv, 1905static void alps_set_abs_params_st(struct alps_data *priv,
1706 struct input_dev *dev1) 1906 struct input_dev *dev1)
1707{ 1907{
1708 input_set_abs_params(dev1, ABS_X, 0, 1023, 0, 0); 1908 input_set_abs_params(dev1, ABS_X, 0, priv->x_max, 0, 0);
1709 input_set_abs_params(dev1, ABS_Y, 0, 767, 0, 0); 1909 input_set_abs_params(dev1, ABS_Y, 0, priv->y_max, 0, 0);
1710} 1910}
1711 1911
1712static void alps_set_abs_params_mt(struct alps_data *priv, 1912static void alps_set_abs_params_mt(struct alps_data *priv,
diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h
index eee59853b9ce..704f0f924307 100644
--- a/drivers/input/mouse/alps.h
+++ b/drivers/input/mouse/alps.h
@@ -17,6 +17,7 @@
17#define ALPS_PROTO_V3 3 17#define ALPS_PROTO_V3 3
18#define ALPS_PROTO_V4 4 18#define ALPS_PROTO_V4 4
19#define ALPS_PROTO_V5 5 19#define ALPS_PROTO_V5 5
20#define ALPS_PROTO_V6 6
20 21
21/** 22/**
22 * struct alps_model_info - touchpad ID table 23 * struct alps_model_info - touchpad ID table
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 8551dcaf24db..597e9b8fc18d 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1313,6 +1313,7 @@ static int elantech_set_properties(struct elantech_data *etd)
1313 break; 1313 break;
1314 case 6: 1314 case 6:
1315 case 7: 1315 case 7:
1316 case 8:
1316 etd->hw_version = 4; 1317 etd->hw_version = 4;
1317 break; 1318 break;
1318 default: 1319 default:
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index 5a96acb667ea..8541f949778d 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -21,7 +21,7 @@ if SERIO
21config SERIO_I8042 21config SERIO_I8042
22 tristate "i8042 PC Keyboard controller" 22 tristate "i8042 PC Keyboard controller"
23 default y 23 default y
24 depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && \ 24 depends on !PARISC && (!ARM || FOOTBRIDGE_HOST) && \
25 (!SUPERH || SH_CAYMAN) && !M68K && !BLACKFIN && !S390 && \ 25 (!SUPERH || SH_CAYMAN) && !M68K && !BLACKFIN && !S390 && \
26 !ARC 26 !ARC
27 help 27 help
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c
index 78e4de42efaa..020053fa5aaa 100644
--- a/drivers/input/serio/i8042.c
+++ b/drivers/input/serio/i8042.c
@@ -223,21 +223,26 @@ static int i8042_flush(void)
223{ 223{
224 unsigned long flags; 224 unsigned long flags;
225 unsigned char data, str; 225 unsigned char data, str;
226 int i = 0; 226 int count = 0;
227 int retval = 0;
227 228
228 spin_lock_irqsave(&i8042_lock, flags); 229 spin_lock_irqsave(&i8042_lock, flags);
229 230
230 while (((str = i8042_read_status()) & I8042_STR_OBF) && (i < I8042_BUFFER_SIZE)) { 231 while ((str = i8042_read_status()) & I8042_STR_OBF) {
231 udelay(50); 232 if (count++ < I8042_BUFFER_SIZE) {
232 data = i8042_read_data(); 233 udelay(50);
233 i++; 234 data = i8042_read_data();
234 dbg("%02x <- i8042 (flush, %s)\n", 235 dbg("%02x <- i8042 (flush, %s)\n",
235 data, str & I8042_STR_AUXDATA ? "aux" : "kbd"); 236 data, str & I8042_STR_AUXDATA ? "aux" : "kbd");
237 } else {
238 retval = -EIO;
239 break;
240 }
236 } 241 }
237 242
238 spin_unlock_irqrestore(&i8042_lock, flags); 243 spin_unlock_irqrestore(&i8042_lock, flags);
239 244
240 return i; 245 return retval;
241} 246}
242 247
243/* 248/*
@@ -849,7 +854,7 @@ static int __init i8042_check_aux(void)
849 854
850static int i8042_controller_check(void) 855static int i8042_controller_check(void)
851{ 856{
852 if (i8042_flush() == I8042_BUFFER_SIZE) { 857 if (i8042_flush()) {
853 pr_err("No controller found\n"); 858 pr_err("No controller found\n");
854 return -ENODEV; 859 return -ENODEV;
855 } 860 }
@@ -1031,7 +1036,7 @@ static void i8042_controller_reset(bool force_reset)
1031/* 1036/*
1032 * i8042_panic_blink() will turn the keyboard LEDs on or off and is called 1037 * i8042_panic_blink() will turn the keyboard LEDs on or off and is called
1033 * when kernel panics. Flashing LEDs is useful for users running X who may 1038 * when kernel panics. Flashing LEDs is useful for users running X who may
1034 * not see the console and will help distingushing panics from "real" 1039 * not see the console and will help distinguishing panics from "real"
1035 * lockups. 1040 * lockups.
1036 * 1041 *
1037 * Note that DELAY has a limit of 10ms so we will not get stuck here 1042 * Note that DELAY has a limit of 10ms so we will not get stuck here
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 2b56855c2c77..8f4c4ab04bc2 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -365,7 +365,7 @@ static ssize_t serio_show_description(struct device *dev, struct device_attribut
365 return sprintf(buf, "%s\n", serio->name); 365 return sprintf(buf, "%s\n", serio->name);
366} 366}
367 367
368static ssize_t serio_show_modalias(struct device *dev, struct device_attribute *attr, char *buf) 368static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
369{ 369{
370 struct serio *serio = to_serio_port(dev); 370 struct serio *serio = to_serio_port(dev);
371 371
@@ -373,54 +373,31 @@ static ssize_t serio_show_modalias(struct device *dev, struct device_attribute *
373 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra); 373 serio->id.type, serio->id.proto, serio->id.id, serio->id.extra);
374} 374}
375 375
376static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf) 376static ssize_t type_show(struct device *dev, struct device_attribute *attr, char *buf)
377{ 377{
378 struct serio *serio = to_serio_port(dev); 378 struct serio *serio = to_serio_port(dev);
379 return sprintf(buf, "%02x\n", serio->id.type); 379 return sprintf(buf, "%02x\n", serio->id.type);
380} 380}
381 381
382static ssize_t serio_show_id_proto(struct device *dev, struct device_attribute *attr, char *buf) 382static ssize_t proto_show(struct device *dev, struct device_attribute *attr, char *buf)
383{ 383{
384 struct serio *serio = to_serio_port(dev); 384 struct serio *serio = to_serio_port(dev);
385 return sprintf(buf, "%02x\n", serio->id.proto); 385 return sprintf(buf, "%02x\n", serio->id.proto);
386} 386}
387 387
388static ssize_t serio_show_id_id(struct device *dev, struct device_attribute *attr, char *buf) 388static ssize_t id_show(struct device *dev, struct device_attribute *attr, char *buf)
389{ 389{
390 struct serio *serio = to_serio_port(dev); 390 struct serio *serio = to_serio_port(dev);
391 return sprintf(buf, "%02x\n", serio->id.id); 391 return sprintf(buf, "%02x\n", serio->id.id);
392} 392}
393 393
394static ssize_t serio_show_id_extra(struct device *dev, struct device_attribute *attr, char *buf) 394static ssize_t extra_show(struct device *dev, struct device_attribute *attr, char *buf)
395{ 395{
396 struct serio *serio = to_serio_port(dev); 396 struct serio *serio = to_serio_port(dev);
397 return sprintf(buf, "%02x\n", serio->id.extra); 397 return sprintf(buf, "%02x\n", serio->id.extra);
398} 398}
399 399
400static DEVICE_ATTR(type, S_IRUGO, serio_show_id_type, NULL); 400static ssize_t drvctl_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
401static DEVICE_ATTR(proto, S_IRUGO, serio_show_id_proto, NULL);
402static DEVICE_ATTR(id, S_IRUGO, serio_show_id_id, NULL);
403static DEVICE_ATTR(extra, S_IRUGO, serio_show_id_extra, NULL);
404
405static struct attribute *serio_device_id_attrs[] = {
406 &dev_attr_type.attr,
407 &dev_attr_proto.attr,
408 &dev_attr_id.attr,
409 &dev_attr_extra.attr,
410 NULL
411};
412
413static struct attribute_group serio_id_attr_group = {
414 .name = "id",
415 .attrs = serio_device_id_attrs,
416};
417
418static const struct attribute_group *serio_device_attr_groups[] = {
419 &serio_id_attr_group,
420 NULL
421};
422
423static ssize_t serio_rebind_driver(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
424{ 401{
425 struct serio *serio = to_serio_port(dev); 402 struct serio *serio = to_serio_port(dev);
426 struct device_driver *drv; 403 struct device_driver *drv;
@@ -474,14 +451,46 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute *
474 return retval; 451 return retval;
475} 452}
476 453
477static struct device_attribute serio_device_attrs[] = { 454static DEVICE_ATTR_RO(type);
478 __ATTR(description, S_IRUGO, serio_show_description, NULL), 455static DEVICE_ATTR_RO(proto);
479 __ATTR(modalias, S_IRUGO, serio_show_modalias, NULL), 456static DEVICE_ATTR_RO(id);
480 __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver), 457static DEVICE_ATTR_RO(extra);
481 __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), 458
482 __ATTR_NULL 459static struct attribute *serio_device_id_attrs[] = {
460 &dev_attr_type.attr,
461 &dev_attr_proto.attr,
462 &dev_attr_id.attr,
463 &dev_attr_extra.attr,
464 NULL
465};
466
467static struct attribute_group serio_id_attr_group = {
468 .name = "id",
469 .attrs = serio_device_id_attrs,
483}; 470};
484 471
472static DEVICE_ATTR_RO(modalias);
473static DEVICE_ATTR_WO(drvctl);
474static DEVICE_ATTR(description, S_IRUGO, serio_show_description, NULL);
475static DEVICE_ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode);
476
477static struct attribute *serio_device_attrs[] = {
478 &dev_attr_modalias.attr,
479 &dev_attr_description.attr,
480 &dev_attr_drvctl.attr,
481 &dev_attr_bind_mode.attr,
482 NULL
483};
484
485static struct attribute_group serio_device_attr_group = {
486 .attrs = serio_device_attrs,
487};
488
489static const struct attribute_group *serio_device_attr_groups[] = {
490 &serio_id_attr_group,
491 &serio_device_attr_group,
492 NULL
493};
485 494
486static void serio_release_port(struct device *dev) 495static void serio_release_port(struct device *dev)
487{ 496{
@@ -996,7 +1005,6 @@ EXPORT_SYMBOL(serio_interrupt);
996 1005
997static struct bus_type serio_bus = { 1006static struct bus_type serio_bus = {
998 .name = "serio", 1007 .name = "serio",
999 .dev_attrs = serio_device_attrs,
1000 .drv_groups = serio_driver_groups, 1008 .drv_groups = serio_driver_groups,
1001 .match = serio_bus_match, 1009 .match = serio_bus_match,
1002 .uevent = serio_uevent, 1010 .uevent = serio_uevent,
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c
index 4b7662a17ae9..dfbcd872f95e 100644
--- a/drivers/input/serio/xilinx_ps2.c
+++ b/drivers/input/serio/xilinx_ps2.c
@@ -25,6 +25,7 @@
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/of_address.h> 26#include <linux/of_address.h>
27#include <linux/of_device.h> 27#include <linux/of_device.h>
28#include <linux/of_irq.h>
28#include <linux/of_platform.h> 29#include <linux/of_platform.h>
29 30
30#define DRIVER_NAME "xilinx_ps2" 31#define DRIVER_NAME "xilinx_ps2"
@@ -235,12 +236,12 @@ static void sxps2_close(struct serio *pserio)
235 */ 236 */
236static int xps2_of_probe(struct platform_device *ofdev) 237static int xps2_of_probe(struct platform_device *ofdev)
237{ 238{
238 struct resource r_irq; /* Interrupt resources */
239 struct resource r_mem; /* IO mem resources */ 239 struct resource r_mem; /* IO mem resources */
240 struct xps2data *drvdata; 240 struct xps2data *drvdata;
241 struct serio *serio; 241 struct serio *serio;
242 struct device *dev = &ofdev->dev; 242 struct device *dev = &ofdev->dev;
243 resource_size_t remap_size, phys_addr; 243 resource_size_t remap_size, phys_addr;
244 unsigned int irq;
244 int error; 245 int error;
245 246
246 dev_info(dev, "Device Tree Probing \'%s\'\n", 247 dev_info(dev, "Device Tree Probing \'%s\'\n",
@@ -254,7 +255,8 @@ static int xps2_of_probe(struct platform_device *ofdev)
254 } 255 }
255 256
256 /* Get IRQ for the device */ 257 /* Get IRQ for the device */
257 if (!of_irq_to_resource(ofdev->dev.of_node, 0, &r_irq)) { 258 irq = irq_of_parse_and_map(ofdev->dev.of_node, 0);
259 if (!irq) {
258 dev_err(dev, "no IRQ found\n"); 260 dev_err(dev, "no IRQ found\n");
259 return -ENODEV; 261 return -ENODEV;
260 } 262 }
@@ -267,7 +269,7 @@ static int xps2_of_probe(struct platform_device *ofdev)
267 } 269 }
268 270
269 spin_lock_init(&drvdata->lock); 271 spin_lock_init(&drvdata->lock);
270 drvdata->irq = r_irq.start; 272 drvdata->irq = irq;
271 drvdata->serio = serio; 273 drvdata->serio = serio;
272 drvdata->dev = dev; 274 drvdata->dev = dev;
273 275
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 3a7d99c720cd..8318826d976e 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -1041,6 +1041,7 @@ static void wacom_destroy_leds(struct wacom *wacom)
1041} 1041}
1042 1042
1043static enum power_supply_property wacom_battery_props[] = { 1043static enum power_supply_property wacom_battery_props[] = {
1044 POWER_SUPPLY_PROP_SCOPE,
1044 POWER_SUPPLY_PROP_CAPACITY 1045 POWER_SUPPLY_PROP_CAPACITY
1045}; 1046};
1046 1047
@@ -1052,6 +1053,9 @@ static int wacom_battery_get_property(struct power_supply *psy,
1052 int ret = 0; 1053 int ret = 0;
1053 1054
1054 switch (psp) { 1055 switch (psp) {
1056 case POWER_SUPPLY_PROP_SCOPE:
1057 val->intval = POWER_SUPPLY_SCOPE_DEVICE;
1058 break;
1055 case POWER_SUPPLY_PROP_CAPACITY: 1059 case POWER_SUPPLY_PROP_CAPACITY:
1056 val->intval = 1060 val->intval =
1057 wacom->wacom_wac.battery_capacity * 100 / 31; 1061 wacom->wacom_wac.battery_capacity * 100 / 31;
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c
index eb60a284be05..7655088f78e0 100644
--- a/drivers/input/tablet/wacom_wac.c
+++ b/drivers/input/tablet/wacom_wac.c
@@ -2143,6 +2143,12 @@ static const struct wacom_features wacom_features_0x101 =
2143static const struct wacom_features wacom_features_0x10D = 2143static const struct wacom_features wacom_features_0x10D =
2144 { "Wacom ISDv4 10D", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, 2144 { "Wacom ISDv4 10D", WACOM_PKGLEN_MTTPC, 26202, 16325, 255,
2145 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 2145 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2146static const struct wacom_features wacom_features_0x10E =
2147 { "Wacom ISDv4 10E", WACOM_PKGLEN_MTTPC, 27760, 15694, 255,
2148 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2149static const struct wacom_features wacom_features_0x10F =
2150 { "Wacom ISDv4 10F", WACOM_PKGLEN_MTTPC, 27760, 15694, 255,
2151 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
2146static const struct wacom_features wacom_features_0x4001 = 2152static const struct wacom_features wacom_features_0x4001 =
2147 { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, 2153 { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255,
2148 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; 2154 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@@ -2355,6 +2361,8 @@ const struct usb_device_id wacom_ids[] = {
2355 { USB_DEVICE_WACOM(0x100) }, 2361 { USB_DEVICE_WACOM(0x100) },
2356 { USB_DEVICE_WACOM(0x101) }, 2362 { USB_DEVICE_WACOM(0x101) },
2357 { USB_DEVICE_WACOM(0x10D) }, 2363 { USB_DEVICE_WACOM(0x10D) },
2364 { USB_DEVICE_WACOM(0x10E) },
2365 { USB_DEVICE_WACOM(0x10F) },
2358 { USB_DEVICE_WACOM(0x300) }, 2366 { USB_DEVICE_WACOM(0x300) },
2359 { USB_DEVICE_WACOM(0x301) }, 2367 { USB_DEVICE_WACOM(0x301) },
2360 { USB_DEVICE_DETAILED(0x302, USB_CLASS_HID, 0, 0) }, 2368 { USB_DEVICE_DETAILED(0x302, USB_CLASS_HID, 0, 0) },
diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c
index 56088eceacdc..eee656f77a2e 100644
--- a/drivers/input/touchscreen/cyttsp_core.c
+++ b/drivers/input/touchscreen/cyttsp_core.c
@@ -242,7 +242,7 @@ static int cyttsp_soft_reset(struct cyttsp *ts)
242 int retval; 242 int retval;
243 243
244 /* wait for interrupt to set ready completion */ 244 /* wait for interrupt to set ready completion */
245 INIT_COMPLETION(ts->bl_ready); 245 reinit_completion(&ts->bl_ready);
246 ts->state = CY_BL_STATE; 246 ts->state = CY_BL_STATE;
247 247
248 enable_irq(ts->irq); 248 enable_irq(ts->irq);
diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
index cfd1b7e8c001..f1cb05148b46 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -251,7 +251,7 @@ static void sur40_poll(struct input_polled_dev *polldev)
251 struct sur40_state *sur40 = polldev->private; 251 struct sur40_state *sur40 = polldev->private;
252 struct input_dev *input = polldev->input; 252 struct input_dev *input = polldev->input;
253 int result, bulk_read, need_blobs, packet_blobs, i; 253 int result, bulk_read, need_blobs, packet_blobs, i;
254 u32 packet_id; 254 u32 uninitialized_var(packet_id);
255 255
256 struct sur40_header *header = &sur40->bulk_in_buffer->header; 256 struct sur40_header *header = &sur40->bulk_in_buffer->header;
257 struct sur40_blob *inblob = &sur40->bulk_in_buffer->blobs[0]; 257 struct sur40_blob *inblob = &sur40->bulk_in_buffer->blobs[0];
@@ -286,7 +286,7 @@ static void sur40_poll(struct input_polled_dev *polldev)
286 if (need_blobs == -1) { 286 if (need_blobs == -1) {
287 need_blobs = le16_to_cpu(header->count); 287 need_blobs = le16_to_cpu(header->count);
288 dev_dbg(sur40->dev, "need %d blobs\n", need_blobs); 288 dev_dbg(sur40->dev, "need %d blobs\n", need_blobs);
289 packet_id = header->packet_id; 289 packet_id = le32_to_cpu(header->packet_id);
290 } 290 }
291 291
292 /* 292 /*
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index ad7564296ddf..68beadaabceb 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -52,6 +52,7 @@ struct titsc {
52 u32 config_inp[4]; 52 u32 config_inp[4];
53 u32 bit_xp, bit_xn, bit_yp, bit_yn; 53 u32 bit_xp, bit_xn, bit_yp, bit_yn;
54 u32 inp_xp, inp_xn, inp_yp, inp_yn; 54 u32 inp_xp, inp_xn, inp_yp, inp_yn;
55 u32 step_mask;
55}; 56};
56 57
57static unsigned int titsc_readl(struct titsc *ts, unsigned int reg) 58static unsigned int titsc_readl(struct titsc *ts, unsigned int reg)
@@ -196,7 +197,8 @@ static void titsc_step_config(struct titsc *ts_dev)
196 197
197 /* The steps1 … end and bit 0 for TS_Charge */ 198 /* The steps1 … end and bit 0 for TS_Charge */
198 stepenable = (1 << (end_step + 2)) - 1; 199 stepenable = (1 << (end_step + 2)) - 1;
199 am335x_tsc_se_set(ts_dev->mfd_tscadc, stepenable); 200 ts_dev->step_mask = stepenable;
201 am335x_tsc_se_set(ts_dev->mfd_tscadc, ts_dev->step_mask);
200} 202}
201 203
202static void titsc_read_coordinates(struct titsc *ts_dev, 204static void titsc_read_coordinates(struct titsc *ts_dev,
@@ -260,6 +262,10 @@ static irqreturn_t titsc_irq(int irq, void *dev)
260 unsigned int fsm; 262 unsigned int fsm;
261 263
262 status = titsc_readl(ts_dev, REG_IRQSTATUS); 264 status = titsc_readl(ts_dev, REG_IRQSTATUS);
265 /*
266 * ADC and touchscreen share the IRQ line.
267 * FIFO1 interrupts are used by ADC. Handle FIFO0 IRQs here only
268 */
263 if (status & IRQENB_FIFO0THRES) { 269 if (status & IRQENB_FIFO0THRES) {
264 270
265 titsc_read_coordinates(ts_dev, &x, &y, &z1, &z2); 271 titsc_read_coordinates(ts_dev, &x, &y, &z1, &z2);
@@ -316,7 +322,7 @@ static irqreturn_t titsc_irq(int irq, void *dev)
316 322
317 if (irqclr) { 323 if (irqclr) {
318 titsc_writel(ts_dev, REG_IRQSTATUS, irqclr); 324 titsc_writel(ts_dev, REG_IRQSTATUS, irqclr);
319 am335x_tsc_se_update(ts_dev->mfd_tscadc); 325 am335x_tsc_se_set(ts_dev->mfd_tscadc, ts_dev->step_mask);
320 return IRQ_HANDLED; 326 return IRQ_HANDLED;
321 } 327 }
322 return IRQ_NONE; 328 return IRQ_NONE;
@@ -396,7 +402,7 @@ static int titsc_probe(struct platform_device *pdev)
396 } 402 }
397 403
398 err = request_irq(ts_dev->irq, titsc_irq, 404 err = request_irq(ts_dev->irq, titsc_irq,
399 0, pdev->dev.driver->name, ts_dev); 405 IRQF_SHARED, pdev->dev.driver->name, ts_dev);
400 if (err) { 406 if (err) {
401 dev_err(&pdev->dev, "failed to allocate irq.\n"); 407 dev_err(&pdev->dev, "failed to allocate irq.\n");
402 goto err_free_mem; 408 goto err_free_mem;
diff --git a/drivers/input/touchscreen/usbtouchscreen.c b/drivers/input/touchscreen/usbtouchscreen.c
index 721fdb3597ca..5f87bed05467 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -106,6 +106,7 @@ struct usbtouch_device_info {
106struct usbtouch_usb { 106struct usbtouch_usb {
107 unsigned char *data; 107 unsigned char *data;
108 dma_addr_t data_dma; 108 dma_addr_t data_dma;
109 int data_size;
109 unsigned char *buffer; 110 unsigned char *buffer;
110 int buf_len; 111 int buf_len;
111 struct urb *irq; 112 struct urb *irq;
@@ -146,12 +147,10 @@ enum {
146 147
147#define USB_DEVICE_HID_CLASS(vend, prod) \ 148#define USB_DEVICE_HID_CLASS(vend, prod) \
148 .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \ 149 .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS \
149 | USB_DEVICE_ID_MATCH_INT_PROTOCOL \
150 | USB_DEVICE_ID_MATCH_DEVICE, \ 150 | USB_DEVICE_ID_MATCH_DEVICE, \
151 .idVendor = (vend), \ 151 .idVendor = (vend), \
152 .idProduct = (prod), \ 152 .idProduct = (prod), \
153 .bInterfaceClass = USB_INTERFACE_CLASS_HID, \ 153 .bInterfaceClass = USB_INTERFACE_CLASS_HID
154 .bInterfaceProtocol = USB_INTERFACE_PROTOCOL_MOUSE
155 154
156static const struct usb_device_id usbtouch_devices[] = { 155static const struct usb_device_id usbtouch_devices[] = {
157#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX 156#ifdef CONFIG_TOUCHSCREEN_USB_EGALAX
@@ -1523,7 +1522,7 @@ static int usbtouch_reset_resume(struct usb_interface *intf)
1523static void usbtouch_free_buffers(struct usb_device *udev, 1522static void usbtouch_free_buffers(struct usb_device *udev,
1524 struct usbtouch_usb *usbtouch) 1523 struct usbtouch_usb *usbtouch)
1525{ 1524{
1526 usb_free_coherent(udev, usbtouch->type->rept_size, 1525 usb_free_coherent(udev, usbtouch->data_size,
1527 usbtouch->data, usbtouch->data_dma); 1526 usbtouch->data, usbtouch->data_dma);
1528 kfree(usbtouch->buffer); 1527 kfree(usbtouch->buffer);
1529} 1528}
@@ -1568,7 +1567,20 @@ static int usbtouch_probe(struct usb_interface *intf,
1568 if (!type->process_pkt) 1567 if (!type->process_pkt)
1569 type->process_pkt = usbtouch_process_pkt; 1568 type->process_pkt = usbtouch_process_pkt;
1570 1569
1571 usbtouch->data = usb_alloc_coherent(udev, type->rept_size, 1570 usbtouch->data_size = type->rept_size;
1571 if (type->get_pkt_len) {
1572 /*
1573 * When dealing with variable-length packets we should
1574 * not request more than wMaxPacketSize bytes at once
1575 * as we do not know if there is more data coming or
1576 * we filled exactly wMaxPacketSize bytes and there is
1577 * nothing else.
1578 */
1579 usbtouch->data_size = min(usbtouch->data_size,
1580 usb_endpoint_maxp(endpoint));
1581 }
1582
1583 usbtouch->data = usb_alloc_coherent(udev, usbtouch->data_size,
1572 GFP_KERNEL, &usbtouch->data_dma); 1584 GFP_KERNEL, &usbtouch->data_dma);
1573 if (!usbtouch->data) 1585 if (!usbtouch->data)
1574 goto out_free; 1586 goto out_free;
@@ -1628,12 +1640,12 @@ static int usbtouch_probe(struct usb_interface *intf,
1628 if (usb_endpoint_type(endpoint) == USB_ENDPOINT_XFER_INT) 1640 if (usb_endpoint_type(endpoint) == USB_ENDPOINT_XFER_INT)
1629 usb_fill_int_urb(usbtouch->irq, udev, 1641 usb_fill_int_urb(usbtouch->irq, udev,
1630 usb_rcvintpipe(udev, endpoint->bEndpointAddress), 1642 usb_rcvintpipe(udev, endpoint->bEndpointAddress),
1631 usbtouch->data, type->rept_size, 1643 usbtouch->data, usbtouch->data_size,
1632 usbtouch_irq, usbtouch, endpoint->bInterval); 1644 usbtouch_irq, usbtouch, endpoint->bInterval);
1633 else 1645 else
1634 usb_fill_bulk_urb(usbtouch->irq, udev, 1646 usb_fill_bulk_urb(usbtouch->irq, udev,
1635 usb_rcvbulkpipe(udev, endpoint->bEndpointAddress), 1647 usb_rcvbulkpipe(udev, endpoint->bEndpointAddress),
1636 usbtouch->data, type->rept_size, 1648 usbtouch->data, usbtouch->data_size,
1637 usbtouch_irq, usbtouch); 1649 usbtouch_irq, usbtouch);
1638 1650
1639 usbtouch->irq->dev = udev; 1651 usbtouch->irq->dev = udev;