diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/Kconfig | 64 | ||||
-rw-r--r-- | drivers/acpi/processor_throttling.c | 59 | ||||
-rw-r--r-- | drivers/acpi/sleep/Makefile | 4 | ||||
-rw-r--r-- | drivers/acpi/sleep/main.c | 162 | ||||
-rw-r--r-- | drivers/acpi/sleep/poweroff.c | 2 | ||||
-rw-r--r-- | drivers/acpi/sleep/proc.c | 20 | ||||
-rw-r--r-- | drivers/acpi/sleep/wakeup.c | 2 | ||||
-rw-r--r-- | drivers/misc/asus-laptop.c | 32 | ||||
-rw-r--r-- | drivers/pci/pci-acpi.c | 28 | ||||
-rw-r--r-- | drivers/pci/pci.c | 8 | ||||
-rw-r--r-- | drivers/pci/pci.h | 2 | ||||
-rw-r--r-- | drivers/pnp/driver.c | 5 | ||||
-rw-r--r-- | drivers/pnp/pnpacpi/core.c | 14 |
13 files changed, 276 insertions, 126 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 408b45168aba..251344cb29ae 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -11,6 +11,9 @@ menuconfig ACPI | |||
11 | depends on PCI | 11 | depends on PCI |
12 | depends on PM | 12 | depends on PM |
13 | select PNP | 13 | select PNP |
14 | # for sleep | ||
15 | select HOTPLUG_CPU if X86 && SMP | ||
16 | select SUSPEND_SMP if X86 && SMP | ||
14 | default y | 17 | default y |
15 | ---help--- | 18 | ---help--- |
16 | Advanced Configuration and Power Interface (ACPI) support for | 19 | Advanced Configuration and Power Interface (ACPI) support for |
@@ -42,51 +45,26 @@ menuconfig ACPI | |||
42 | 45 | ||
43 | if ACPI | 46 | if ACPI |
44 | 47 | ||
45 | config ACPI_SLEEP | ||
46 | bool "Sleep States" | ||
47 | depends on X86 && (!SMP || SUSPEND_SMP) | ||
48 | default y | ||
49 | ---help--- | ||
50 | This option adds support for ACPI suspend states. | ||
51 | |||
52 | With this option, you will be able to put the system "to sleep". | ||
53 | Sleep states are low power states for the system and devices. All | ||
54 | of the system operating state is saved to either memory or disk | ||
55 | (depending on the state), to allow the system to resume operation | ||
56 | quickly at your request. | ||
57 | |||
58 | Although this option sounds really nifty, barely any of the device | ||
59 | drivers have been converted to the new driver model and hence few | ||
60 | have proper power management support. | ||
61 | |||
62 | This option is not recommended for anyone except those doing driver | ||
63 | power management development. | ||
64 | |||
65 | config ACPI_SLEEP_PROC_FS | ||
66 | bool | ||
67 | depends on ACPI_SLEEP && PROC_FS | ||
68 | default y | ||
69 | |||
70 | config ACPI_SLEEP_PROC_SLEEP | ||
71 | bool "/proc/acpi/sleep (deprecated)" | ||
72 | depends on ACPI_SLEEP_PROC_FS | ||
73 | default n | ||
74 | ---help--- | ||
75 | Create /proc/acpi/sleep | ||
76 | Deprecated by /sys/power/state | ||
77 | |||
78 | config ACPI_PROCFS | 48 | config ACPI_PROCFS |
79 | bool "Procfs interface (deprecated)" | 49 | bool "Deprecated /proc/acpi files" |
80 | default y | 50 | depends on PROC_FS |
81 | ---help--- | 51 | ---help--- |
82 | The Procfs interface for ACPI is made optional for backward compatibility. | 52 | For backwards compatibility, this option allows |
83 | As the same functions are duplicated in the sysfs interface | 53 | depricated /proc/acpi/ files to exist, even when |
84 | and this proc interface will be removed some time later, | 54 | they have been replaced by functions in /sys. |
85 | it's marked as deprecated. | 55 | The deprecated files (and their replacements) include: |
86 | ( /proc/acpi/debug_layer && debug_level are deprecated by | 56 | |
87 | /sys/module/acpi/parameters/debug_layer && debug_level. | 57 | /proc/acpi/sleep (/sys/power/state) |
88 | /proc/acpi/info is deprecated by | 58 | /proc/acpi/info (/sys/modules/acpi/parameters/acpica_version) |
89 | /sys/module/acpi/parameters/acpica_version ) | 59 | /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT) |
60 | /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) | ||
61 | /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) | ||
62 | /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level) | ||
63 | |||
64 | This option has no effect on /proc/acpi/ files | ||
65 | and functions which do not yet exist in /sys. | ||
66 | |||
67 | Say N to delete /proc/acpi/ files that have moved to /sys/ | ||
90 | 68 | ||
91 | config ACPI_AC | 69 | config ACPI_AC |
92 | tristate "AC Adapter" | 70 | tristate "AC Adapter" |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 3f55d1f90c11..0b8204e7082a 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -47,6 +47,9 @@ ACPI_MODULE_NAME("processor_throttling"); | |||
47 | static int acpi_processor_get_throttling(struct acpi_processor *pr); | 47 | static int acpi_processor_get_throttling(struct acpi_processor *pr); |
48 | int acpi_processor_set_throttling(struct acpi_processor *pr, int state); | 48 | int acpi_processor_set_throttling(struct acpi_processor *pr, int state); |
49 | 49 | ||
50 | /* | ||
51 | * _TPC - Throttling Present Capabilities | ||
52 | */ | ||
50 | static int acpi_processor_get_platform_limit(struct acpi_processor *pr) | 53 | static int acpi_processor_get_platform_limit(struct acpi_processor *pr) |
51 | { | 54 | { |
52 | acpi_status status = 0; | 55 | acpi_status status = 0; |
@@ -55,8 +58,10 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) | |||
55 | if (!pr) | 58 | if (!pr) |
56 | return -EINVAL; | 59 | return -EINVAL; |
57 | status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc); | 60 | status = acpi_evaluate_integer(pr->handle, "_TPC", NULL, &tpc); |
58 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | 61 | if (ACPI_FAILURE(status)) { |
59 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TPC")); | 62 | if (status != AE_NOT_FOUND) { |
63 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TPC")); | ||
64 | } | ||
60 | return -ENODEV; | 65 | return -ENODEV; |
61 | } | 66 | } |
62 | pr->throttling_platform_limit = (int)tpc; | 67 | pr->throttling_platform_limit = (int)tpc; |
@@ -68,9 +73,9 @@ int acpi_processor_tstate_has_changed(struct acpi_processor *pr) | |||
68 | return acpi_processor_get_platform_limit(pr); | 73 | return acpi_processor_get_platform_limit(pr); |
69 | } | 74 | } |
70 | 75 | ||
71 | /* -------------------------------------------------------------------------- | 76 | /* |
72 | _PTC, _TSS, _TSD support | 77 | * _PTC - Processor Throttling Control (and status) register location |
73 | -------------------------------------------------------------------------- */ | 78 | */ |
74 | static int acpi_processor_get_throttling_control(struct acpi_processor *pr) | 79 | static int acpi_processor_get_throttling_control(struct acpi_processor *pr) |
75 | { | 80 | { |
76 | int result = 0; | 81 | int result = 0; |
@@ -81,7 +86,9 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr) | |||
81 | 86 | ||
82 | status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); | 87 | status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); |
83 | if (ACPI_FAILURE(status)) { | 88 | if (ACPI_FAILURE(status)) { |
84 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PTC")); | 89 | if (status != AE_NOT_FOUND) { |
90 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _PTC")); | ||
91 | } | ||
85 | return -ENODEV; | 92 | return -ENODEV; |
86 | } | 93 | } |
87 | 94 | ||
@@ -132,6 +139,10 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr) | |||
132 | 139 | ||
133 | return result; | 140 | return result; |
134 | } | 141 | } |
142 | |||
143 | /* | ||
144 | * _TSS - Throttling Supported States | ||
145 | */ | ||
135 | static int acpi_processor_get_throttling_states(struct acpi_processor *pr) | 146 | static int acpi_processor_get_throttling_states(struct acpi_processor *pr) |
136 | { | 147 | { |
137 | int result = 0; | 148 | int result = 0; |
@@ -144,7 +155,9 @@ static int acpi_processor_get_throttling_states(struct acpi_processor *pr) | |||
144 | 155 | ||
145 | status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer); | 156 | status = acpi_evaluate_object(pr->handle, "_TSS", NULL, &buffer); |
146 | if (ACPI_FAILURE(status)) { | 157 | if (ACPI_FAILURE(status)) { |
147 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TSS")); | 158 | if (status != AE_NOT_FOUND) { |
159 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TSS")); | ||
160 | } | ||
148 | return -ENODEV; | 161 | return -ENODEV; |
149 | } | 162 | } |
150 | 163 | ||
@@ -201,6 +214,10 @@ static int acpi_processor_get_throttling_states(struct acpi_processor *pr) | |||
201 | 214 | ||
202 | return result; | 215 | return result; |
203 | } | 216 | } |
217 | |||
218 | /* | ||
219 | * _TSD - T-State Dependencies | ||
220 | */ | ||
204 | static int acpi_processor_get_tsd(struct acpi_processor *pr) | 221 | static int acpi_processor_get_tsd(struct acpi_processor *pr) |
205 | { | 222 | { |
206 | int result = 0; | 223 | int result = 0; |
@@ -213,6 +230,9 @@ static int acpi_processor_get_tsd(struct acpi_processor *pr) | |||
213 | 230 | ||
214 | status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer); | 231 | status = acpi_evaluate_object(pr->handle, "_TSD", NULL, &buffer); |
215 | if (ACPI_FAILURE(status)) { | 232 | if (ACPI_FAILURE(status)) { |
233 | if (status != AE_NOT_FOUND) { | ||
234 | ACPI_EXCEPTION((AE_INFO, status, "Evaluating _TSD")); | ||
235 | } | ||
216 | return -ENODEV; | 236 | return -ENODEV; |
217 | } | 237 | } |
218 | 238 | ||
@@ -525,9 +545,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
525 | int result = 0; | 545 | int result = 0; |
526 | int step = 0; | 546 | int step = 0; |
527 | int i = 0; | 547 | int i = 0; |
528 | int no_ptc = 0; | ||
529 | int no_tss = 0; | ||
530 | int no_tsd = 0; | ||
531 | 548 | ||
532 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 549 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
533 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", | 550 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", |
@@ -538,12 +555,14 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
538 | if (!pr) | 555 | if (!pr) |
539 | return -EINVAL; | 556 | return -EINVAL; |
540 | 557 | ||
541 | /* TBD: Support ACPI 2.0 objects */ | 558 | /* |
542 | no_ptc = acpi_processor_get_throttling_control(pr); | 559 | * Evaluate _PTC, _TSS and _TPC |
543 | no_tss = acpi_processor_get_throttling_states(pr); | 560 | * They must all be present or none of them can be used. |
544 | no_tsd = acpi_processor_get_tsd(pr); | 561 | */ |
545 | 562 | if (acpi_processor_get_throttling_control(pr) || | |
546 | if (no_ptc || no_tss) { | 563 | acpi_processor_get_throttling_states(pr) || |
564 | acpi_processor_get_platform_limit(pr)) | ||
565 | { | ||
547 | pr->throttling.acpi_processor_get_throttling = | 566 | pr->throttling.acpi_processor_get_throttling = |
548 | &acpi_processor_get_throttling_fadt; | 567 | &acpi_processor_get_throttling_fadt; |
549 | pr->throttling.acpi_processor_set_throttling = | 568 | pr->throttling.acpi_processor_set_throttling = |
@@ -555,6 +574,8 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
555 | &acpi_processor_set_throttling_ptc; | 574 | &acpi_processor_set_throttling_ptc; |
556 | } | 575 | } |
557 | 576 | ||
577 | acpi_processor_get_tsd(pr); | ||
578 | |||
558 | if (!pr->throttling.address) { | 579 | if (!pr->throttling.address) { |
559 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); | 580 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); |
560 | return 0; | 581 | return 0; |
@@ -658,18 +679,20 @@ static int acpi_processor_throttling_seq_show(struct seq_file *seq, | |||
658 | pr->throttling.state_count - 1); | 679 | pr->throttling.state_count - 1); |
659 | 680 | ||
660 | seq_puts(seq, "states:\n"); | 681 | seq_puts(seq, "states:\n"); |
661 | if (acpi_processor_get_throttling == acpi_processor_get_throttling_fadt) | 682 | if (pr->throttling.acpi_processor_get_throttling == |
683 | acpi_processor_get_throttling_fadt) { | ||
662 | for (i = 0; i < pr->throttling.state_count; i++) | 684 | for (i = 0; i < pr->throttling.state_count; i++) |
663 | seq_printf(seq, " %cT%d: %02d%%\n", | 685 | seq_printf(seq, " %cT%d: %02d%%\n", |
664 | (i == pr->throttling.state ? '*' : ' '), i, | 686 | (i == pr->throttling.state ? '*' : ' '), i, |
665 | (pr->throttling.states[i].performance ? pr-> | 687 | (pr->throttling.states[i].performance ? pr-> |
666 | throttling.states[i].performance / 10 : 0)); | 688 | throttling.states[i].performance / 10 : 0)); |
667 | else | 689 | } else { |
668 | for (i = 0; i < pr->throttling.state_count; i++) | 690 | for (i = 0; i < pr->throttling.state_count; i++) |
669 | seq_printf(seq, " %cT%d: %02d%%\n", | 691 | seq_printf(seq, " %cT%d: %02d%%\n", |
670 | (i == pr->throttling.state ? '*' : ' '), i, | 692 | (i == pr->throttling.state ? '*' : ' '), i, |
671 | (int)pr->throttling.states_tss[i]. | 693 | (int)pr->throttling.states_tss[i]. |
672 | freqpercentage); | 694 | freqpercentage); |
695 | } | ||
673 | 696 | ||
674 | end: | 697 | end: |
675 | return 0; | 698 | return 0; |
diff --git a/drivers/acpi/sleep/Makefile b/drivers/acpi/sleep/Makefile index d6c017709c85..01a993a1d086 100644 --- a/drivers/acpi/sleep/Makefile +++ b/drivers/acpi/sleep/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | obj-y := poweroff.o wakeup.o | 1 | obj-y := poweroff.o wakeup.o |
2 | obj-$(CONFIG_ACPI_SLEEP) += main.o | 2 | obj-y += main.o |
3 | obj-$(CONFIG_ACPI_SLEEP_PROC_FS) += proc.o | 3 | obj-$(CONFIG_X86) += proc.o |
4 | 4 | ||
5 | EXTRA_CFLAGS += $(ACPI_CFLAGS) | 5 | EXTRA_CFLAGS += $(ACPI_CFLAGS) |
diff --git a/drivers/acpi/sleep/main.c b/drivers/acpi/sleep/main.c index 3279e72a94f8..ab21357c5c7b 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -34,35 +34,55 @@ static u32 acpi_suspend_states[] = { | |||
34 | 34 | ||
35 | static int init_8259A_after_S1; | 35 | static int init_8259A_after_S1; |
36 | 36 | ||
37 | extern int acpi_sleep_prepare(u32 acpi_state); | ||
38 | extern void acpi_power_off(void); | ||
39 | |||
40 | static u32 acpi_target_sleep_state = ACPI_STATE_S0; | ||
41 | |||
42 | /** | ||
43 | * acpi_pm_set_target - Set the target system sleep state to the state | ||
44 | * associated with given @pm_state, if supported. | ||
45 | */ | ||
46 | |||
47 | static int acpi_pm_set_target(suspend_state_t pm_state) | ||
48 | { | ||
49 | u32 acpi_state = acpi_suspend_states[pm_state]; | ||
50 | int error = 0; | ||
51 | |||
52 | if (sleep_states[acpi_state]) { | ||
53 | acpi_target_sleep_state = acpi_state; | ||
54 | } else { | ||
55 | printk(KERN_ERR "ACPI does not support this state: %d\n", | ||
56 | pm_state); | ||
57 | error = -ENOSYS; | ||
58 | } | ||
59 | return error; | ||
60 | } | ||
61 | |||
37 | /** | 62 | /** |
38 | * acpi_pm_prepare - Do preliminary suspend work. | 63 | * acpi_pm_prepare - Do preliminary suspend work. |
39 | * @pm_state: suspend state we're entering. | 64 | * @pm_state: ignored |
40 | * | 65 | * |
41 | * Make sure we support the state. If we do, and we need it, set the | 66 | * If necessary, set the firmware waking vector and do arch-specific |
42 | * firmware waking vector and do arch-specific nastiness to get the | 67 | * nastiness to get the wakeup code to the waking vector. |
43 | * wakeup code to the waking vector. | ||
44 | */ | 68 | */ |
45 | 69 | ||
46 | extern int acpi_sleep_prepare(u32 acpi_state); | ||
47 | extern void acpi_power_off(void); | ||
48 | |||
49 | static int acpi_pm_prepare(suspend_state_t pm_state) | 70 | static int acpi_pm_prepare(suspend_state_t pm_state) |
50 | { | 71 | { |
51 | u32 acpi_state = acpi_suspend_states[pm_state]; | 72 | int error = acpi_sleep_prepare(acpi_target_sleep_state); |
52 | 73 | ||
53 | if (!sleep_states[acpi_state]) { | 74 | if (error) |
54 | printk("acpi_pm_prepare does not support %d \n", pm_state); | 75 | acpi_target_sleep_state = ACPI_STATE_S0; |
55 | return -EPERM; | 76 | |
56 | } | 77 | return error; |
57 | return acpi_sleep_prepare(acpi_state); | ||
58 | } | 78 | } |
59 | 79 | ||
60 | /** | 80 | /** |
61 | * acpi_pm_enter - Actually enter a sleep state. | 81 | * acpi_pm_enter - Actually enter a sleep state. |
62 | * @pm_state: State we're entering. | 82 | * @pm_state: ignored |
63 | * | 83 | * |
64 | * Flush caches and go to sleep. For STR or STD, we have to call | 84 | * Flush caches and go to sleep. For STR we have to call arch-specific |
65 | * arch-specific assembly, which in turn call acpi_enter_sleep_state(). | 85 | * assembly, which in turn call acpi_enter_sleep_state(). |
66 | * It's unfortunate, but it works. Please fix if you're feeling frisky. | 86 | * It's unfortunate, but it works. Please fix if you're feeling frisky. |
67 | */ | 87 | */ |
68 | 88 | ||
@@ -70,31 +90,31 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
70 | { | 90 | { |
71 | acpi_status status = AE_OK; | 91 | acpi_status status = AE_OK; |
72 | unsigned long flags = 0; | 92 | unsigned long flags = 0; |
73 | u32 acpi_state = acpi_suspend_states[pm_state]; | 93 | u32 acpi_state = acpi_target_sleep_state; |
74 | 94 | ||
75 | ACPI_FLUSH_CPU_CACHE(); | 95 | ACPI_FLUSH_CPU_CACHE(); |
76 | 96 | ||
77 | /* Do arch specific saving of state. */ | 97 | /* Do arch specific saving of state. */ |
78 | if (pm_state > PM_SUSPEND_STANDBY) { | 98 | if (acpi_state == ACPI_STATE_S3) { |
79 | int error = acpi_save_state_mem(); | 99 | int error = acpi_save_state_mem(); |
80 | if (error) | 100 | |
101 | if (error) { | ||
102 | acpi_target_sleep_state = ACPI_STATE_S0; | ||
81 | return error; | 103 | return error; |
104 | } | ||
82 | } | 105 | } |
83 | 106 | ||
84 | local_irq_save(flags); | 107 | local_irq_save(flags); |
85 | acpi_enable_wakeup_device(acpi_state); | 108 | acpi_enable_wakeup_device(acpi_state); |
86 | switch (pm_state) { | 109 | switch (acpi_state) { |
87 | case PM_SUSPEND_STANDBY: | 110 | case ACPI_STATE_S1: |
88 | barrier(); | 111 | barrier(); |
89 | status = acpi_enter_sleep_state(acpi_state); | 112 | status = acpi_enter_sleep_state(acpi_state); |
90 | break; | 113 | break; |
91 | 114 | ||
92 | case PM_SUSPEND_MEM: | 115 | case ACPI_STATE_S3: |
93 | do_suspend_lowlevel(); | 116 | do_suspend_lowlevel(); |
94 | break; | 117 | break; |
95 | |||
96 | default: | ||
97 | return -EINVAL; | ||
98 | } | 118 | } |
99 | 119 | ||
100 | /* ACPI 3.0 specs (P62) says that it's the responsabilty | 120 | /* ACPI 3.0 specs (P62) says that it's the responsabilty |
@@ -107,12 +127,8 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
107 | local_irq_restore(flags); | 127 | local_irq_restore(flags); |
108 | printk(KERN_DEBUG "Back to C!\n"); | 128 | printk(KERN_DEBUG "Back to C!\n"); |
109 | 129 | ||
110 | /* restore processor state | 130 | /* restore processor state */ |
111 | * We should only be here if we're coming back from STR or STD. | 131 | if (acpi_state == ACPI_STATE_S3) |
112 | * And, in the case of the latter, the memory image should have already | ||
113 | * been loaded from disk. | ||
114 | */ | ||
115 | if (pm_state > PM_SUSPEND_STANDBY) | ||
116 | acpi_restore_state_mem(); | 132 | acpi_restore_state_mem(); |
117 | 133 | ||
118 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | 134 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; |
@@ -120,7 +136,7 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
120 | 136 | ||
121 | /** | 137 | /** |
122 | * acpi_pm_finish - Finish up suspend sequence. | 138 | * acpi_pm_finish - Finish up suspend sequence. |
123 | * @pm_state: State we're coming out of. | 139 | * @pm_state: ignored |
124 | * | 140 | * |
125 | * This is called after we wake back up (or if entering the sleep state | 141 | * This is called after we wake back up (or if entering the sleep state |
126 | * failed). | 142 | * failed). |
@@ -128,7 +144,7 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
128 | 144 | ||
129 | static int acpi_pm_finish(suspend_state_t pm_state) | 145 | static int acpi_pm_finish(suspend_state_t pm_state) |
130 | { | 146 | { |
131 | u32 acpi_state = acpi_suspend_states[pm_state]; | 147 | u32 acpi_state = acpi_target_sleep_state; |
132 | 148 | ||
133 | acpi_leave_sleep_state(acpi_state); | 149 | acpi_leave_sleep_state(acpi_state); |
134 | acpi_disable_wakeup_device(acpi_state); | 150 | acpi_disable_wakeup_device(acpi_state); |
@@ -136,10 +152,14 @@ static int acpi_pm_finish(suspend_state_t pm_state) | |||
136 | /* reset firmware waking vector */ | 152 | /* reset firmware waking vector */ |
137 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); | 153 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); |
138 | 154 | ||
155 | acpi_target_sleep_state = ACPI_STATE_S0; | ||
156 | |||
157 | #ifdef CONFIG_X86 | ||
139 | if (init_8259A_after_S1) { | 158 | if (init_8259A_after_S1) { |
140 | printk("Broken toshiba laptop -> kicking interrupts\n"); | 159 | printk("Broken toshiba laptop -> kicking interrupts\n"); |
141 | init_8259A(0); | 160 | init_8259A(0); |
142 | } | 161 | } |
162 | #endif | ||
143 | return 0; | 163 | return 0; |
144 | } | 164 | } |
145 | 165 | ||
@@ -176,6 +196,7 @@ static int acpi_pm_state_valid(suspend_state_t pm_state) | |||
176 | 196 | ||
177 | static struct pm_ops acpi_pm_ops = { | 197 | static struct pm_ops acpi_pm_ops = { |
178 | .valid = acpi_pm_state_valid, | 198 | .valid = acpi_pm_state_valid, |
199 | .set_target = acpi_pm_set_target, | ||
179 | .prepare = acpi_pm_prepare, | 200 | .prepare = acpi_pm_prepare, |
180 | .enter = acpi_pm_enter, | 201 | .enter = acpi_pm_enter, |
181 | .finish = acpi_pm_finish, | 202 | .finish = acpi_pm_finish, |
@@ -235,6 +256,81 @@ static struct hibernation_ops acpi_hibernation_ops = { | |||
235 | }; | 256 | }; |
236 | #endif /* CONFIG_SOFTWARE_SUSPEND */ | 257 | #endif /* CONFIG_SOFTWARE_SUSPEND */ |
237 | 258 | ||
259 | /** | ||
260 | * acpi_pm_device_sleep_state - return preferred power state of ACPI device | ||
261 | * in the system sleep state given by %acpi_target_sleep_state | ||
262 | * @dev: device to examine | ||
263 | * @wake: if set, the device should be able to wake up the system | ||
264 | * @d_min_p: used to store the upper limit of allowed states range | ||
265 | * Return value: preferred power state of the device on success, -ENODEV on | ||
266 | * failure (ie. if there's no 'struct acpi_device' for @dev) | ||
267 | * | ||
268 | * Find the lowest power (highest number) ACPI device power state that | ||
269 | * device @dev can be in while the system is in the sleep state represented | ||
270 | * by %acpi_target_sleep_state. If @wake is nonzero, the device should be | ||
271 | * able to wake up the system from this sleep state. If @d_min_p is set, | ||
272 | * the highest power (lowest number) device power state of @dev allowed | ||
273 | * in this system sleep state is stored at the location pointed to by it. | ||
274 | * | ||
275 | * The caller must ensure that @dev is valid before using this function. | ||
276 | * The caller is also responsible for figuring out if the device is | ||
277 | * supposed to be able to wake up the system and passing this information | ||
278 | * via @wake. | ||
279 | */ | ||
280 | |||
281 | int acpi_pm_device_sleep_state(struct device *dev, int wake, int *d_min_p) | ||
282 | { | ||
283 | acpi_handle handle = DEVICE_ACPI_HANDLE(dev); | ||
284 | struct acpi_device *adev; | ||
285 | char acpi_method[] = "_SxD"; | ||
286 | unsigned long d_min, d_max; | ||
287 | |||
288 | if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) { | ||
289 | printk(KERN_ERR "ACPI handle has no context!\n"); | ||
290 | return -ENODEV; | ||
291 | } | ||
292 | |||
293 | acpi_method[2] = '0' + acpi_target_sleep_state; | ||
294 | /* | ||
295 | * If the sleep state is S0, we will return D3, but if the device has | ||
296 | * _S0W, we will use the value from _S0W | ||
297 | */ | ||
298 | d_min = ACPI_STATE_D0; | ||
299 | d_max = ACPI_STATE_D3; | ||
300 | |||
301 | /* | ||
302 | * If present, _SxD methods return the minimum D-state (highest power | ||
303 | * state) we can use for the corresponding S-states. Otherwise, the | ||
304 | * minimum D-state is D0 (ACPI 3.x). | ||
305 | * | ||
306 | * NOTE: We rely on acpi_evaluate_integer() not clobbering the integer | ||
307 | * provided -- that's our fault recovery, we ignore retval. | ||
308 | */ | ||
309 | if (acpi_target_sleep_state > ACPI_STATE_S0) | ||
310 | acpi_evaluate_integer(handle, acpi_method, NULL, &d_min); | ||
311 | |||
312 | /* | ||
313 | * If _PRW says we can wake up the system from the target sleep state, | ||
314 | * the D-state returned by _SxD is sufficient for that (we assume a | ||
315 | * wakeup-aware driver if wake is set). Still, if _SxW exists | ||
316 | * (ACPI 3.x), it should return the maximum (lowest power) D-state that | ||
317 | * can wake the system. _S0W may be valid, too. | ||
318 | */ | ||
319 | if (acpi_target_sleep_state == ACPI_STATE_S0 || | ||
320 | (wake && adev->wakeup.state.enabled && | ||
321 | adev->wakeup.sleep_state <= acpi_target_sleep_state)) { | ||
322 | acpi_method[3] = 'W'; | ||
323 | acpi_evaluate_integer(handle, acpi_method, NULL, &d_max); | ||
324 | /* Sanity check */ | ||
325 | if (d_max < d_min) | ||
326 | d_min = d_max; | ||
327 | } | ||
328 | |||
329 | if (d_min_p) | ||
330 | *d_min_p = d_min; | ||
331 | return d_max; | ||
332 | } | ||
333 | |||
238 | /* | 334 | /* |
239 | * Toshiba fails to preserve interrupts over S1, reinitialization | 335 | * Toshiba fails to preserve interrupts over S1, reinitialization |
240 | * of 8259 is needed after S1 resume. | 336 | * of 8259 is needed after S1 resume. |
diff --git a/drivers/acpi/sleep/poweroff.c b/drivers/acpi/sleep/poweroff.c index 39e40d56b034..b3f68ef0669e 100644 --- a/drivers/acpi/sleep/poweroff.c +++ b/drivers/acpi/sleep/poweroff.c | |||
@@ -18,7 +18,6 @@ | |||
18 | 18 | ||
19 | int acpi_sleep_prepare(u32 acpi_state) | 19 | int acpi_sleep_prepare(u32 acpi_state) |
20 | { | 20 | { |
21 | #ifdef CONFIG_ACPI_SLEEP | ||
22 | /* do we have a wakeup address for S2 and S3? */ | 21 | /* do we have a wakeup address for S2 and S3? */ |
23 | if (acpi_state == ACPI_STATE_S3) { | 22 | if (acpi_state == ACPI_STATE_S3) { |
24 | if (!acpi_wakeup_address) { | 23 | if (!acpi_wakeup_address) { |
@@ -31,7 +30,6 @@ int acpi_sleep_prepare(u32 acpi_state) | |||
31 | } | 30 | } |
32 | ACPI_FLUSH_CPU_CACHE(); | 31 | ACPI_FLUSH_CPU_CACHE(); |
33 | acpi_enable_wakeup_device_prep(acpi_state); | 32 | acpi_enable_wakeup_device_prep(acpi_state); |
34 | #endif | ||
35 | acpi_gpe_sleep_prepare(acpi_state); | 33 | acpi_gpe_sleep_prepare(acpi_state); |
36 | acpi_enter_sleep_state_prep(acpi_state); | 34 | acpi_enter_sleep_state_prep(acpi_state); |
37 | return 0; | 35 | return 0; |
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c index 61f1822cc350..ed58e1168aed 100644 --- a/drivers/acpi/sleep/proc.c +++ b/drivers/acpi/sleep/proc.c | |||
@@ -14,8 +14,16 @@ | |||
14 | #include "sleep.h" | 14 | #include "sleep.h" |
15 | 15 | ||
16 | #define _COMPONENT ACPI_SYSTEM_COMPONENT | 16 | #define _COMPONENT ACPI_SYSTEM_COMPONENT |
17 | |||
18 | /* | ||
19 | * this file provides support for: | ||
20 | * /proc/acpi/sleep | ||
21 | * /proc/acpi/alarm | ||
22 | * /proc/acpi/wakeup | ||
23 | */ | ||
24 | |||
17 | ACPI_MODULE_NAME("sleep") | 25 | ACPI_MODULE_NAME("sleep") |
18 | #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP | 26 | #ifdef CONFIG_ACPI_PROCFS |
19 | static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset) | 27 | static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset) |
20 | { | 28 | { |
21 | int i; | 29 | int i; |
@@ -68,7 +76,7 @@ acpi_system_write_sleep(struct file *file, | |||
68 | Done: | 76 | Done: |
69 | return error ? error : count; | 77 | return error ? error : count; |
70 | } | 78 | } |
71 | #endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ | 79 | #endif /* CONFIG_ACPI_PROCFS */ |
72 | 80 | ||
73 | #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) | 81 | #if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) |
74 | /* use /sys/class/rtc/rtcX/wakealarm instead; it's not ACPI-specific */ | 82 | /* use /sys/class/rtc/rtcX/wakealarm instead; it's not ACPI-specific */ |
@@ -463,7 +471,7 @@ static const struct file_operations acpi_system_wakeup_device_fops = { | |||
463 | .release = single_release, | 471 | .release = single_release, |
464 | }; | 472 | }; |
465 | 473 | ||
466 | #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP | 474 | #ifdef CONFIG_ACPI_PROCFS |
467 | static const struct file_operations acpi_system_sleep_fops = { | 475 | static const struct file_operations acpi_system_sleep_fops = { |
468 | .open = acpi_system_sleep_open_fs, | 476 | .open = acpi_system_sleep_open_fs, |
469 | .read = seq_read, | 477 | .read = seq_read, |
@@ -471,7 +479,7 @@ static const struct file_operations acpi_system_sleep_fops = { | |||
471 | .llseek = seq_lseek, | 479 | .llseek = seq_lseek, |
472 | .release = single_release, | 480 | .release = single_release, |
473 | }; | 481 | }; |
474 | #endif /* CONFIG_ACPI_SLEEP_PROC_SLEEP */ | 482 | #endif /* CONFIG_ACPI_PROCFS */ |
475 | 483 | ||
476 | #ifdef HAVE_ACPI_LEGACY_ALARM | 484 | #ifdef HAVE_ACPI_LEGACY_ALARM |
477 | static const struct file_operations acpi_system_alarm_fops = { | 485 | static const struct file_operations acpi_system_alarm_fops = { |
@@ -498,14 +506,14 @@ static int __init acpi_sleep_proc_init(void) | |||
498 | if (acpi_disabled) | 506 | if (acpi_disabled) |
499 | return 0; | 507 | return 0; |
500 | 508 | ||
501 | #ifdef CONFIG_ACPI_SLEEP_PROC_SLEEP | 509 | #ifdef CONFIG_ACPI_PROCFS |
502 | /* 'sleep' [R/W] */ | 510 | /* 'sleep' [R/W] */ |
503 | entry = | 511 | entry = |
504 | create_proc_entry("sleep", S_IFREG | S_IRUGO | S_IWUSR, | 512 | create_proc_entry("sleep", S_IFREG | S_IRUGO | S_IWUSR, |
505 | acpi_root_dir); | 513 | acpi_root_dir); |
506 | if (entry) | 514 | if (entry) |
507 | entry->proc_fops = &acpi_system_sleep_fops; | 515 | entry->proc_fops = &acpi_system_sleep_fops; |
508 | #endif | 516 | #endif /* CONFIG_ACPI_PROCFS */ |
509 | 517 | ||
510 | #ifdef HAVE_ACPI_LEGACY_ALARM | 518 | #ifdef HAVE_ACPI_LEGACY_ALARM |
511 | /* 'alarm' [R/W] */ | 519 | /* 'alarm' [R/W] */ |
diff --git a/drivers/acpi/sleep/wakeup.c b/drivers/acpi/sleep/wakeup.c index fab8f2694f03..97c27ddb144d 100644 --- a/drivers/acpi/sleep/wakeup.c +++ b/drivers/acpi/sleep/wakeup.c | |||
@@ -17,7 +17,6 @@ ACPI_MODULE_NAME("wakeup_devices") | |||
17 | extern struct list_head acpi_wakeup_device_list; | 17 | extern struct list_head acpi_wakeup_device_list; |
18 | extern spinlock_t acpi_device_lock; | 18 | extern spinlock_t acpi_device_lock; |
19 | 19 | ||
20 | #ifdef CONFIG_ACPI_SLEEP | ||
21 | /** | 20 | /** |
22 | * acpi_enable_wakeup_device_prep - prepare wakeup devices | 21 | * acpi_enable_wakeup_device_prep - prepare wakeup devices |
23 | * @sleep_state: ACPI state | 22 | * @sleep_state: ACPI state |
@@ -180,7 +179,6 @@ static int __init acpi_wakeup_device_init(void) | |||
180 | } | 179 | } |
181 | 180 | ||
182 | late_initcall(acpi_wakeup_device_init); | 181 | late_initcall(acpi_wakeup_device_init); |
183 | #endif | ||
184 | 182 | ||
185 | /* | 183 | /* |
186 | * Disable all wakeup GPEs before entering requested sleep state. | 184 | * Disable all wakeup GPEs before entering requested sleep state. |
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c index 63953fe03320..d0fc4fd212e6 100644 --- a/drivers/misc/asus-laptop.c +++ b/drivers/misc/asus-laptop.c | |||
@@ -1072,19 +1072,16 @@ static void asus_backlight_exit(void) | |||
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | #define ASUS_LED_UNREGISTER(object) \ | 1074 | #define ASUS_LED_UNREGISTER(object) \ |
1075 | if(object##_led.class_dev \ | 1075 | led_classdev_unregister(&object##_led) |
1076 | && !IS_ERR(object##_led.class_dev)) \ | ||
1077 | led_classdev_unregister(&object##_led) | ||
1078 | 1076 | ||
1079 | static void asus_led_exit(void) | 1077 | static void asus_led_exit(void) |
1080 | { | 1078 | { |
1079 | destroy_workqueue(led_workqueue); | ||
1081 | ASUS_LED_UNREGISTER(mled); | 1080 | ASUS_LED_UNREGISTER(mled); |
1082 | ASUS_LED_UNREGISTER(tled); | 1081 | ASUS_LED_UNREGISTER(tled); |
1083 | ASUS_LED_UNREGISTER(pled); | 1082 | ASUS_LED_UNREGISTER(pled); |
1084 | ASUS_LED_UNREGISTER(rled); | 1083 | ASUS_LED_UNREGISTER(rled); |
1085 | ASUS_LED_UNREGISTER(gled); | 1084 | ASUS_LED_UNREGISTER(gled); |
1086 | |||
1087 | destroy_workqueue(led_workqueue); | ||
1088 | } | 1085 | } |
1089 | 1086 | ||
1090 | static void __exit asus_laptop_exit(void) | 1087 | static void __exit asus_laptop_exit(void) |
@@ -1140,29 +1137,42 @@ static int asus_led_init(struct device *dev) | |||
1140 | 1137 | ||
1141 | rv = ASUS_LED_REGISTER(mled, dev); | 1138 | rv = ASUS_LED_REGISTER(mled, dev); |
1142 | if (rv) | 1139 | if (rv) |
1143 | return rv; | 1140 | goto out; |
1144 | 1141 | ||
1145 | rv = ASUS_LED_REGISTER(tled, dev); | 1142 | rv = ASUS_LED_REGISTER(tled, dev); |
1146 | if (rv) | 1143 | if (rv) |
1147 | return rv; | 1144 | goto out1; |
1148 | 1145 | ||
1149 | rv = ASUS_LED_REGISTER(rled, dev); | 1146 | rv = ASUS_LED_REGISTER(rled, dev); |
1150 | if (rv) | 1147 | if (rv) |
1151 | return rv; | 1148 | goto out2; |
1152 | 1149 | ||
1153 | rv = ASUS_LED_REGISTER(pled, dev); | 1150 | rv = ASUS_LED_REGISTER(pled, dev); |
1154 | if (rv) | 1151 | if (rv) |
1155 | return rv; | 1152 | goto out3; |
1156 | 1153 | ||
1157 | rv = ASUS_LED_REGISTER(gled, dev); | 1154 | rv = ASUS_LED_REGISTER(gled, dev); |
1158 | if (rv) | 1155 | if (rv) |
1159 | return rv; | 1156 | goto out4; |
1160 | 1157 | ||
1161 | led_workqueue = create_singlethread_workqueue("led_workqueue"); | 1158 | led_workqueue = create_singlethread_workqueue("led_workqueue"); |
1162 | if (!led_workqueue) | 1159 | if (!led_workqueue) |
1163 | return -ENOMEM; | 1160 | goto out5; |
1164 | 1161 | ||
1165 | return 0; | 1162 | return 0; |
1163 | out5: | ||
1164 | rv = -ENOMEM; | ||
1165 | ASUS_LED_UNREGISTER(gled); | ||
1166 | out4: | ||
1167 | ASUS_LED_UNREGISTER(pled); | ||
1168 | out3: | ||
1169 | ASUS_LED_UNREGISTER(rled); | ||
1170 | out2: | ||
1171 | ASUS_LED_UNREGISTER(tled); | ||
1172 | out1: | ||
1173 | ASUS_LED_UNREGISTER(mled); | ||
1174 | out: | ||
1175 | return rv; | ||
1166 | } | 1176 | } |
1167 | 1177 | ||
1168 | static int __init asus_laptop_init(void) | 1178 | static int __init asus_laptop_init(void) |
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index c8062494009f..67c63d1f1582 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -245,16 +245,33 @@ EXPORT_SYMBOL(pci_osc_control_set); | |||
245 | * currently we simply return _SxD, if present. | 245 | * currently we simply return _SxD, if present. |
246 | */ | 246 | */ |
247 | 247 | ||
248 | static int acpi_pci_choose_state(struct pci_dev *pdev, pm_message_t state) | 248 | static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev, |
249 | pm_message_t state) | ||
249 | { | 250 | { |
250 | /* TBD */ | 251 | int acpi_state; |
251 | 252 | ||
252 | return -ENODEV; | 253 | acpi_state = acpi_pm_device_sleep_state(&pdev->dev, |
254 | device_may_wakeup(&pdev->dev), NULL); | ||
255 | if (acpi_state < 0) | ||
256 | return PCI_POWER_ERROR; | ||
257 | |||
258 | switch (acpi_state) { | ||
259 | case ACPI_STATE_D0: | ||
260 | return PCI_D0; | ||
261 | case ACPI_STATE_D1: | ||
262 | return PCI_D1; | ||
263 | case ACPI_STATE_D2: | ||
264 | return PCI_D2; | ||
265 | case ACPI_STATE_D3: | ||
266 | return PCI_D3hot; | ||
267 | } | ||
268 | return PCI_POWER_ERROR; | ||
253 | } | 269 | } |
254 | 270 | ||
255 | static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | 271 | static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) |
256 | { | 272 | { |
257 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); | 273 | acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev); |
274 | acpi_handle tmp; | ||
258 | static int state_conv[] = { | 275 | static int state_conv[] = { |
259 | [0] = 0, | 276 | [0] = 0, |
260 | [1] = 1, | 277 | [1] = 1, |
@@ -266,6 +283,9 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
266 | 283 | ||
267 | if (!handle) | 284 | if (!handle) |
268 | return -ENODEV; | 285 | return -ENODEV; |
286 | /* If the ACPI device has _EJ0, ignore the device */ | ||
287 | if (ACPI_SUCCESS(acpi_get_handle(handle, "_EJ0", &tmp))) | ||
288 | return 0; | ||
269 | return acpi_bus_set_power(handle, acpi_state); | 289 | return acpi_bus_set_power(handle, acpi_state); |
270 | } | 290 | } |
271 | 291 | ||
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 03fd59e80fef..1458fd69e670 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -499,7 +499,7 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) | |||
499 | return 0; | 499 | return 0; |
500 | } | 500 | } |
501 | 501 | ||
502 | int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); | 502 | pci_power_t (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); |
503 | 503 | ||
504 | /** | 504 | /** |
505 | * pci_choose_state - Choose the power state of a PCI device | 505 | * pci_choose_state - Choose the power state of a PCI device |
@@ -513,15 +513,15 @@ int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); | |||
513 | 513 | ||
514 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) | 514 | pci_power_t pci_choose_state(struct pci_dev *dev, pm_message_t state) |
515 | { | 515 | { |
516 | int ret; | 516 | pci_power_t ret; |
517 | 517 | ||
518 | if (!pci_find_capability(dev, PCI_CAP_ID_PM)) | 518 | if (!pci_find_capability(dev, PCI_CAP_ID_PM)) |
519 | return PCI_D0; | 519 | return PCI_D0; |
520 | 520 | ||
521 | if (platform_pci_choose_state) { | 521 | if (platform_pci_choose_state) { |
522 | ret = platform_pci_choose_state(dev, state); | 522 | ret = platform_pci_choose_state(dev, state); |
523 | if (ret >= 0) | 523 | if (ret != PCI_POWER_ERROR) |
524 | state.event = ret; | 524 | return ret; |
525 | } | 525 | } |
526 | 526 | ||
527 | switch (state.event) { | 527 | switch (state.event) { |
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 3fec13d3add7..c293ba1f274a 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -13,7 +13,7 @@ extern int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | |||
13 | resource_size_t, resource_size_t), | 13 | resource_size_t, resource_size_t), |
14 | void *alignf_data); | 14 | void *alignf_data); |
15 | /* Firmware callbacks */ | 15 | /* Firmware callbacks */ |
16 | extern int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); | 16 | extern pci_power_t (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); |
17 | extern int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t state); | 17 | extern int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t state); |
18 | 18 | ||
19 | extern int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); | 19 | extern int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); |
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index e161423b4300..1432806451cd 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c | |||
@@ -167,6 +167,8 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state) | |||
167 | return error; | 167 | return error; |
168 | } | 168 | } |
169 | 169 | ||
170 | if (pnp_dev->protocol && pnp_dev->protocol->suspend) | ||
171 | pnp_dev->protocol->suspend(pnp_dev, state); | ||
170 | return 0; | 172 | return 0; |
171 | } | 173 | } |
172 | 174 | ||
@@ -179,6 +181,9 @@ static int pnp_bus_resume(struct device *dev) | |||
179 | if (!pnp_drv) | 181 | if (!pnp_drv) |
180 | return 0; | 182 | return 0; |
181 | 183 | ||
184 | if (pnp_dev->protocol && pnp_dev->protocol->resume) | ||
185 | pnp_dev->protocol->resume(pnp_dev); | ||
186 | |||
182 | if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)) { | 187 | if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE)) { |
183 | error = pnp_start_dev(pnp_dev); | 188 | error = pnp_start_dev(pnp_dev); |
184 | if (error) | 189 | if (error) |
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index 0bc889144e6f..fcd32ac575c3 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -124,11 +124,25 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev) | |||
124 | return ACPI_FAILURE(status) ? -ENODEV : 0; | 124 | return ACPI_FAILURE(status) ? -ENODEV : 0; |
125 | } | 125 | } |
126 | 126 | ||
127 | static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) | ||
128 | { | ||
129 | return acpi_bus_set_power((acpi_handle)dev->data, | ||
130 | acpi_pm_device_sleep_state(&dev->dev, | ||
131 | device_may_wakeup(&dev->dev), NULL)); | ||
132 | } | ||
133 | |||
134 | static int pnpacpi_resume(struct pnp_dev *dev) | ||
135 | { | ||
136 | return acpi_bus_set_power((acpi_handle)dev->data, ACPI_STATE_D0); | ||
137 | } | ||
138 | |||
127 | static struct pnp_protocol pnpacpi_protocol = { | 139 | static struct pnp_protocol pnpacpi_protocol = { |
128 | .name = "Plug and Play ACPI", | 140 | .name = "Plug and Play ACPI", |
129 | .get = pnpacpi_get_resources, | 141 | .get = pnpacpi_get_resources, |
130 | .set = pnpacpi_set_resources, | 142 | .set = pnpacpi_set_resources, |
131 | .disable = pnpacpi_disable_resources, | 143 | .disable = pnpacpi_disable_resources, |
144 | .suspend = pnpacpi_suspend, | ||
145 | .resume = pnpacpi_resume, | ||
132 | }; | 146 | }; |
133 | 147 | ||
134 | static int __init pnpacpi_add_device(struct acpi_device *device) | 148 | static int __init pnpacpi_add_device(struct acpi_device *device) |