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>
12 #include <linux/resume-trace.h>
18 * resume_device - Restore state for one device.
23 int resume_device(struct device * dev)
30 if (dev->power.pm_parent
31 && dev->power.pm_parent->power.power_state.event) {
32 dev_err(dev, "PM: resume from %d, parent %s still %d\n",
33 dev->power.power_state.event,
34 dev->power.pm_parent->bus_id,
35 dev->power.pm_parent->power.power_state.event);
37 if (dev->bus && dev->bus->resume) {
38 dev_dbg(dev,"resuming\n");
39 error = dev->bus->resume(dev);
51 while(!list_empty(&dpm_off)) {
52 struct list_head * entry = dpm_off.next;
53 struct device * dev = to_device(entry);
56 list_move_tail(entry, &dpm_active);
59 if (!dev->power.prev_state.event)
69 * device_resume - Restore state of each device in system.
71 * Walk the dpm_off list, remove each entry, resume the device,
72 * then add it to the dpm_active list.
75 void device_resume(void)
82 EXPORT_SYMBOL_GPL(device_resume);
86 * device_power_up_irq - Power on some devices.
88 * Walk the dpm_off_irq list and power each device up. This
89 * is used for devices that required they be powered down with
90 * interrupts disabled. As devices are powered on, they are moved to
91 * the dpm_suspended list.
93 * Interrupts must be disabled when calling this.
96 void dpm_power_up(void)
98 while(!list_empty(&dpm_off_irq)) {
99 struct list_head * entry = dpm_off_irq.next;
100 struct device * dev = to_device(entry);
103 list_move_tail(entry, &dpm_active);
111 * device_pm_power_up - Turn on all devices that need special attention.
113 * Power on system devices then devices that required we shut them down
114 * with interrupts disabled.
115 * Called with interrupts disabled.
118 void device_power_up(void)
124 EXPORT_SYMBOL_GPL(device_power_up);