Jerry Chuang | 5f53d8c | 2009-05-21 22:16:02 -0700 | [diff] [blame] | 1 | /* |
| 2 | Power management interface routines. |
| 3 | Written by Mariusz Matuszek. |
| 4 | This code is currently just a placeholder for later work and |
| 5 | does not do anything useful. |
| 6 | |
| 7 | This is part of rtl8180 OpenSource driver. |
| 8 | Copyright (C) Andrea Merello 2004 <andreamrl@tiscali.it> |
| 9 | Released under the terms of GPL (General Public Licence) |
| 10 | */ |
| 11 | |
| 12 | #ifdef CONFIG_RTL8192_PM |
| 13 | #include "r8192U.h" |
| 14 | #include "r8192U_pm.h" |
| 15 | |
| 16 | /*****************************************************************************/ |
| 17 | int rtl8192U_save_state (struct pci_dev *dev, u32 state) |
| 18 | { |
| 19 | printk(KERN_NOTICE "r8192U save state call (state %u).\n", state); |
| 20 | return(-EAGAIN); |
| 21 | } |
| 22 | |
| 23 | int rtl8192U_suspend(struct usb_interface *intf, pm_message_t state) |
| 24 | { |
| 25 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) |
| 26 | struct net_device *dev = usb_get_intfdata(intf); |
| 27 | #else |
| 28 | //struct net_device *dev = (struct net_device *)ptr; |
| 29 | #endif |
| 30 | RT_TRACE(COMP_POWER, "============> r8192U suspend call.\n"); |
| 31 | |
| 32 | if(dev) { |
| 33 | if (!netif_running(dev)) { |
| 34 | printk(KERN_WARNING "netif not running, go out suspend function\n"); |
| 35 | return 0; |
| 36 | } |
| 37 | |
Bartlomiej Zolnierkiewicz | 77b9288 | 2009-06-11 20:49:07 +0200 | [diff] [blame] | 38 | if (dev->netdev_ops->ndo_stop) |
| 39 | dev->netdev_ops->ndo_stop(dev); |
| 40 | |
Jerry Chuang | 5f53d8c | 2009-05-21 22:16:02 -0700 | [diff] [blame] | 41 | mdelay(10); |
| 42 | |
| 43 | netif_device_detach(dev); |
| 44 | } |
| 45 | |
| 46 | return 0; |
| 47 | } |
| 48 | |
| 49 | int rtl8192U_resume (struct usb_interface *intf) |
| 50 | { |
| 51 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) |
| 52 | struct net_device *dev = usb_get_intfdata(intf); |
| 53 | #else |
| 54 | //struct net_device *dev = (struct net_device *)ptr; |
| 55 | #endif |
| 56 | |
| 57 | RT_TRACE(COMP_POWER, "================>r8192U resume call."); |
| 58 | |
| 59 | if(dev) { |
| 60 | if (!netif_running(dev)){ |
| 61 | printk(KERN_WARNING "netif not running, go out resume function\n"); |
| 62 | return 0; |
| 63 | } |
| 64 | |
| 65 | netif_device_attach(dev); |
Bartlomiej Zolnierkiewicz | 77b9288 | 2009-06-11 20:49:07 +0200 | [diff] [blame] | 66 | |
| 67 | if (dev->netdev_ops->ndo_open) |
| 68 | dev->netdev_ops->ndo_open(dev); |
Jerry Chuang | 5f53d8c | 2009-05-21 22:16:02 -0700 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | return 0; |
| 72 | } |
| 73 | |
| 74 | int rtl8192U_enable_wake (struct pci_dev *dev, u32 state, int enable) |
| 75 | { |
| 76 | printk(KERN_NOTICE "r8192U enable wake call (state %u, enable %d).\n", |
| 77 | state, enable); |
| 78 | return(-EAGAIN); |
| 79 | } |
| 80 | |
| 81 | #endif //CONFIG_RTL8192_PM |