2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-23 12:43:55 +08:00

libertas: implement suspend/resume for USB devices

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
David Woodhouse 2007-12-12 17:40:56 -05:00 committed by David S. Miller
parent ab25ecaea5
commit d1f7a5b8cf

View File

@ -242,6 +242,10 @@ static int if_usb_probe(struct usb_interface *intf,
if_usb_set_boot2_ver(priv); if_usb_set_boot2_ver(priv);
/* Set suspend/resume configuration:
wake via GPIO2 after a 20ms delay */
lbs_host_sleep_cfg(priv, EHS_WAKE_ON_UNICAST_DATA, 2, 20);
usb_get_dev(udev); usb_get_dev(udev);
usb_set_intfdata(intf, cardp); usb_set_intfdata(intf, cardp);
@ -969,21 +973,24 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
{ {
struct usb_card_rec *cardp = usb_get_intfdata(intf); struct usb_card_rec *cardp = usb_get_intfdata(intf);
struct lbs_private *priv = cardp->priv; struct lbs_private *priv = cardp->priv;
int ret;
lbs_deb_enter(LBS_DEB_USB); lbs_deb_enter(LBS_DEB_USB);
if (priv->psstate != PS_STATE_FULL_POWER) if (priv->psstate != PS_STATE_FULL_POWER)
return -1; return -1;
netif_device_detach(priv->dev); ret = lbs_suspend(priv);
netif_device_detach(priv->mesh_dev); if (ret)
goto out;
/* Unlink tx & rx urb */ /* Unlink tx & rx urb */
usb_kill_urb(cardp->tx_urb); usb_kill_urb(cardp->tx_urb);
usb_kill_urb(cardp->rx_urb); usb_kill_urb(cardp->rx_urb);
out:
lbs_deb_leave(LBS_DEB_USB); lbs_deb_leave(LBS_DEB_USB);
return 0; return ret;
} }
static int if_usb_resume(struct usb_interface *intf) static int if_usb_resume(struct usb_interface *intf)
@ -995,8 +1002,7 @@ static int if_usb_resume(struct usb_interface *intf)
if_usb_submit_rx_urb(cardp); if_usb_submit_rx_urb(cardp);
netif_device_attach(priv->dev); lbs_resume(priv);
netif_device_attach(priv->mesh_dev);
lbs_deb_leave(LBS_DEB_USB); lbs_deb_leave(LBS_DEB_USB);
return 0; return 0;