staging: rtl8192e: Remove dead code
[deliverable/linux.git] / drivers / staging / rtl8192e / r8192_pm.c
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 #include "r8192E.h"
13 #include "r8192E_hw.h"
14 #include "r8192_pm.h"
15 #include "r8190_rtl8256.h"
16
17 int rtl8192E_save_state (struct pci_dev *dev, pm_message_t state)
18 {
19 printk(KERN_NOTICE "r8192E save state call (state %u).\n", state.event);
20 return -EAGAIN;
21 }
22
23
24 int rtl8192E_suspend (struct pci_dev *pdev, pm_message_t state)
25 {
26 struct net_device *dev = pci_get_drvdata(pdev);
27 struct r8192_priv *priv = ieee80211_priv(dev);
28 #ifdef RTL8190P
29 u8 ucRegRead;
30 #endif
31 u32 ulRegRead;
32
33 RT_TRACE(COMP_POWER, "============> r8192E suspend call.\n");
34 if (!netif_running(dev))
35 goto out_pci_suspend;
36
37 if (dev->netdev_ops->ndo_stop)
38 dev->netdev_ops->ndo_stop(dev);
39
40 // Call MgntActSet_RF_State instead to prevent RF config race condition.
41 if(!priv->ieee80211->bSupportRemoteWakeUp) {
42 MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_INIT);
43 // 2006.11.30. System reset bit
44 ulRegRead = read_nic_dword(priv, CPU_GEN);
45 ulRegRead|=CPU_GEN_SYSTEM_RESET;
46 write_nic_dword(priv, CPU_GEN, ulRegRead);
47 } else {
48 //2008.06.03 for WOL
49 write_nic_dword(priv, WFCRC0, 0xffffffff);
50 write_nic_dword(priv, WFCRC1, 0xffffffff);
51 write_nic_dword(priv, WFCRC2, 0xffffffff);
52 #ifdef RTL8190P
53 //GPIO 0 = TRUE
54 ucRegRead = read_nic_byte(priv, GPO);
55 ucRegRead |= BIT0;
56 write_nic_byte(priv, GPO, ucRegRead);
57 #endif
58 //Write PMR register
59 write_nic_byte(priv, PMR, 0x5);
60 //Disable tx, enanble rx
61 write_nic_byte(priv, MacBlkCtrl, 0xa);
62 }
63
64 out_pci_suspend:
65 RT_TRACE(COMP_POWER, "r8192E support WOL call??????????????????????\n");
66 if(priv->ieee80211->bSupportRemoteWakeUp) {
67 RT_TRACE(COMP_POWER, "r8192E support WOL call!!!!!!!!!!!!!!!!!!.\n");
68 }
69 netif_device_detach(dev);
70 pci_save_state(pdev);
71 pci_disable_device(pdev);
72 pci_enable_wake(pdev, pci_choose_state(pdev,state),
73 priv->ieee80211->bSupportRemoteWakeUp?1:0);
74 pci_set_power_state(pdev,pci_choose_state(pdev,state));
75
76 return 0;
77 }
78
79 int rtl8192E_resume (struct pci_dev *pdev)
80 {
81 struct net_device *dev = pci_get_drvdata(pdev);
82 int err;
83 u32 val;
84
85 RT_TRACE(COMP_POWER, "================>r8192E resume call.");
86
87 pci_set_power_state(pdev, PCI_D0);
88
89 err = pci_enable_device(pdev);
90 if(err) {
91 printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
92 dev->name);
93 return err;
94 }
95
96 pci_restore_state(pdev);
97
98 /*
99 * Suspend/Resume resets the PCI configuration space, so we have to
100 * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries
101 * from interfering with C3 CPU state. pci_restore_state won't help
102 * here since it only restores the first 64 bytes pci config header.
103 */
104 pci_read_config_dword(pdev, 0x40, &val);
105 if ((val & 0x0000ff00) != 0) {
106 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
107 }
108
109
110
111 pci_enable_wake(pdev, PCI_D0, 0);
112
113 if(!netif_running(dev))
114 goto out;
115
116 netif_device_attach(dev);
117
118 if (dev->netdev_ops->ndo_open)
119 dev->netdev_ops->ndo_open(dev);
120
121 out:
122 RT_TRACE(COMP_POWER, "<================r8192E resume call.\n");
123 return 0;
124 }
125
126
127 int rtl8192E_enable_wake (struct pci_dev *dev, pm_message_t state, int enable)
128 {
129 printk(KERN_NOTICE "r8192E enable wake call (state %u, enable %d).\n",
130 state.event, enable);
131 return -EAGAIN;
132 }
This page took 0.03382 seconds and 6 git commands to generate.