linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3] input: Fix USB autosuspend on bcm5974
@ 2011-10-10 15:47 Matthew Garrett
  2011-10-10 21:05 ` Henrik Rydberg
  0 siblings, 1 reply; 36+ messages in thread
From: Matthew Garrett @ 2011-10-10 15:47 UTC (permalink / raw)
  To: linux-input; +Cc: rydberg, dtor, Matthew Garrett

The bcm5974 code takes a USB autosuspend reference on device open and
releases it on device close. This means that the hardware won't sleep when
anything holds it open. This is sensible for input devices that don't
support remote wakeups on normal use (like most mice), but this hardware
trigger wakeups on touch and so can suspend transparently to the user. Doing
so allows the USB host controller to sleep when the machine is idle, giving
measurable power savings.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
---

Correctly flag needs_remote_wake.

 drivers/input/mouse/bcm5974.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index 5ec617e..4ca5523 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -631,6 +631,7 @@ static void bcm5974_irq_button(struct urb *urb)
 
 	switch (urb->status) {
 	case 0:
+		usb_mark_last_busy(dev->udev);
 		break;
 	case -EOVERFLOW:
 	case -ECONNRESET:
@@ -660,6 +661,7 @@ static void bcm5974_irq_trackpad(struct urb *urb)
 
 	switch (urb->status) {
 	case 0:
+		usb_mark_last_busy(dev->udev);
 		break;
 	case -EOVERFLOW:
 	case -ECONNRESET:
@@ -764,8 +766,7 @@ static int bcm5974_open(struct input_dev *input)
 
 	mutex_unlock(&dev->pm_mutex);
 
-	if (error)
-		usb_autopm_put_interface(dev->intf);
+	usb_autopm_put_interface(dev->intf);
 
 	return error;
 }
@@ -780,8 +781,6 @@ static void bcm5974_close(struct input_dev *input)
 	dev->opened = 0;
 
 	mutex_unlock(&dev->pm_mutex);
-
-	usb_autopm_put_interface(dev->intf);
 }
 
 static int bcm5974_suspend(struct usb_interface *iface, pm_message_t message)
@@ -870,6 +869,9 @@ static int bcm5974_probe(struct usb_interface *iface,
 			 dev->tp_data, dev->cfg.tp_datalen,
 			 bcm5974_irq_trackpad, dev, 1);
 
+	/* Required for autosuspend */
+	iface->needs_remote_wakeup = 1;
+
 	/* create bcm5974 device */
 	usb_make_path(udev, dev->phys, sizeof(dev->phys));
 	strlcat(dev->phys, "/input0", sizeof(dev->phys));
-- 
1.7.6.4


^ permalink raw reply related	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2011-10-13 17:14 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-10 15:47 [PATCH V3] input: Fix USB autosuspend on bcm5974 Matthew Garrett
2011-10-10 21:05 ` Henrik Rydberg
2011-10-10 21:12   ` Matthew Garrett
2011-10-10 22:44     ` Henrik Rydberg
2011-10-11  0:11       ` Matthew Garrett
2011-10-11  4:10         ` Oliver Neukum
2011-10-11 11:04           ` Henrik Rydberg
2011-10-11 11:09             ` Oliver Neukum
2011-10-11 20:42               ` Matthew Garrett
2011-10-12  6:32                 ` Oliver Neukum
2011-10-12 14:33                   ` Alan Stern
2011-10-12 14:37                     ` Oliver Neukum
2011-10-12 15:28                       ` Alan Stern
2011-10-12 16:16                         ` Matthew Garrett
2011-10-12 16:56                           ` Oliver Neukum
2011-10-12 16:59                             ` Matthew Garrett
2011-10-12 17:24                               ` Alan Stern
2011-10-12 17:26                                 ` Matthew Garrett
2011-10-12 17:41                                   ` Alan Stern
2011-10-12 18:33                               ` Henrik Rydberg
2011-10-12 19:21                                 ` Alan Stern
2011-10-13  8:20                                   ` Henrik Rydberg
2011-10-13 15:49                                     ` Alan Stern
2011-10-13 17:21                                       ` Henrik Rydberg
2011-10-12 17:11                         ` Oliver Neukum
2011-10-12 19:18                           ` Alan Stern
2011-10-11 16:05           ` Dmitry Torokhov
2011-10-11 16:43             ` Alan Stern
2011-10-12  7:03               ` Oliver Neukum
2011-10-12 13:54                 ` Matthew Garrett
2011-10-12 14:18                   ` Alan Stern
2011-10-12 14:26                     ` Matthew Garrett
2011-10-12 14:38                       ` Oliver Neukum
2011-10-12 18:50                         ` Henrik Rydberg
2011-10-13  6:47                           ` Oliver Neukum
2011-10-10 21:16   ` Matthew Garrett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).