suspend: PCI power managment reference implementation
PATCH 1/1 suspend: PCI power managment reference implementation
Added reference implementation of suspend and resume routines.
From: Shaohua Li <[email protected]>
Signed-off-by Pavel Machek <[email protected]>
---
commit d9b44d1230ad7a7474583eef8ae57060137466c4 tree c50cf60fc2e546606c2f6e7c5f3f32655dee778d parent 54afa0887fd3618c7fa350b14cc57446db2a261a author <pavel@amd.(none)> Fri, 27 May 2005 09:19:51 +0200 committer <pavel@amd.(none)> Fri, 27 May 2005 09:19:51 +0200
Documentation/power/pci.txt | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+)
Documentation/power/pci.txt (mode:100644) +38 -0
@@ -291,6 +291,44 @@ pci_enable_wake (one for both D3hot and D3cold). +A reference implementation +------------------------- +.suspend() +{ + /* driver specific operations */ + + /* Disable IRQ */ + free_irq(); + /* If using MSI */ + pci_disable_msi(); + + pci_save_state(); + pci_enable_wake(); + /* Disable IO/bus master/irq router */ + pci_disable_device(); + pci_set_power_state(pci_choose_state()); +} + +.resume() +{ + pci_set_power_state(PCI_D0); + pci_restore_state(); + /* device's irq possibly is changed, driver should take care */ + pci_enable_device(); + pci_set_master(); + + /* if using MSI, device's vector possibly is changed */ + pci_enable_msi(); + + request_irq(); + /* driver specific operations; */ +} + +This is a typical implementation. Drivers can slightly change the order +of the operations in the implementation, ignore some operations or add +more deriver specific operations in it, but drivers should do something like +this on the whole. + 5. Resources ~~~~~~~~~~~~