aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2008-09-14 11:52:44 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-09-16 12:28:13 -0400
commitcd72ad3f57c400baa2ddb78b4fc2781cf68ffb6f (patch)
treeb8cad1c1e5b5afb7621a090934240d8b07859c8a /drivers/input/mouse
parent9ce1ca284a322ba6f9d691136a29c9cfe381e1fc (diff)
Input: bcm5974 - switch back to normal mode when closing
Staying in multi-touch mode after closing the device sometimes makes the keyboard drop keys or repeat keys irratically. The conjecture is that some internal buffer starts to overflow, resulting in undefined behavior. Switching back to normal mode when closing the device makes the problem go away. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r--drivers/input/mouse/bcm5974.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index 18f4d7f6ce6d..2998a6ac9ae4 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -351,8 +351,9 @@ static int report_tp_state(struct bcm5974 *dev, int size)
351#define BCM5974_WELLSPRING_MODE_REQUEST_VALUE 0x300 351#define BCM5974_WELLSPRING_MODE_REQUEST_VALUE 0x300
352#define BCM5974_WELLSPRING_MODE_REQUEST_INDEX 0 352#define BCM5974_WELLSPRING_MODE_REQUEST_INDEX 0
353#define BCM5974_WELLSPRING_MODE_VENDOR_VALUE 0x01 353#define BCM5974_WELLSPRING_MODE_VENDOR_VALUE 0x01
354#define BCM5974_WELLSPRING_MODE_NORMAL_VALUE 0x08
354 355
355static int bcm5974_wellspring_mode(struct bcm5974 *dev) 356static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on)
356{ 357{
357 char *data = kmalloc(8, GFP_KERNEL); 358 char *data = kmalloc(8, GFP_KERNEL);
358 int retval = 0, size; 359 int retval = 0, size;
@@ -377,7 +378,9 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev)
377 } 378 }
378 379
379 /* apply the mode switch */ 380 /* apply the mode switch */
380 data[0] = BCM5974_WELLSPRING_MODE_VENDOR_VALUE; 381 data[0] = on ?
382 BCM5974_WELLSPRING_MODE_VENDOR_VALUE :
383 BCM5974_WELLSPRING_MODE_NORMAL_VALUE;
381 384
382 /* write configuration */ 385 /* write configuration */
383 size = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), 386 size = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
@@ -392,7 +395,8 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev)
392 goto out; 395 goto out;
393 } 396 }
394 397
395 dprintk(2, "bcm5974: switched to wellspring mode.\n"); 398 dprintk(2, "bcm5974: switched to %s mode.\n",
399 on ? "wellspring" : "normal");
396 400
397 out: 401 out:
398 kfree(data); 402 kfree(data);
@@ -481,7 +485,7 @@ exit:
481 */ 485 */
482static int bcm5974_start_traffic(struct bcm5974 *dev) 486static int bcm5974_start_traffic(struct bcm5974 *dev)
483{ 487{
484 if (bcm5974_wellspring_mode(dev)) { 488 if (bcm5974_wellspring_mode(dev, true)) {
485 dprintk(1, "bcm5974: mode switch failed\n"); 489 dprintk(1, "bcm5974: mode switch failed\n");
486 goto error; 490 goto error;
487 } 491 }
@@ -504,6 +508,7 @@ static void bcm5974_pause_traffic(struct bcm5974 *dev)
504{ 508{
505 usb_kill_urb(dev->tp_urb); 509 usb_kill_urb(dev->tp_urb);
506 usb_kill_urb(dev->bt_urb); 510 usb_kill_urb(dev->bt_urb);
511 bcm5974_wellspring_mode(dev, false);
507} 512}
508 513
509/* 514/*