Commit 25e1c278 authored by Mark Einon's avatar Mark Einon Committed by Greg Kroah-Hartman

staging: et131x: Add pci suspend & resume functions

Added basic suspend & resume functionality.
Tested on an et1310 device, and putting Fedora15 host in and out of
hibernation successfully.
Signed-off-by: default avatarMark Einon <mark.einon@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 1ce664dc
...@@ -10,7 +10,6 @@ driver as they did not build properly at the time. ...@@ -10,7 +10,6 @@ driver as they did not build properly at the time.
TODO: TODO:
- add_timer call in et131x_netdev.c is correct? - add_timer call in et131x_netdev.c is correct?
- Add power saving functionality (suspend, sleep, resume)
- Implement a few more kernel Parameter (set mac ) - Implement a few more kernel Parameter (set mac )
Please send patches to: Please send patches to:
......
...@@ -82,6 +82,8 @@ void et1310_setup_device_for_multicast(struct et131x_adapter *adapter); ...@@ -82,6 +82,8 @@ void et1310_setup_device_for_multicast(struct et131x_adapter *adapter);
void et1310_setup_device_for_unicast(struct et131x_adapter *adapter); void et1310_setup_device_for_unicast(struct et131x_adapter *adapter);
/* et131x_netdev.c */ /* et131x_netdev.c */
int et131x_open(struct net_device *netdev);
int et131x_close(struct net_device *netdev);
struct net_device *et131x_device_alloc(void); struct net_device *et131x_device_alloc(void);
void et131x_enable_txrx(struct net_device *netdev); void et131x_enable_txrx(struct net_device *netdev);
void et131x_disable_txrx(struct net_device *netdev); void et131x_disable_txrx(struct net_device *netdev);
......
...@@ -869,6 +869,45 @@ static void __devexit et131x_pci_remove(struct pci_dev *pdev) ...@@ -869,6 +869,45 @@ static void __devexit et131x_pci_remove(struct pci_dev *pdev)
pci_disable_device(pdev); pci_disable_device(pdev);
} }
static int et131x_pci_suspend(struct pci_dev *pdev, pm_message_t state)
{
struct net_device *netdev = pci_get_drvdata(pdev);
if (!netif_running(netdev))
return 0;
et131x_close(netdev);
netif_device_detach(netdev);
pci_save_state(pdev);
pci_set_power_state(pdev, pci_choose_state(pdev, state));
return 0;
}
static int et131x_pci_resume(struct pci_dev *pdev)
{
struct net_device *netdev = pci_get_drvdata(pdev);
int err = 0;
if (!netif_running(netdev))
return 0;
pci_set_power_state(pdev, PCI_D0);
pci_restore_state(pdev);
err = et131x_open(netdev);
if (err) {
dev_err(&pdev->dev, "Can't resume interface!\n");
goto out;
}
netif_device_attach(netdev);
out:
return err;
}
static struct pci_device_id et131x_pci_table[] __devinitdata = { static struct pci_device_id et131x_pci_table[] __devinitdata = {
{ET131X_PCI_VENDOR_ID, ET131X_PCI_DEVICE_ID_GIG, PCI_ANY_ID, {ET131X_PCI_VENDOR_ID, ET131X_PCI_DEVICE_ID_GIG, PCI_ANY_ID,
PCI_ANY_ID, 0, 0, 0UL}, PCI_ANY_ID, 0, 0, 0UL},
...@@ -884,8 +923,10 @@ static struct pci_driver et131x_driver = { ...@@ -884,8 +923,10 @@ static struct pci_driver et131x_driver = {
.id_table = et131x_pci_table, .id_table = et131x_pci_table,
.probe = et131x_pci_setup, .probe = et131x_pci_setup,
.remove = __devexit_p(et131x_pci_remove), .remove = __devexit_p(et131x_pci_remove),
.suspend = NULL, /* et131x_pci_suspend */ #ifdef CONFIG_PM
.resume = NULL, /* et131x_pci_resume */ .suspend = et131x_pci_suspend,
.resume = et131x_pci_resume,
#endif
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment