Commit cd72ad3f authored by Henrik Rydberg's avatar Henrik Rydberg Committed by Dmitry Torokhov

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: default avatarHenrik Rydberg <rydberg@euromail.se>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 9ce1ca28
...@@ -351,8 +351,9 @@ static int report_tp_state(struct bcm5974 *dev, int size) ...@@ -351,8 +351,9 @@ static int report_tp_state(struct bcm5974 *dev, int size)
#define BCM5974_WELLSPRING_MODE_REQUEST_VALUE 0x300 #define BCM5974_WELLSPRING_MODE_REQUEST_VALUE 0x300
#define BCM5974_WELLSPRING_MODE_REQUEST_INDEX 0 #define BCM5974_WELLSPRING_MODE_REQUEST_INDEX 0
#define BCM5974_WELLSPRING_MODE_VENDOR_VALUE 0x01 #define BCM5974_WELLSPRING_MODE_VENDOR_VALUE 0x01
#define BCM5974_WELLSPRING_MODE_NORMAL_VALUE 0x08
static int bcm5974_wellspring_mode(struct bcm5974 *dev) static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on)
{ {
char *data = kmalloc(8, GFP_KERNEL); char *data = kmalloc(8, GFP_KERNEL);
int retval = 0, size; int retval = 0, size;
...@@ -377,7 +378,9 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev) ...@@ -377,7 +378,9 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev)
} }
/* apply the mode switch */ /* apply the mode switch */
data[0] = BCM5974_WELLSPRING_MODE_VENDOR_VALUE; data[0] = on ?
BCM5974_WELLSPRING_MODE_VENDOR_VALUE :
BCM5974_WELLSPRING_MODE_NORMAL_VALUE;
/* write configuration */ /* write configuration */
size = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), size = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
...@@ -392,7 +395,8 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev) ...@@ -392,7 +395,8 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev)
goto out; goto out;
} }
dprintk(2, "bcm5974: switched to wellspring mode.\n"); dprintk(2, "bcm5974: switched to %s mode.\n",
on ? "wellspring" : "normal");
out: out:
kfree(data); kfree(data);
...@@ -481,7 +485,7 @@ static void bcm5974_irq_trackpad(struct urb *urb) ...@@ -481,7 +485,7 @@ static void bcm5974_irq_trackpad(struct urb *urb)
*/ */
static int bcm5974_start_traffic(struct bcm5974 *dev) static int bcm5974_start_traffic(struct bcm5974 *dev)
{ {
if (bcm5974_wellspring_mode(dev)) { if (bcm5974_wellspring_mode(dev, true)) {
dprintk(1, "bcm5974: mode switch failed\n"); dprintk(1, "bcm5974: mode switch failed\n");
goto error; goto error;
} }
...@@ -504,6 +508,7 @@ static void bcm5974_pause_traffic(struct bcm5974 *dev) ...@@ -504,6 +508,7 @@ static void bcm5974_pause_traffic(struct bcm5974 *dev)
{ {
usb_kill_urb(dev->tp_urb); usb_kill_urb(dev->tp_urb);
usb_kill_urb(dev->bt_urb); usb_kill_urb(dev->bt_urb);
bcm5974_wellspring_mode(dev, false);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment