summaryrefslogtreecommitdiffstats
path: root/Documentation/power/pci.txt
diff options
context:
space:
mode:
authorpavel@ucw.cz <pavel@ucw.cz>2005-06-25 14:55:16 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-25 16:24:34 -0700
commit21d6b7e18f70c847c867aafb3109405b48424388 (patch)
tree4e4a965f411453edb39263a82a3a590224ad1e86 /Documentation/power/pci.txt
parentac25575203c11145066ea5cb583354cb5f0a8ade (diff)
[PATCH] suspend: PCI power managment reference implementation
Added reference implementation of suspend and resume routines. From: Shaohua Li <shaohua.li@intel.com> build fix Signed-off-by: Pavel Machek <pavel@suse.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'Documentation/power/pci.txt')
-rw-r--r--Documentation/power/pci.txt38
1 files changed, 38 insertions, 0 deletions
diff --git a/Documentation/power/pci.txt b/Documentation/power/pci.txt
index 35b1a7dae34..6fc9d511fc3 100644
--- a/Documentation/power/pci.txt
+++ b/Documentation/power/pci.txt
@@ -291,6 +291,44 @@ a request to enable wake events from D3, two calls should be made to
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
~~~~~~~~~~~~