diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2008-08-08 14:59:32 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2008-08-08 16:24:21 -0400 |
commit | 88da765f4d5f59f67a7a51c8f5d608a836b32133 (patch) | |
tree | 1ea53d543531bef2d8b94957df19de8897b85221 /drivers | |
parent | f89bd95c5c946776f116ffeb997653d4193d6a35 (diff) |
Input: bcm5974 - implement autosuspend support
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/mouse/bcm5974.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index 6f852786c528..2ec921bf3c60 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c | |||
@@ -150,6 +150,7 @@ struct bcm5974_config { | |||
150 | struct bcm5974 { | 150 | struct bcm5974 { |
151 | char phys[64]; | 151 | char phys[64]; |
152 | struct usb_device *udev; /* usb device */ | 152 | struct usb_device *udev; /* usb device */ |
153 | struct usb_interface *intf; /* our interface */ | ||
153 | struct input_dev *input; /* input dev */ | 154 | struct input_dev *input; /* input dev */ |
154 | struct bcm5974_config cfg; /* device configuration */ | 155 | struct bcm5974_config cfg; /* device configuration */ |
155 | struct mutex pm_mutex; /* serialize access to open/suspend */ | 156 | struct mutex pm_mutex; /* serialize access to open/suspend */ |
@@ -478,6 +479,10 @@ static int bcm5974_open(struct input_dev *input) | |||
478 | struct bcm5974 *dev = input_get_drvdata(input); | 479 | struct bcm5974 *dev = input_get_drvdata(input); |
479 | int error; | 480 | int error; |
480 | 481 | ||
482 | error = usb_autopm_get_interface(dev->intf); | ||
483 | if (error) | ||
484 | return error; | ||
485 | |||
481 | mutex_lock(&dev->pm_mutex); | 486 | mutex_lock(&dev->pm_mutex); |
482 | 487 | ||
483 | error = bcm5974_start_traffic(dev); | 488 | error = bcm5974_start_traffic(dev); |
@@ -486,6 +491,9 @@ static int bcm5974_open(struct input_dev *input) | |||
486 | 491 | ||
487 | mutex_unlock(&dev->pm_mutex); | 492 | mutex_unlock(&dev->pm_mutex); |
488 | 493 | ||
494 | if (error) | ||
495 | usb_autopm_put_interface(dev->intf); | ||
496 | |||
489 | return error; | 497 | return error; |
490 | } | 498 | } |
491 | 499 | ||
@@ -499,6 +507,8 @@ static void bcm5974_close(struct input_dev *input) | |||
499 | dev->opened = 0; | 507 | dev->opened = 0; |
500 | 508 | ||
501 | mutex_unlock(&dev->pm_mutex); | 509 | mutex_unlock(&dev->pm_mutex); |
510 | |||
511 | usb_autopm_put_interface(dev->intf); | ||
502 | } | 512 | } |
503 | 513 | ||
504 | static int bcm5974_suspend(struct usb_interface *iface, pm_message_t message) | 514 | static int bcm5974_suspend(struct usb_interface *iface, pm_message_t message) |
@@ -551,6 +561,7 @@ static int bcm5974_probe(struct usb_interface *iface, | |||
551 | } | 561 | } |
552 | 562 | ||
553 | dev->udev = udev; | 563 | dev->udev = udev; |
564 | dev->intf = iface; | ||
554 | dev->input = input_dev; | 565 | dev->input = input_dev; |
555 | dev->cfg = *cfg; | 566 | dev->cfg = *cfg; |
556 | mutex_init(&dev->pm_mutex); | 567 | mutex_init(&dev->pm_mutex); |
@@ -652,6 +663,7 @@ static struct usb_driver bcm5974_driver = { | |||
652 | .resume = bcm5974_resume, | 663 | .resume = bcm5974_resume, |
653 | .reset_resume = bcm5974_resume, | 664 | .reset_resume = bcm5974_resume, |
654 | .id_table = bcm5974_table, | 665 | .id_table = bcm5974_table, |
666 | .supports_autosuspend = 1, | ||
655 | }; | 667 | }; |
656 | 668 | ||
657 | static int __init bcm5974_init(void) | 669 | static int __init bcm5974_init(void) |