2 * resume.c - Functions for waking devices up.
4 * Copyright (c) 2003 Patrick Mochel
5 * Copyright (c) 2003 Open Source Development Labs
7 * This file is released under the GPLv2
11 #include <linux/device.h>
17 * resume_device - Restore state for one device.
22 int resume_device(struct device * dev)
27 if (dev->power.pm_parent
28 && dev->power.pm_parent->power.power_state.event) {
29 dev_err(dev, "PM: resume from %d, parent %s still %d\n",
30 dev->power.power_state.event,
31 dev->power.pm_parent->bus_id,
32 dev->power.pm_parent->power.power_state.event);
34 if (dev->bus && dev->bus->resume) {
35 dev_dbg(dev,"resuming\n");
36 error = dev->bus->resume(dev);
47 while(!list_empty(&dpm_off)) {
48 struct list_head * entry = dpm_off.next;
49 struct device * dev = to_device(entry);
53 list_add_tail(entry, &dpm_active);
56 if (!dev->power.prev_state.event)
66 * device_resume - Restore state of each device in system.
68 * Walk the dpm_off list, remove each entry, resume the device,
69 * then add it to the dpm_active list.
72 void device_resume(void)
79 EXPORT_SYMBOL_GPL(device_resume);
83 * device_power_up_irq - Power on some devices.
85 * Walk the dpm_off_irq list and power each device up. This
86 * is used for devices that required they be powered down with
87 * interrupts disabled. As devices are powered on, they are moved to
88 * the dpm_suspended list.
90 * Interrupts must be disabled when calling this.
93 void dpm_power_up(void)
95 while(!list_empty(&dpm_off_irq)) {
96 struct list_head * entry = dpm_off_irq.next;
97 struct device * dev = to_device(entry);
100 list_del_init(entry);
101 list_add_tail(entry, &dpm_active);
109 * device_pm_power_up - Turn on all devices that need special attention.
111 * Power on system devices then devices that required we shut them down
112 * with interrupts disabled.
113 * Called with interrupts disabled.
116 void device_power_up(void)
122 EXPORT_SYMBOL_GPL(device_power_up);