Skip to contentSkip to conversation

power management for zaurus

PATCH Oliver Neukum 1 participant 1 message Oct 19, 2009

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

Hi,

could somebody with a zaurus test this patch?
It introduces aggressive usb autosuspend for the devices. It depends on the attached basic support for usbnet.

Regards
Oliver

--

commit ce0be29fc149b0e178a47a9a2380ef2be52ea7c6

Author: Oliver Neukum <[email protected]>
Date:   Mon Oct 19 13:55:56 2009 +0200

zaurus & rndis_host autosuspend

drivers/net/usb/rndis_host.c +8 -0
index 0caa800..4630703 100644
@@ -571,12 +571,19 @@ fill:
 }
 EXPORT_SYMBOL_GPL(rndis_tx_fixup);
 
+static int rndis_manage_power(struct usbnet *dev, int on)
+{
+	dev->intf->needs_remote_wakeup = on;
+	return 0;
+}
+
 
 static const struct driver_info	rndis_info = {
 	.description =	"RNDIS device",
 	.flags =	FLAG_ETHER | FLAG_FRAMING_RN | FLAG_NO_SETINT,
 	.bind =		rndis_bind,
 	.unbind =	rndis_unbind,
+	.manage_power =	rndis_manage_power,
 	.status =	rndis_status,
 	.rx_fixup =	rndis_rx_fixup,
 	.tx_fixup =	rndis_tx_fixup,
@@ -609,6 +616,7 @@ static struct usb_driver rndis_driver = {
 	.disconnect =	usbnet_disconnect,
 	.suspend =	usbnet_suspend,
 	.resume =	usbnet_resume,
+	.supports_autosuspend = 1,
 };
 
 static int __init rndis_init(void)
drivers/net/usb/zaurus.c +11 -0
index 04882c8..015c49d 100644
@@ -94,6 +94,12 @@ static int zaurus_bind(struct usbnet *dev, struct usb_interface *intf)
 	return usbnet_generic_cdc_bind(dev, intf);
 }
 
+static int zaurus_manage_power(struct usbnet *dev, int on)
+{
+	dev->intf->needs_remote_wakeup = on;
+	return 0;
+}
+
 /* PDA style devices are always connected if present */
 static int always_connected (struct usbnet *dev)
 {
@@ -106,6 +112,7 @@ static const struct driver_info	zaurus_sl5x00_info = {
 	.check_connect = always_connected,
 	.bind =		zaurus_bind,
 	.unbind =	usbnet_cdc_unbind,
+	.manage_power =	zaurus_manage_power,
 	.tx_fixup =	zaurus_tx_fixup,
 };
 #define	ZAURUS_STRONGARM_INFO	((unsigned long)&zaurus_sl5x00_info)
@@ -116,6 +123,7 @@ static const struct driver_info	zaurus_pxa_info = {
 	.check_connect = always_connected,
 	.bind =		zaurus_bind,
 	.unbind =	usbnet_cdc_unbind,
+	.manage_power =	zaurus_manage_power,
 	.tx_fixup =	zaurus_tx_fixup,
 };
 #define	ZAURUS_PXA_INFO		((unsigned long)&zaurus_pxa_info)
@@ -126,6 +134,7 @@ static const struct driver_info	olympus_mxl_info = {
 	.check_connect = always_connected,
 	.bind =		zaurus_bind,
 	.unbind =	usbnet_cdc_unbind,
+	.manage_power =	zaurus_manage_power,
 	.tx_fixup =	zaurus_tx_fixup,
 };
 #define	OLYMPUS_MXL_INFO	((unsigned long)&olympus_mxl_info)
@@ -262,6 +271,7 @@ static const struct driver_info	bogus_mdlm_info = {
 	.check_connect = always_connected,
 	.tx_fixup =	zaurus_tx_fixup,
 	.bind =		blan_mdlm_bind,
+	.manage_power = zaurus_manage_power
 };
 
 static const struct usb_device_id	products [] = {
@@ -370,6 +380,7 @@ static struct usb_driver zaurus_driver = {
 	.disconnect =	usbnet_disconnect,
 	.suspend =	usbnet_suspend,
 	.resume =	usbnet_resume,
+	.supports_autosuspend = 1,
 };
 
 static int __init zaurus_init(void)

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 *);