Skip to contentSkip to conversation

aggressive power management for cdc-ether

rft Oliver Neukum 1 participant 1 message Oct 19, 2009

Subsystems (6)
lore
Share & tools
lore

Oliver Neukum

author maintainer
#0 lore raw

Hi,

this implements usb autosuspend for online cdc-ether devices that support remote wakeup? What do you think?

Regards
Oliver

--

commit 956c214d266fc1764ceb931b039c7aadded4eb24

Author: Oliver Neukum <[email protected]>
Date:   Mon Oct 19 15:07:54 2009 +0200

usb:usbnet&cdc-ether:full aggressive autosuspend

autosuspend for cdc-ether devices while online if the device supports remote wakeup

drivers/net/usb/cdc_ether.c +8 -0
index 4a6aff5..8ee5bd7 100644
@@ -411,6 +411,12 @@ static int cdc_bind(struct usbnet *dev, struct usb_interface *intf)
 	return 0;
 }
 
+static int cdc_manage_power(struct usbnet *dev, int on)
+{
+	dev->intf->needs_remote_wakeup = on;
+	return 0;
+}
+
 static const struct driver_info	cdc_info = {
 	.description =	"CDC Ethernet Device",
 	.flags =	FLAG_ETHER,
@@ -418,6 +424,7 @@ static const struct driver_info	cdc_info = {
 	.bind =		cdc_bind,
 	.unbind =	usbnet_cdc_unbind,
 	.status =	cdc_status,
+	.manage_power =	cdc_manage_power,
 };
 
 /*-------------------------------------------------------------------------*/
@@ -570,6 +577,7 @@ static struct usb_driver cdc_driver = {
 	.disconnect =	usbnet_disconnect,
 	.suspend =	usbnet_suspend,
 	.resume =	usbnet_resume,
+	.supports_autosuspend = 1,
 };
 
 
drivers/net/usb/usbnet.c +100 -29

232 lines not on this page · raw message

include/linux/usb/usbnet.h +6 -0
index f814730..e418c0b 100644
@@ -55,6 +55,7 @@ struct usbnet {
 	struct sk_buff_head	done;
 	struct sk_buff_head	rxq_pause;
 	struct urb		*interrupt;
+	struct urb		*deferred;
 	struct tasklet_struct	bh;
 
 	struct work_struct	kevent;
@@ -65,6 +66,8 @@ struct usbnet {
 #		define EVENT_STS_SPLIT	3
 #		define EVENT_LINK_RESET	4
 #		define EVENT_RX_PAUSED	5
+#             define EVENT_DEV_WAKING 6 
+#             define EVENT_DEV_ASLEEP 7 
 };
 
 static inline struct usb_driver *driver_of(struct usb_interface *intf)
@@ -107,6 +110,9 @@ struct driver_info {
 	/* see if peer is connected ... can sleep */
 	int	(*check_connect)(struct usbnet *);
 
+	/* (dis)activate runtime power management */
+	int	(*manage_power)(struct usbnet *, int);
+
 	/* for status polling */
 	void	(*status)(struct usbnet *, struct urb *);