added 2.6.29.6 aldebaran kernel
[nao-ulib.git] / kernel / 2.6.29.6-aldebaran-rt / drivers / staging / rtl8187se / r8180_pm.c
blob3851b936835680cb827581e551798377f2c460a1
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.
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)
12 #ifdef CONFIG_RTL8180_PM
15 #include "r8180_hw.h"
16 #include "r8180_pm.h"
17 #include "r8180.h"
19 int rtl8180_save_state (struct pci_dev *dev, u32 state)
21 printk(KERN_NOTICE "r8180 save state call (state %u).\n", state);
22 return(-EAGAIN);
25 int rtl8180_suspend (struct pci_dev *pdev, pm_message_t state)
27 struct net_device *dev = pci_get_drvdata(pdev);
28 // struct r8180_priv *priv = ieee80211_priv(dev);
30 if (!netif_running(dev))
31 goto out_pci_suspend;
33 dev->stop(dev);
35 netif_device_detach(dev);
37 out_pci_suspend:
38 pci_save_state(pdev);
39 pci_disable_device(pdev);
40 pci_set_power_state(pdev,pci_choose_state(pdev,state));
41 return 0;
44 int rtl8180_resume (struct pci_dev *pdev)
46 struct net_device *dev = pci_get_drvdata(pdev);
47 // struct r8180_priv *priv = ieee80211_priv(dev);
48 int err;
49 u32 val;
51 pci_set_power_state(pdev, PCI_D0);
53 err = pci_enable_device(pdev);
54 if(err) {
55 printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
56 dev->name);
58 return err;
60 pci_restore_state(pdev);
62 * Suspend/Resume resets the PCI configuration space, so we have to
63 * re-disable the RETRY_TIMEOUT register (0x41) to keep PCI Tx retries
64 * from interfering with C3 CPU state. pci_restore_state won't help
65 * here since it only restores the first 64 bytes pci config header.
67 pci_read_config_dword(pdev, 0x40, &val);
68 if ((val & 0x0000ff00) != 0)
69 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
71 if(!netif_running(dev))
72 goto out;
74 dev->open(dev);
75 netif_device_attach(dev);
76 out:
77 return 0;
81 int rtl8180_enable_wake (struct pci_dev *dev, u32 state, int enable)
83 printk(KERN_NOTICE "r8180 enable wake call (state %u, enable %d).\n",
84 state, enable);
85 return(-EAGAIN);
90 #endif //CONFIG_RTL8180_PM