diff options
Diffstat (limited to 'bcm5974.c')
| -rw-r--r-- | bcm5974.c | 17 |
1 files changed, 11 insertions, 6 deletions
| @@ -234,8 +234,8 @@ static inline int int2bound(const struct bcm5974_param *p, int x) | |||
| 234 | { | 234 | { |
| 235 | int s = int2scale(p, x); | 235 | int s = int2scale(p, x); |
| 236 | 236 | ||
| 237 | // return clamp_val(s, 0, p->dim - 1); | 237 | //return clamp_val(s, 0, p->dim - 1); |
| 238 | return s < 0 ? 0 : s >= p->dim ? p->dim - 1 : s; | 238 | return s < 0 ? 0 : s >= p->dim ? p->dim - 1 : s; |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | /* setup which logical events to report */ | 241 | /* setup which logical events to report */ |
| @@ -352,8 +352,9 @@ static int report_tp_state(struct bcm5974 *dev, int size) | |||
| 352 | #define BCM5974_WELLSPRING_MODE_REQUEST_VALUE 0x300 | 352 | #define BCM5974_WELLSPRING_MODE_REQUEST_VALUE 0x300 |
| 353 | #define BCM5974_WELLSPRING_MODE_REQUEST_INDEX 0 | 353 | #define BCM5974_WELLSPRING_MODE_REQUEST_INDEX 0 |
| 354 | #define BCM5974_WELLSPRING_MODE_VENDOR_VALUE 0x01 | 354 | #define BCM5974_WELLSPRING_MODE_VENDOR_VALUE 0x01 |
| 355 | #define BCM5974_WELLSPRING_MODE_NORMAL_VALUE 0x08 | ||
| 355 | 356 | ||
| 356 | static int bcm5974_wellspring_mode(struct bcm5974 *dev) | 357 | static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on) |
| 357 | { | 358 | { |
| 358 | char *data = kmalloc(8, GFP_KERNEL); | 359 | char *data = kmalloc(8, GFP_KERNEL); |
| 359 | int retval = 0, size; | 360 | int retval = 0, size; |
| @@ -378,7 +379,9 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev) | |||
| 378 | } | 379 | } |
| 379 | 380 | ||
| 380 | /* apply the mode switch */ | 381 | /* apply the mode switch */ |
| 381 | data[0] = BCM5974_WELLSPRING_MODE_VENDOR_VALUE; | 382 | data[0] = on ? |
| 383 | BCM5974_WELLSPRING_MODE_VENDOR_VALUE : | ||
| 384 | BCM5974_WELLSPRING_MODE_NORMAL_VALUE; | ||
| 382 | 385 | ||
| 383 | /* write configuration */ | 386 | /* write configuration */ |
| 384 | size = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), | 387 | size = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0), |
| @@ -393,7 +396,8 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev) | |||
| 393 | goto out; | 396 | goto out; |
| 394 | } | 397 | } |
| 395 | 398 | ||
| 396 | dprintk(2, "bcm5974: switched to wellspring mode.\n"); | 399 | dprintk(2, "bcm5974: switched to %s mode.\n", |
| 400 | on ? "wellspring" : "normal"); | ||
| 397 | 401 | ||
| 398 | out: | 402 | out: |
| 399 | kfree(data); | 403 | kfree(data); |
| @@ -482,7 +486,7 @@ exit: | |||
| 482 | */ | 486 | */ |
| 483 | static int bcm5974_start_traffic(struct bcm5974 *dev) | 487 | static int bcm5974_start_traffic(struct bcm5974 *dev) |
| 484 | { | 488 | { |
| 485 | if (bcm5974_wellspring_mode(dev)) { | 489 | if (bcm5974_wellspring_mode(dev, true)) { |
| 486 | dprintk(1, "bcm5974: mode switch failed\n"); | 490 | dprintk(1, "bcm5974: mode switch failed\n"); |
| 487 | goto error; | 491 | goto error; |
| 488 | } | 492 | } |
| @@ -505,6 +509,7 @@ static void bcm5974_pause_traffic(struct bcm5974 *dev) | |||
| 505 | { | 509 | { |
| 506 | usb_kill_urb(dev->tp_urb); | 510 | usb_kill_urb(dev->tp_urb); |
| 507 | usb_kill_urb(dev->bt_urb); | 511 | usb_kill_urb(dev->bt_urb); |
| 512 | bcm5974_wellspring_mode(dev, false); | ||
| 508 | } | 513 | } |
| 509 | 514 | ||
| 510 | /* | 515 | /* |
