diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-25 14:28:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-25 14:28:00 -0400 |
commit | a4fb2122f1fc4a22bd6a5b8a195b952c2d31c54d (patch) | |
tree | db24e2160fe8eb8d787ad67bd3e08d3284806330 /drivers | |
parent | bc72450aebe73587f80bbae8fc0b62c3d81b85fe (diff) | |
parent | 323ef30af3a0da47cc761b04b262d98d0fe79126 (diff) |
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6:
ACPI: Kconfig: remove CONFIG_ACPI_SLEEP from source
ACPI: quiet ACPI Exceptions due to no _PTC or _TSS
ACPI: Remove references to ACPI_STATE_S2 from acpi_pm_enter
ACPI: Kconfig: always enable CONFIG_ACPI_SLEEP on X86
ACPI: Kconfig: fold /proc/acpi/sleep under CONFIG_ACPI_PROCFS
ACPI: Kconfig: CONFIG_ACPI_PROCFS now defaults to N
ACPI: autoload modules - Create __mod_acpi_device_table symbol for all ACPI drivers
ACPI: autoload modules - Create ACPI alias interface
ACPI: autoload modules - ACPICA modifications
ACPI: asus-laptop: Fix failure exits
ACPI: fix oops due to typo in new throttling code
ACPI: ignore _PSx method for hotplugable PCI devices
ACPI: Use ACPI methods to select PCI device suspend state
ACPI, PNP: hook ACPI D-state to PNP suspend/resume
ACPI: Add acpi_pm_device_sleep_state helper routine
ACPI: Implement the set_target() callback from pm_ops
Diffstat (limited to 'drivers')
37 files changed, 551 insertions, 206 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/ac.c b/drivers/acpi/ac.c index 37c7dc4f9fe5..d8b35093527a 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -34,7 +34,6 @@ | |||
34 | 34 | ||
35 | #define ACPI_AC_COMPONENT 0x00020000 | 35 | #define ACPI_AC_COMPONENT 0x00020000 |
36 | #define ACPI_AC_CLASS "ac_adapter" | 36 | #define ACPI_AC_CLASS "ac_adapter" |
37 | #define ACPI_AC_HID "ACPI0003" | ||
38 | #define ACPI_AC_DEVICE_NAME "AC Adapter" | 37 | #define ACPI_AC_DEVICE_NAME "AC Adapter" |
39 | #define ACPI_AC_FILE_STATE "state" | 38 | #define ACPI_AC_FILE_STATE "state" |
40 | #define ACPI_AC_NOTIFY_STATUS 0x80 | 39 | #define ACPI_AC_NOTIFY_STATUS 0x80 |
@@ -56,10 +55,16 @@ static int acpi_ac_add(struct acpi_device *device); | |||
56 | static int acpi_ac_remove(struct acpi_device *device, int type); | 55 | static int acpi_ac_remove(struct acpi_device *device, int type); |
57 | static int acpi_ac_open_fs(struct inode *inode, struct file *file); | 56 | static int acpi_ac_open_fs(struct inode *inode, struct file *file); |
58 | 57 | ||
58 | const static struct acpi_device_id ac_device_ids[] = { | ||
59 | {"ACPI0003", 0}, | ||
60 | {"", 0}, | ||
61 | }; | ||
62 | MODULE_DEVICE_TABLE(acpi, ac_device_ids); | ||
63 | |||
59 | static struct acpi_driver acpi_ac_driver = { | 64 | static struct acpi_driver acpi_ac_driver = { |
60 | .name = "ac", | 65 | .name = "ac", |
61 | .class = ACPI_AC_CLASS, | 66 | .class = ACPI_AC_CLASS, |
62 | .ids = ACPI_AC_HID, | 67 | .ids = ac_device_ids, |
63 | .ops = { | 68 | .ops = { |
64 | .add = acpi_ac_add, | 69 | .add = acpi_ac_add, |
65 | .remove = acpi_ac_remove, | 70 | .remove = acpi_ac_remove, |
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index e65628a03085..5f1127ad5a95 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c | |||
@@ -53,10 +53,16 @@ static int acpi_memory_device_add(struct acpi_device *device); | |||
53 | static int acpi_memory_device_remove(struct acpi_device *device, int type); | 53 | static int acpi_memory_device_remove(struct acpi_device *device, int type); |
54 | static int acpi_memory_device_start(struct acpi_device *device); | 54 | static int acpi_memory_device_start(struct acpi_device *device); |
55 | 55 | ||
56 | static const struct acpi_device_id memory_device_ids[] = { | ||
57 | {ACPI_MEMORY_DEVICE_HID, 0}, | ||
58 | {"", 0}, | ||
59 | }; | ||
60 | MODULE_DEVICE_TABLE(acpi, memory_device_ids); | ||
61 | |||
56 | static struct acpi_driver acpi_memory_device_driver = { | 62 | static struct acpi_driver acpi_memory_device_driver = { |
57 | .name = "acpi_memhotplug", | 63 | .name = "acpi_memhotplug", |
58 | .class = ACPI_MEMORY_DEVICE_CLASS, | 64 | .class = ACPI_MEMORY_DEVICE_CLASS, |
59 | .ids = ACPI_MEMORY_DEVICE_HID, | 65 | .ids = memory_device_ids, |
60 | .ops = { | 66 | .ops = { |
61 | .add = acpi_memory_device_add, | 67 | .add = acpi_memory_device_add, |
62 | .remove = acpi_memory_device_remove, | 68 | .remove = acpi_memory_device_remove, |
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index 3cd79caad70c..9c4bd220c44f 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -56,7 +56,6 @@ | |||
56 | #define ACPI_HOTK_NAME "Asus Laptop ACPI Extras Driver" | 56 | #define ACPI_HOTK_NAME "Asus Laptop ACPI Extras Driver" |
57 | #define ACPI_HOTK_CLASS "hotkey" | 57 | #define ACPI_HOTK_CLASS "hotkey" |
58 | #define ACPI_HOTK_DEVICE_NAME "Hotkey" | 58 | #define ACPI_HOTK_DEVICE_NAME "Hotkey" |
59 | #define ACPI_HOTK_HID "ATK0100" | ||
60 | 59 | ||
61 | /* | 60 | /* |
62 | * Some events we use, same for all Asus | 61 | * Some events we use, same for all Asus |
@@ -426,14 +425,20 @@ static struct acpi_table_header *asus_info; | |||
426 | static struct asus_hotk *hotk; | 425 | static struct asus_hotk *hotk; |
427 | 426 | ||
428 | /* | 427 | /* |
429 | * The hotkey driver declaration | 428 | * The hotkey driver and autoloading declaration |
430 | */ | 429 | */ |
431 | static int asus_hotk_add(struct acpi_device *device); | 430 | static int asus_hotk_add(struct acpi_device *device); |
432 | static int asus_hotk_remove(struct acpi_device *device, int type); | 431 | static int asus_hotk_remove(struct acpi_device *device, int type); |
432 | static const struct acpi_device_id asus_device_ids[] = { | ||
433 | {"ATK0100", 0}, | ||
434 | {"", 0}, | ||
435 | }; | ||
436 | MODULE_DEVICE_TABLE(acpi, asus_device_ids); | ||
437 | |||
433 | static struct acpi_driver asus_hotk_driver = { | 438 | static struct acpi_driver asus_hotk_driver = { |
434 | .name = "asus_acpi", | 439 | .name = "asus_acpi", |
435 | .class = ACPI_HOTK_CLASS, | 440 | .class = ACPI_HOTK_CLASS, |
436 | .ids = ACPI_HOTK_HID, | 441 | .ids = asus_device_ids, |
437 | .ops = { | 442 | .ops = { |
438 | .add = asus_hotk_add, | 443 | .add = asus_hotk_add, |
439 | .remove = asus_hotk_remove, | 444 | .remove = asus_hotk_remove, |
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index cad932de383d..81651032791b 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -41,7 +41,6 @@ | |||
41 | 41 | ||
42 | #define ACPI_BATTERY_COMPONENT 0x00040000 | 42 | #define ACPI_BATTERY_COMPONENT 0x00040000 |
43 | #define ACPI_BATTERY_CLASS "battery" | 43 | #define ACPI_BATTERY_CLASS "battery" |
44 | #define ACPI_BATTERY_HID "PNP0C0A" | ||
45 | #define ACPI_BATTERY_DEVICE_NAME "Battery" | 44 | #define ACPI_BATTERY_DEVICE_NAME "Battery" |
46 | #define ACPI_BATTERY_NOTIFY_STATUS 0x80 | 45 | #define ACPI_BATTERY_NOTIFY_STATUS 0x80 |
47 | #define ACPI_BATTERY_NOTIFY_INFO 0x81 | 46 | #define ACPI_BATTERY_NOTIFY_INFO 0x81 |
@@ -74,10 +73,16 @@ static int acpi_battery_add(struct acpi_device *device); | |||
74 | static int acpi_battery_remove(struct acpi_device *device, int type); | 73 | static int acpi_battery_remove(struct acpi_device *device, int type); |
75 | static int acpi_battery_resume(struct acpi_device *device); | 74 | static int acpi_battery_resume(struct acpi_device *device); |
76 | 75 | ||
76 | static const struct acpi_device_id battery_device_ids[] = { | ||
77 | {"PNP0C0A", 0}, | ||
78 | {"", 0}, | ||
79 | }; | ||
80 | MODULE_DEVICE_TABLE(acpi, battery_device_ids); | ||
81 | |||
77 | static struct acpi_driver acpi_battery_driver = { | 82 | static struct acpi_driver acpi_battery_driver = { |
78 | .name = "battery", | 83 | .name = "battery", |
79 | .class = ACPI_BATTERY_CLASS, | 84 | .class = ACPI_BATTERY_CLASS, |
80 | .ids = ACPI_BATTERY_HID, | 85 | .ids = battery_device_ids, |
81 | .ops = { | 86 | .ops = { |
82 | .add = acpi_battery_add, | 87 | .add = acpi_battery_add, |
83 | .resume = acpi_battery_resume, | 88 | .resume = acpi_battery_resume, |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index cb4110b50cd0..540581338ef5 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -66,6 +66,16 @@ MODULE_AUTHOR("Paul Diefenbaugh"); | |||
66 | MODULE_DESCRIPTION("ACPI Button Driver"); | 66 | MODULE_DESCRIPTION("ACPI Button Driver"); |
67 | MODULE_LICENSE("GPL"); | 67 | MODULE_LICENSE("GPL"); |
68 | 68 | ||
69 | static const struct acpi_device_id button_device_ids[] = { | ||
70 | {ACPI_BUTTON_HID_LID, 0}, | ||
71 | {ACPI_BUTTON_HID_SLEEP, 0}, | ||
72 | {ACPI_BUTTON_HID_SLEEPF, 0}, | ||
73 | {ACPI_BUTTON_HID_POWER, 0}, | ||
74 | {ACPI_BUTTON_HID_POWERF, 0}, | ||
75 | {"", 0}, | ||
76 | }; | ||
77 | MODULE_DEVICE_TABLE(acpi, button_device_ids); | ||
78 | |||
69 | static int acpi_button_add(struct acpi_device *device); | 79 | static int acpi_button_add(struct acpi_device *device); |
70 | static int acpi_button_remove(struct acpi_device *device, int type); | 80 | static int acpi_button_remove(struct acpi_device *device, int type); |
71 | static int acpi_button_info_open_fs(struct inode *inode, struct file *file); | 81 | static int acpi_button_info_open_fs(struct inode *inode, struct file *file); |
@@ -74,7 +84,7 @@ static int acpi_button_state_open_fs(struct inode *inode, struct file *file); | |||
74 | static struct acpi_driver acpi_button_driver = { | 84 | static struct acpi_driver acpi_button_driver = { |
75 | .name = "button", | 85 | .name = "button", |
76 | .class = ACPI_BUTTON_CLASS, | 86 | .class = ACPI_BUTTON_CLASS, |
77 | .ids = "button_power,button_sleep,PNP0C0D,PNP0C0C,PNP0C0E", | 87 | .ids = button_device_ids, |
78 | .ops = { | 88 | .ops = { |
79 | .add = acpi_button_add, | 89 | .add = acpi_button_add, |
80 | .remove = acpi_button_remove, | 90 | .remove = acpi_button_remove, |
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 0dd3bf7c0ed1..3c25ec7a1871 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c | |||
@@ -52,10 +52,18 @@ MODULE_LICENSE("GPL"); | |||
52 | static int acpi_container_add(struct acpi_device *device); | 52 | static int acpi_container_add(struct acpi_device *device); |
53 | static int acpi_container_remove(struct acpi_device *device, int type); | 53 | static int acpi_container_remove(struct acpi_device *device, int type); |
54 | 54 | ||
55 | static const struct acpi_device_id container_device_ids[] = { | ||
56 | {"ACPI0004", 0}, | ||
57 | {"PNP0A05", 0}, | ||
58 | {"PNP0A06", 0}, | ||
59 | {"", 0}, | ||
60 | }; | ||
61 | MODULE_DEVICE_TABLE(acpi, container_device_ids); | ||
62 | |||
55 | static struct acpi_driver acpi_container_driver = { | 63 | static struct acpi_driver acpi_container_driver = { |
56 | .name = "container", | 64 | .name = "container", |
57 | .class = ACPI_CONTAINER_CLASS, | 65 | .class = ACPI_CONTAINER_CLASS, |
58 | .ids = "ACPI0004,PNP0A05,PNP0A06", | 66 | .ids = container_device_ids, |
59 | .ops = { | 67 | .ops = { |
60 | .add = acpi_container_add, | 68 | .add = acpi_container_add, |
61 | .remove = acpi_container_remove, | 69 | .remove = acpi_container_remove, |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 10e851021eca..469f3f57f881 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <acpi/actypes.h> | 41 | #include <acpi/actypes.h> |
42 | 42 | ||
43 | #define ACPI_EC_CLASS "embedded_controller" | 43 | #define ACPI_EC_CLASS "embedded_controller" |
44 | #define ACPI_EC_HID "PNP0C09" | ||
45 | #define ACPI_EC_DEVICE_NAME "Embedded Controller" | 44 | #define ACPI_EC_DEVICE_NAME "Embedded Controller" |
46 | #define ACPI_EC_FILE_INFO "info" | 45 | #define ACPI_EC_FILE_INFO "info" |
47 | 46 | ||
@@ -82,10 +81,15 @@ static int acpi_ec_start(struct acpi_device *device); | |||
82 | static int acpi_ec_stop(struct acpi_device *device, int type); | 81 | static int acpi_ec_stop(struct acpi_device *device, int type); |
83 | static int acpi_ec_add(struct acpi_device *device); | 82 | static int acpi_ec_add(struct acpi_device *device); |
84 | 83 | ||
84 | static const struct acpi_device_id ec_device_ids[] = { | ||
85 | {"PNP0C09", 0}, | ||
86 | {"", 0}, | ||
87 | }; | ||
88 | |||
85 | static struct acpi_driver acpi_ec_driver = { | 89 | static struct acpi_driver acpi_ec_driver = { |
86 | .name = "ec", | 90 | .name = "ec", |
87 | .class = ACPI_EC_CLASS, | 91 | .class = ACPI_EC_CLASS, |
88 | .ids = ACPI_EC_HID, | 92 | .ids = ec_device_ids, |
89 | .ops = { | 93 | .ops = { |
90 | .add = acpi_ec_add, | 94 | .add = acpi_ec_add, |
91 | .remove = acpi_ec_remove, | 95 | .remove = acpi_ec_remove, |
diff --git a/drivers/acpi/events/evrgnini.c b/drivers/acpi/events/evrgnini.c index 23ee7bc4a705..b1aaa0e84588 100644 --- a/drivers/acpi/events/evrgnini.c +++ b/drivers/acpi/events/evrgnini.c | |||
@@ -378,7 +378,7 @@ static u8 acpi_ev_match_pci_root_bridge(char *id) | |||
378 | static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) | 378 | static u8 acpi_ev_is_pci_root_bridge(struct acpi_namespace_node *node) |
379 | { | 379 | { |
380 | acpi_status status; | 380 | acpi_status status; |
381 | struct acpi_device_id hid; | 381 | struct acpica_device_id hid; |
382 | struct acpi_compatible_id_list *cid; | 382 | struct acpi_compatible_id_list *cid; |
383 | acpi_native_uint i; | 383 | acpi_native_uint i; |
384 | 384 | ||
diff --git a/drivers/acpi/fan.c b/drivers/acpi/fan.c index ec655c539492..c81f6bdb68b8 100644 --- a/drivers/acpi/fan.c +++ b/drivers/acpi/fan.c | |||
@@ -50,10 +50,16 @@ static int acpi_fan_remove(struct acpi_device *device, int type); | |||
50 | static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state); | 50 | static int acpi_fan_suspend(struct acpi_device *device, pm_message_t state); |
51 | static int acpi_fan_resume(struct acpi_device *device); | 51 | static int acpi_fan_resume(struct acpi_device *device); |
52 | 52 | ||
53 | static const struct acpi_device_id fan_device_ids[] = { | ||
54 | {"PNP0C0B", 0}, | ||
55 | {"", 0}, | ||
56 | }; | ||
57 | MODULE_DEVICE_TABLE(acpi, fan_device_ids); | ||
58 | |||
53 | static struct acpi_driver acpi_fan_driver = { | 59 | static struct acpi_driver acpi_fan_driver = { |
54 | .name = "fan", | 60 | .name = "fan", |
55 | .class = ACPI_FAN_CLASS, | 61 | .class = ACPI_FAN_CLASS, |
56 | .ids = "PNP0C0B", | 62 | .ids = fan_device_ids, |
57 | .ops = { | 63 | .ops = { |
58 | .add = acpi_fan_add, | 64 | .add = acpi_fan_add, |
59 | .remove = acpi_fan_remove, | 65 | .remove = acpi_fan_remove, |
diff --git a/drivers/acpi/namespace/nsxfeval.c b/drivers/acpi/namespace/nsxfeval.c index be4f2899de74..ab65b2c2560e 100644 --- a/drivers/acpi/namespace/nsxfeval.c +++ b/drivers/acpi/namespace/nsxfeval.c | |||
@@ -440,7 +440,7 @@ acpi_ns_get_device_callback(acpi_handle obj_handle, | |||
440 | acpi_status status; | 440 | acpi_status status; |
441 | struct acpi_namespace_node *node; | 441 | struct acpi_namespace_node *node; |
442 | u32 flags; | 442 | u32 flags; |
443 | struct acpi_device_id hid; | 443 | struct acpica_device_id hid; |
444 | struct acpi_compatible_id_list *cid; | 444 | struct acpi_compatible_id_list *cid; |
445 | acpi_native_uint i; | 445 | acpi_native_uint i; |
446 | 446 | ||
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 3448edd61dc4..c9f526e55392 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #define _COMPONENT ACPI_PCI_COMPONENT | 46 | #define _COMPONENT ACPI_PCI_COMPONENT |
47 | ACPI_MODULE_NAME("pci_link"); | 47 | ACPI_MODULE_NAME("pci_link"); |
48 | #define ACPI_PCI_LINK_CLASS "pci_irq_routing" | 48 | #define ACPI_PCI_LINK_CLASS "pci_irq_routing" |
49 | #define ACPI_PCI_LINK_HID "PNP0C0F" | ||
50 | #define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link" | 49 | #define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link" |
51 | #define ACPI_PCI_LINK_FILE_INFO "info" | 50 | #define ACPI_PCI_LINK_FILE_INFO "info" |
52 | #define ACPI_PCI_LINK_FILE_STATUS "state" | 51 | #define ACPI_PCI_LINK_FILE_STATUS "state" |
@@ -54,10 +53,16 @@ ACPI_MODULE_NAME("pci_link"); | |||
54 | static int acpi_pci_link_add(struct acpi_device *device); | 53 | static int acpi_pci_link_add(struct acpi_device *device); |
55 | static int acpi_pci_link_remove(struct acpi_device *device, int type); | 54 | static int acpi_pci_link_remove(struct acpi_device *device, int type); |
56 | 55 | ||
56 | static struct acpi_device_id link_device_ids[] = { | ||
57 | {"PNP0C0F", 0}, | ||
58 | {"", 0}, | ||
59 | }; | ||
60 | MODULE_DEVICE_TABLE(acpi, link_device_ids); | ||
61 | |||
57 | static struct acpi_driver acpi_pci_link_driver = { | 62 | static struct acpi_driver acpi_pci_link_driver = { |
58 | .name = "pci_link", | 63 | .name = "pci_link", |
59 | .class = ACPI_PCI_LINK_CLASS, | 64 | .class = ACPI_PCI_LINK_CLASS, |
60 | .ids = ACPI_PCI_LINK_HID, | 65 | .ids = link_device_ids, |
61 | .ops = { | 66 | .ops = { |
62 | .add = acpi_pci_link_add, | 67 | .add = acpi_pci_link_add, |
63 | .remove = acpi_pci_link_remove, | 68 | .remove = acpi_pci_link_remove, |
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index ad4145a37786..f14ff1ffab29 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c | |||
@@ -38,16 +38,21 @@ | |||
38 | #define _COMPONENT ACPI_PCI_COMPONENT | 38 | #define _COMPONENT ACPI_PCI_COMPONENT |
39 | ACPI_MODULE_NAME("pci_root"); | 39 | ACPI_MODULE_NAME("pci_root"); |
40 | #define ACPI_PCI_ROOT_CLASS "pci_bridge" | 40 | #define ACPI_PCI_ROOT_CLASS "pci_bridge" |
41 | #define ACPI_PCI_ROOT_HID "PNP0A03" | ||
42 | #define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge" | 41 | #define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge" |
43 | static int acpi_pci_root_add(struct acpi_device *device); | 42 | static int acpi_pci_root_add(struct acpi_device *device); |
44 | static int acpi_pci_root_remove(struct acpi_device *device, int type); | 43 | static int acpi_pci_root_remove(struct acpi_device *device, int type); |
45 | static int acpi_pci_root_start(struct acpi_device *device); | 44 | static int acpi_pci_root_start(struct acpi_device *device); |
46 | 45 | ||
46 | static struct acpi_device_id root_device_ids[] = { | ||
47 | {"PNP0A03", 0}, | ||
48 | {"", 0}, | ||
49 | }; | ||
50 | MODULE_DEVICE_TABLE(acpi, root_device_ids); | ||
51 | |||
47 | static struct acpi_driver acpi_pci_root_driver = { | 52 | static struct acpi_driver acpi_pci_root_driver = { |
48 | .name = "pci_root", | 53 | .name = "pci_root", |
49 | .class = ACPI_PCI_ROOT_CLASS, | 54 | .class = ACPI_PCI_ROOT_CLASS, |
50 | .ids = ACPI_PCI_ROOT_HID, | 55 | .ids = root_device_ids, |
51 | .ops = { | 56 | .ops = { |
52 | .add = acpi_pci_root_add, | 57 | .add = acpi_pci_root_add, |
53 | .remove = acpi_pci_root_remove, | 58 | .remove = acpi_pci_root_remove, |
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 4ffecd179702..57b9a2998fd0 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c | |||
@@ -59,10 +59,16 @@ static int acpi_power_remove(struct acpi_device *device, int type); | |||
59 | static int acpi_power_resume(struct acpi_device *device); | 59 | static int acpi_power_resume(struct acpi_device *device); |
60 | static int acpi_power_open_fs(struct inode *inode, struct file *file); | 60 | static int acpi_power_open_fs(struct inode *inode, struct file *file); |
61 | 61 | ||
62 | static struct acpi_device_id power_device_ids[] = { | ||
63 | {ACPI_POWER_HID, 0}, | ||
64 | {"", 0}, | ||
65 | }; | ||
66 | MODULE_DEVICE_TABLE(acpi, power_device_ids); | ||
67 | |||
62 | static struct acpi_driver acpi_power_driver = { | 68 | static struct acpi_driver acpi_power_driver = { |
63 | .name = "power", | 69 | .name = "power", |
64 | .class = ACPI_POWER_CLASS, | 70 | .class = ACPI_POWER_CLASS, |
65 | .ids = ACPI_POWER_HID, | 71 | .ids = power_device_ids, |
66 | .ops = { | 72 | .ops = { |
67 | .add = acpi_power_add, | 73 | .add = acpi_power_add, |
68 | .remove = acpi_power_remove, | 74 | .remove = acpi_power_remove, |
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 81aceb5da7c7..498422343f38 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -88,10 +88,16 @@ static int acpi_processor_handle_eject(struct acpi_processor *pr); | |||
88 | extern int acpi_processor_tstate_has_changed(struct acpi_processor *pr); | 88 | extern int acpi_processor_tstate_has_changed(struct acpi_processor *pr); |
89 | 89 | ||
90 | 90 | ||
91 | static const struct acpi_device_id processor_device_ids[] = { | ||
92 | {ACPI_PROCESSOR_HID, 0}, | ||
93 | {"", 0}, | ||
94 | }; | ||
95 | MODULE_DEVICE_TABLE(acpi, processor_device_ids); | ||
96 | |||
91 | static struct acpi_driver acpi_processor_driver = { | 97 | static struct acpi_driver acpi_processor_driver = { |
92 | .name = "processor", | 98 | .name = "processor", |
93 | .class = ACPI_PROCESSOR_CLASS, | 99 | .class = ACPI_PROCESSOR_CLASS, |
94 | .ids = ACPI_PROCESSOR_HID, | 100 | .ids = processor_device_ids, |
95 | .ops = { | 101 | .ops = { |
96 | .add = acpi_processor_add, | 102 | .add = acpi_processor_add, |
97 | .remove = acpi_processor_remove, | 103 | .remove = acpi_processor_remove, |
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/sbs.c b/drivers/acpi/sbs.c index 974d00ccfe84..7d8e78ea13a5 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #define ACPI_SBS_CLASS "sbs" | 38 | #define ACPI_SBS_CLASS "sbs" |
39 | #define ACPI_AC_CLASS "ac_adapter" | 39 | #define ACPI_AC_CLASS "ac_adapter" |
40 | #define ACPI_BATTERY_CLASS "battery" | 40 | #define ACPI_BATTERY_CLASS "battery" |
41 | #define ACPI_SBS_HID "ACPI0002" | ||
42 | #define ACPI_SBS_DEVICE_NAME "Smart Battery System" | 41 | #define ACPI_SBS_DEVICE_NAME "Smart Battery System" |
43 | #define ACPI_SBS_FILE_INFO "info" | 42 | #define ACPI_SBS_FILE_INFO "info" |
44 | #define ACPI_SBS_FILE_STATE "state" | 43 | #define ACPI_SBS_FILE_STATE "state" |
@@ -124,10 +123,17 @@ static int acpi_sbs_add(struct acpi_device *device); | |||
124 | static int acpi_sbs_remove(struct acpi_device *device, int type); | 123 | static int acpi_sbs_remove(struct acpi_device *device, int type); |
125 | static int acpi_sbs_resume(struct acpi_device *device); | 124 | static int acpi_sbs_resume(struct acpi_device *device); |
126 | 125 | ||
126 | static const struct acpi_device_id sbs_device_ids[] = { | ||
127 | {"ACPI0001", 0}, | ||
128 | {"ACPI0005", 0}, | ||
129 | {"", 0}, | ||
130 | }; | ||
131 | MODULE_DEVICE_TABLE(acpi, sbs_device_ids); | ||
132 | |||
127 | static struct acpi_driver acpi_sbs_driver = { | 133 | static struct acpi_driver acpi_sbs_driver = { |
128 | .name = "sbs", | 134 | .name = "sbs", |
129 | .class = ACPI_SBS_CLASS, | 135 | .class = ACPI_SBS_CLASS, |
130 | .ids = "ACPI0001,ACPI0005", | 136 | .ids = sbs_device_ids, |
131 | .ops = { | 137 | .ops = { |
132 | .add = acpi_sbs_add, | 138 | .add = acpi_sbs_add, |
133 | .remove = acpi_sbs_remove, | 139 | .remove = acpi_sbs_remove, |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 6b3b8a522476..be74347d1354 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -16,7 +16,7 @@ ACPI_MODULE_NAME("scan"); | |||
16 | extern struct acpi_device *acpi_root; | 16 | extern struct acpi_device *acpi_root; |
17 | 17 | ||
18 | #define ACPI_BUS_CLASS "system_bus" | 18 | #define ACPI_BUS_CLASS "system_bus" |
19 | #define ACPI_BUS_HID "ACPI_BUS" | 19 | #define ACPI_BUS_HID "LNXSYBUS" |
20 | #define ACPI_BUS_DEVICE_NAME "System Bus" | 20 | #define ACPI_BUS_DEVICE_NAME "System Bus" |
21 | 21 | ||
22 | static LIST_HEAD(acpi_device_list); | 22 | static LIST_HEAD(acpi_device_list); |
@@ -29,6 +29,62 @@ struct acpi_device_bus_id{ | |||
29 | unsigned int instance_no; | 29 | unsigned int instance_no; |
30 | struct list_head node; | 30 | struct list_head node; |
31 | }; | 31 | }; |
32 | |||
33 | /* | ||
34 | * Creates hid/cid(s) string needed for modalias and uevent | ||
35 | * e.g. on a device with hid:IBM0001 and cid:ACPI0001 you get: | ||
36 | * char *modalias: "acpi:IBM0001:ACPI0001" | ||
37 | */ | ||
38 | int create_modalias(struct acpi_device *acpi_dev, char *modalias, int size){ | ||
39 | |||
40 | int len; | ||
41 | |||
42 | if (!acpi_dev->flags.hardware_id) | ||
43 | return -ENODEV; | ||
44 | |||
45 | len = snprintf(modalias, size, "acpi:%s:", | ||
46 | acpi_dev->pnp.hardware_id); | ||
47 | if (len < 0 || len >= size) | ||
48 | return -EINVAL; | ||
49 | size -= len; | ||
50 | |||
51 | if (acpi_dev->flags.compatible_ids) { | ||
52 | struct acpi_compatible_id_list *cid_list; | ||
53 | int i; | ||
54 | int count; | ||
55 | |||
56 | cid_list = acpi_dev->pnp.cid_list; | ||
57 | for (i = 0; i < cid_list->count; i++) { | ||
58 | count = snprintf(&modalias[len], size, "%s:", | ||
59 | cid_list->id[i].value); | ||
60 | if (count < 0 || count >= size) { | ||
61 | printk(KERN_ERR "acpi: %s cid[%i] exceeds event buffer size", | ||
62 | acpi_dev->pnp.device_name, i); | ||
63 | break; | ||
64 | } | ||
65 | len += count; | ||
66 | size -= count; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | modalias[len] = '\0'; | ||
71 | return len; | ||
72 | } | ||
73 | |||
74 | static ssize_t | ||
75 | acpi_device_modalias_show(struct device *dev, struct device_attribute *attr, char *buf) { | ||
76 | struct acpi_device *acpi_dev = to_acpi_device(dev); | ||
77 | int len; | ||
78 | |||
79 | /* Device has no HID and no CID or string is >1024 */ | ||
80 | len = create_modalias(acpi_dev, buf, 1024); | ||
81 | if (len <= 0) | ||
82 | return 0; | ||
83 | buf[len++] = '\n'; | ||
84 | return len; | ||
85 | } | ||
86 | static DEVICE_ATTR(modalias, 0444, acpi_device_modalias_show, NULL); | ||
87 | |||
32 | static int acpi_eject_operation(acpi_handle handle, int lockable) | 88 | static int acpi_eject_operation(acpi_handle handle, int lockable) |
33 | { | 89 | { |
34 | struct acpi_object_list arg_list; | 90 | struct acpi_object_list arg_list; |
@@ -154,6 +210,12 @@ static int acpi_device_setup_files(struct acpi_device *dev) | |||
154 | goto end; | 210 | goto end; |
155 | } | 211 | } |
156 | 212 | ||
213 | if (dev->flags.hardware_id || dev->flags.compatible_ids){ | ||
214 | result = device_create_file(&dev->dev, &dev_attr_modalias); | ||
215 | if(result) | ||
216 | goto end; | ||
217 | } | ||
218 | |||
157 | /* | 219 | /* |
158 | * If device has _EJ0, 'eject' file is created that is used to trigger | 220 | * If device has _EJ0, 'eject' file is created that is used to trigger |
159 | * hot-removal function from userland. | 221 | * hot-removal function from userland. |
@@ -178,6 +240,9 @@ static void acpi_device_remove_files(struct acpi_device *dev) | |||
178 | if (ACPI_SUCCESS(status)) | 240 | if (ACPI_SUCCESS(status)) |
179 | device_remove_file(&dev->dev, &dev_attr_eject); | 241 | device_remove_file(&dev->dev, &dev_attr_eject); |
180 | 242 | ||
243 | if (dev->flags.hardware_id || dev->flags.compatible_ids) | ||
244 | device_remove_file(&dev->dev, &dev_attr_modalias); | ||
245 | |||
181 | if(dev->flags.hardware_id) | 246 | if(dev->flags.hardware_id) |
182 | device_remove_file(&dev->dev, &dev_attr_hid); | 247 | device_remove_file(&dev->dev, &dev_attr_hid); |
183 | if(dev->handle) | 248 | if(dev->handle) |
@@ -186,6 +251,37 @@ static void acpi_device_remove_files(struct acpi_device *dev) | |||
186 | /* -------------------------------------------------------------------------- | 251 | /* -------------------------------------------------------------------------- |
187 | ACPI Bus operations | 252 | ACPI Bus operations |
188 | -------------------------------------------------------------------------- */ | 253 | -------------------------------------------------------------------------- */ |
254 | |||
255 | int acpi_match_device_ids(struct acpi_device *device, | ||
256 | const struct acpi_device_id *ids) | ||
257 | { | ||
258 | const struct acpi_device_id *id; | ||
259 | |||
260 | if (device->flags.hardware_id) { | ||
261 | for (id = ids; id->id[0]; id++) { | ||
262 | if (!strcmp((char*)id->id, device->pnp.hardware_id)) | ||
263 | return 0; | ||
264 | } | ||
265 | } | ||
266 | |||
267 | if (device->flags.compatible_ids) { | ||
268 | struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; | ||
269 | int i; | ||
270 | |||
271 | for (id = ids; id->id[0]; id++) { | ||
272 | /* compare multiple _CID entries against driver ids */ | ||
273 | for (i = 0; i < cid_list->count; i++) { | ||
274 | if (!strcmp((char*)id->id, | ||
275 | cid_list->id[i].value)) | ||
276 | return 0; | ||
277 | } | ||
278 | } | ||
279 | } | ||
280 | |||
281 | return -ENOENT; | ||
282 | } | ||
283 | EXPORT_SYMBOL(acpi_match_device_ids); | ||
284 | |||
189 | static void acpi_device_release(struct device *dev) | 285 | static void acpi_device_release(struct device *dev) |
190 | { | 286 | { |
191 | struct acpi_device *acpi_dev = to_acpi_device(dev); | 287 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
@@ -219,37 +315,19 @@ static int acpi_bus_match(struct device *dev, struct device_driver *drv) | |||
219 | struct acpi_device *acpi_dev = to_acpi_device(dev); | 315 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
220 | struct acpi_driver *acpi_drv = to_acpi_driver(drv); | 316 | struct acpi_driver *acpi_drv = to_acpi_driver(drv); |
221 | 317 | ||
222 | return !acpi_match_ids(acpi_dev, acpi_drv->ids); | 318 | return !acpi_match_device_ids(acpi_dev, acpi_drv->ids); |
223 | } | 319 | } |
224 | 320 | ||
225 | static int acpi_device_uevent(struct device *dev, char **envp, int num_envp, | 321 | static int acpi_device_uevent(struct device *dev, char **envp, int num_envp, |
226 | char *buffer, int buffer_size) | 322 | char *buffer, int buffer_size) |
227 | { | 323 | { |
228 | struct acpi_device *acpi_dev = to_acpi_device(dev); | 324 | struct acpi_device *acpi_dev = to_acpi_device(dev); |
229 | int i = 0, length = 0, ret = 0; | ||
230 | |||
231 | if (acpi_dev->flags.hardware_id) | ||
232 | ret = add_uevent_var(envp, num_envp, &i, | ||
233 | buffer, buffer_size, &length, | ||
234 | "HWID=%s", acpi_dev->pnp.hardware_id); | ||
235 | if (ret) | ||
236 | return -ENOMEM; | ||
237 | if (acpi_dev->flags.compatible_ids) { | ||
238 | int j; | ||
239 | struct acpi_compatible_id_list *cid_list; | ||
240 | 325 | ||
241 | cid_list = acpi_dev->pnp.cid_list; | 326 | strcpy(buffer, "MODALIAS="); |
242 | 327 | if (create_modalias(acpi_dev, buffer + 9, buffer_size - 9) > 0) { | |
243 | for (j = 0; j < cid_list->count; j++) { | 328 | envp[0] = buffer; |
244 | ret = add_uevent_var(envp, num_envp, &i, buffer, | 329 | envp[1] = NULL; |
245 | buffer_size, &length, "COMPTID=%s", | ||
246 | cid_list->id[j].value); | ||
247 | if (ret) | ||
248 | return -ENOMEM; | ||
249 | } | ||
250 | } | 330 | } |
251 | |||
252 | envp[i] = NULL; | ||
253 | return 0; | 331 | return 0; |
254 | } | 332 | } |
255 | 333 | ||
@@ -543,25 +621,6 @@ void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) | |||
543 | return; | 621 | return; |
544 | } | 622 | } |
545 | 623 | ||
546 | int acpi_match_ids(struct acpi_device *device, char *ids) | ||
547 | { | ||
548 | if (device->flags.hardware_id) | ||
549 | if (strstr(ids, device->pnp.hardware_id)) | ||
550 | return 0; | ||
551 | |||
552 | if (device->flags.compatible_ids) { | ||
553 | struct acpi_compatible_id_list *cid_list = device->pnp.cid_list; | ||
554 | int i; | ||
555 | |||
556 | /* compare multiple _CID entries against driver ids */ | ||
557 | for (i = 0; i < cid_list->count; i++) { | ||
558 | if (strstr(ids, cid_list->id[i].value)) | ||
559 | return 0; | ||
560 | } | ||
561 | } | ||
562 | return -ENOENT; | ||
563 | } | ||
564 | |||
565 | static int acpi_bus_get_perf_flags(struct acpi_device *device) | 624 | static int acpi_bus_get_perf_flags(struct acpi_device *device) |
566 | { | 625 | { |
567 | device->performance.state = ACPI_STATE_UNKNOWN; | 626 | device->performance.state = ACPI_STATE_UNKNOWN; |
@@ -624,6 +683,13 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
624 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 683 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
625 | union acpi_object *package = NULL; | 684 | union acpi_object *package = NULL; |
626 | 685 | ||
686 | struct acpi_device_id button_device_ids[] = { | ||
687 | {"PNP0C0D", 0}, | ||
688 | {"PNP0C0C", 0}, | ||
689 | {"PNP0C0E", 0}, | ||
690 | {"", 0}, | ||
691 | }; | ||
692 | |||
627 | 693 | ||
628 | /* _PRW */ | 694 | /* _PRW */ |
629 | status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); | 695 | status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); |
@@ -643,7 +709,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) | |||
643 | 709 | ||
644 | device->wakeup.flags.valid = 1; | 710 | device->wakeup.flags.valid = 1; |
645 | /* Power button, Lid switch always enable wakeup */ | 711 | /* Power button, Lid switch always enable wakeup */ |
646 | if (!acpi_match_ids(device, "PNP0C0D,PNP0C0C,PNP0C0E")) | 712 | if (!acpi_match_device_ids(device, button_device_ids)) |
647 | device->wakeup.flags.run_wake = 1; | 713 | device->wakeup.flags.run_wake = 1; |
648 | 714 | ||
649 | end: | 715 | end: |
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/acpi/thermal.c b/drivers/acpi/thermal.c index 58f1338981bc..5a62de1b7f2a 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c | |||
@@ -92,10 +92,16 @@ static int acpi_thermal_polling_open_fs(struct inode *inode, struct file *file); | |||
92 | static ssize_t acpi_thermal_write_polling(struct file *, const char __user *, | 92 | static ssize_t acpi_thermal_write_polling(struct file *, const char __user *, |
93 | size_t, loff_t *); | 93 | size_t, loff_t *); |
94 | 94 | ||
95 | static const struct acpi_device_id thermal_device_ids[] = { | ||
96 | {ACPI_THERMAL_HID, 0}, | ||
97 | {"", 0}, | ||
98 | }; | ||
99 | MODULE_DEVICE_TABLE(acpi, thermal_device_ids); | ||
100 | |||
95 | static struct acpi_driver acpi_thermal_driver = { | 101 | static struct acpi_driver acpi_thermal_driver = { |
96 | .name = "thermal", | 102 | .name = "thermal", |
97 | .class = ACPI_THERMAL_CLASS, | 103 | .class = ACPI_THERMAL_CLASS, |
98 | .ids = ACPI_THERMAL_HID, | 104 | .ids = thermal_device_ids, |
99 | .ops = { | 105 | .ops = { |
100 | .add = acpi_thermal_add, | 106 | .add = acpi_thermal_add, |
101 | .remove = acpi_thermal_remove, | 107 | .remove = acpi_thermal_remove, |
diff --git a/drivers/acpi/utilities/uteval.c b/drivers/acpi/utilities/uteval.c index f112af433e36..0042b7e78b26 100644 --- a/drivers/acpi/utilities/uteval.c +++ b/drivers/acpi/utilities/uteval.c | |||
@@ -407,7 +407,7 @@ acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length) | |||
407 | 407 | ||
408 | acpi_status | 408 | acpi_status |
409 | acpi_ut_execute_HID(struct acpi_namespace_node *device_node, | 409 | acpi_ut_execute_HID(struct acpi_namespace_node *device_node, |
410 | struct acpi_device_id *hid) | 410 | struct acpica_device_id *hid) |
411 | { | 411 | { |
412 | union acpi_operand_object *obj_desc; | 412 | union acpi_operand_object *obj_desc; |
413 | acpi_status status; | 413 | acpi_status status; |
@@ -609,7 +609,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node * device_node, | |||
609 | 609 | ||
610 | acpi_status | 610 | acpi_status |
611 | acpi_ut_execute_UID(struct acpi_namespace_node *device_node, | 611 | acpi_ut_execute_UID(struct acpi_namespace_node *device_node, |
612 | struct acpi_device_id *uid) | 612 | struct acpica_device_id *uid) |
613 | { | 613 | { |
614 | union acpi_operand_object *obj_desc; | 614 | union acpi_operand_object *obj_desc; |
615 | acpi_status status; | 615 | acpi_status status; |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 04ea697f72bf..d98701941981 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -74,10 +74,16 @@ MODULE_LICENSE("GPL"); | |||
74 | static int acpi_video_bus_add(struct acpi_device *device); | 74 | static int acpi_video_bus_add(struct acpi_device *device); |
75 | static int acpi_video_bus_remove(struct acpi_device *device, int type); | 75 | static int acpi_video_bus_remove(struct acpi_device *device, int type); |
76 | 76 | ||
77 | static const struct acpi_device_id video_device_ids[] = { | ||
78 | {ACPI_VIDEO_HID, 0}, | ||
79 | {"", 0}, | ||
80 | }; | ||
81 | MODULE_DEVICE_TABLE(acpi, video_device_ids); | ||
82 | |||
77 | static struct acpi_driver acpi_video_bus = { | 83 | static struct acpi_driver acpi_video_bus = { |
78 | .name = "video", | 84 | .name = "video", |
79 | .class = ACPI_VIDEO_CLASS, | 85 | .class = ACPI_VIDEO_CLASS, |
80 | .ids = ACPI_VIDEO_HID, | 86 | .ids = video_device_ids, |
81 | .ops = { | 87 | .ops = { |
82 | .add = acpi_video_bus_add, | 88 | .add = acpi_video_bus_add, |
83 | .remove = acpi_video_bus_remove, | 89 | .remove = acpi_video_bus_remove, |
diff --git a/drivers/char/hpet.c b/drivers/char/hpet.c index ba0e74ad74bb..9a2694e5f8b9 100644 --- a/drivers/char/hpet.c +++ b/drivers/char/hpet.c | |||
@@ -1007,9 +1007,15 @@ static int hpet_acpi_remove(struct acpi_device *device, int type) | |||
1007 | return -EINVAL; | 1007 | return -EINVAL; |
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | static const struct acpi_device_id hpet_device_ids[] = { | ||
1011 | {"PNP0103", 0}, | ||
1012 | {"", 0}, | ||
1013 | }; | ||
1014 | MODULE_DEVICE_TABLE(acpi, hpet_device_ids); | ||
1015 | |||
1010 | static struct acpi_driver hpet_acpi_driver = { | 1016 | static struct acpi_driver hpet_acpi_driver = { |
1011 | .name = "hpet", | 1017 | .name = "hpet", |
1012 | .ids = "PNP0103", | 1018 | .ids = hpet_device_ids, |
1013 | .ops = { | 1019 | .ops = { |
1014 | .add = hpet_acpi_add, | 1020 | .add = hpet_acpi_add, |
1015 | .remove = hpet_acpi_remove, | 1021 | .remove = hpet_acpi_remove, |
diff --git a/drivers/input/misc/atlas_btns.c b/drivers/input/misc/atlas_btns.c index 0acc3a123604..e43e92fd9e23 100644 --- a/drivers/input/misc/atlas_btns.c +++ b/drivers/input/misc/atlas_btns.c | |||
@@ -31,7 +31,6 @@ | |||
31 | 31 | ||
32 | #define ACPI_ATLAS_NAME "Atlas ACPI" | 32 | #define ACPI_ATLAS_NAME "Atlas ACPI" |
33 | #define ACPI_ATLAS_CLASS "Atlas" | 33 | #define ACPI_ATLAS_CLASS "Atlas" |
34 | #define ACPI_ATLAS_BUTTON_HID "ASIM0000" | ||
35 | 34 | ||
36 | static struct input_dev *input_dev; | 35 | static struct input_dev *input_dev; |
37 | 36 | ||
@@ -130,10 +129,16 @@ static int atlas_acpi_button_remove(struct acpi_device *device, int type) | |||
130 | return status; | 129 | return status; |
131 | } | 130 | } |
132 | 131 | ||
132 | static const struct acpi_device_id atlas_device_ids[] = { | ||
133 | {"ASIM0000", 0}, | ||
134 | {"", 0}, | ||
135 | }; | ||
136 | MODULE_DEVICE_TABLE(acpi, atlas_device_ids); | ||
137 | |||
133 | static struct acpi_driver atlas_acpi_driver = { | 138 | static struct acpi_driver atlas_acpi_driver = { |
134 | .name = ACPI_ATLAS_NAME, | 139 | .name = ACPI_ATLAS_NAME, |
135 | .class = ACPI_ATLAS_CLASS, | 140 | .class = ACPI_ATLAS_CLASS, |
136 | .ids = ACPI_ATLAS_BUTTON_HID, | 141 | .ids = atlas_device_ids, |
137 | .ops = { | 142 | .ops = { |
138 | .add = atlas_acpi_button_add, | 143 | .add = atlas_acpi_button_add, |
139 | .remove = atlas_acpi_button_remove, | 144 | .remove = atlas_acpi_button_remove, |
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c index 6b89854bd3ff..d0fc4fd212e6 100644 --- a/drivers/misc/asus-laptop.c +++ b/drivers/misc/asus-laptop.c | |||
@@ -53,7 +53,6 @@ | |||
53 | #define ASUS_HOTK_NAME "Asus Laptop Support" | 53 | #define ASUS_HOTK_NAME "Asus Laptop Support" |
54 | #define ASUS_HOTK_CLASS "hotkey" | 54 | #define ASUS_HOTK_CLASS "hotkey" |
55 | #define ASUS_HOTK_DEVICE_NAME "Hotkey" | 55 | #define ASUS_HOTK_DEVICE_NAME "Hotkey" |
56 | #define ASUS_HOTK_HID "ATK0100" | ||
57 | #define ASUS_HOTK_FILE "asus-laptop" | 56 | #define ASUS_HOTK_FILE "asus-laptop" |
58 | #define ASUS_HOTK_PREFIX "\\_SB.ATKD." | 57 | #define ASUS_HOTK_PREFIX "\\_SB.ATKD." |
59 | 58 | ||
@@ -197,12 +196,18 @@ static struct asus_hotk *hotk; | |||
197 | /* | 196 | /* |
198 | * The hotkey driver declaration | 197 | * The hotkey driver declaration |
199 | */ | 198 | */ |
199 | static const struct acpi_device_id asus_device_ids[] = { | ||
200 | {"ATK0100", 0}, | ||
201 | {"", 0}, | ||
202 | }; | ||
203 | MODULE_DEVICE_TABLE(acpi, asus_device_ids); | ||
204 | |||
200 | static int asus_hotk_add(struct acpi_device *device); | 205 | static int asus_hotk_add(struct acpi_device *device); |
201 | static int asus_hotk_remove(struct acpi_device *device, int type); | 206 | static int asus_hotk_remove(struct acpi_device *device, int type); |
202 | static struct acpi_driver asus_hotk_driver = { | 207 | static struct acpi_driver asus_hotk_driver = { |
203 | .name = ASUS_HOTK_NAME, | 208 | .name = ASUS_HOTK_NAME, |
204 | .class = ASUS_HOTK_CLASS, | 209 | .class = ASUS_HOTK_CLASS, |
205 | .ids = ASUS_HOTK_HID, | 210 | .ids = asus_device_ids, |
206 | .ops = { | 211 | .ops = { |
207 | .add = asus_hotk_add, | 212 | .add = asus_hotk_add, |
208 | .remove = asus_hotk_remove, | 213 | .remove = asus_hotk_remove, |
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index 303e48ca0e8a..14ee06c8f127 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c | |||
@@ -1124,10 +1124,22 @@ static int sony_nc_remove(struct acpi_device *device, int type) | |||
1124 | return 0; | 1124 | return 0; |
1125 | } | 1125 | } |
1126 | 1126 | ||
1127 | static const struct acpi_device_id sony_device_ids[] = { | ||
1128 | {SONY_NC_HID, 0}, | ||
1129 | {SONY_PIC_HID, 0}, | ||
1130 | {"", 0}, | ||
1131 | }; | ||
1132 | MODULE_DEVICE_TABLE(acpi, sony_device_ids); | ||
1133 | |||
1134 | static const struct acpi_device_id sony_nc_device_ids[] = { | ||
1135 | {SONY_NC_HID, 0}, | ||
1136 | {"", 0}, | ||
1137 | }; | ||
1138 | |||
1127 | static struct acpi_driver sony_nc_driver = { | 1139 | static struct acpi_driver sony_nc_driver = { |
1128 | .name = SONY_NC_DRIVER_NAME, | 1140 | .name = SONY_NC_DRIVER_NAME, |
1129 | .class = SONY_NC_CLASS, | 1141 | .class = SONY_NC_CLASS, |
1130 | .ids = SONY_NC_HID, | 1142 | .ids = sony_nc_device_ids, |
1131 | .owner = THIS_MODULE, | 1143 | .owner = THIS_MODULE, |
1132 | .ops = { | 1144 | .ops = { |
1133 | .add = sony_nc_add, | 1145 | .add = sony_nc_add, |
@@ -2470,10 +2482,15 @@ static int sony_pic_resume(struct acpi_device *device) | |||
2470 | return 0; | 2482 | return 0; |
2471 | } | 2483 | } |
2472 | 2484 | ||
2485 | static const struct acpi_device_id sony_pic_device_ids[] = { | ||
2486 | {SONY_PIC_HID, 0}, | ||
2487 | {"", 0}, | ||
2488 | }; | ||
2489 | |||
2473 | static struct acpi_driver sony_pic_driver = { | 2490 | static struct acpi_driver sony_pic_driver = { |
2474 | .name = SONY_PIC_DRIVER_NAME, | 2491 | .name = SONY_PIC_DRIVER_NAME, |
2475 | .class = SONY_PIC_CLASS, | 2492 | .class = SONY_PIC_CLASS, |
2476 | .ids = SONY_PIC_HID, | 2493 | .ids = sony_pic_device_ids, |
2477 | .owner = THIS_MODULE, | 2494 | .owner = THIS_MODULE, |
2478 | .ops = { | 2495 | .ops = { |
2479 | .add = sony_pic_add, | 2496 | .add = sony_pic_add, |
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index f15a58f7403f..fa80f355e522 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -411,12 +411,13 @@ static int __init register_tpacpi_subdriver(struct ibm_struct *ibm) | |||
411 | 411 | ||
412 | sprintf(ibm->acpi->driver->name, "%s_%s", IBM_NAME, ibm->name); | 412 | sprintf(ibm->acpi->driver->name, "%s_%s", IBM_NAME, ibm->name); |
413 | ibm->acpi->driver->ids = ibm->acpi->hid; | 413 | ibm->acpi->driver->ids = ibm->acpi->hid; |
414 | |||
414 | ibm->acpi->driver->ops.add = &tpacpi_device_add; | 415 | ibm->acpi->driver->ops.add = &tpacpi_device_add; |
415 | 416 | ||
416 | rc = acpi_bus_register_driver(ibm->acpi->driver); | 417 | rc = acpi_bus_register_driver(ibm->acpi->driver); |
417 | if (rc < 0) { | 418 | if (rc < 0) { |
418 | printk(IBM_ERR "acpi_bus_register_driver(%s) failed: %d\n", | 419 | printk(IBM_ERR "acpi_bus_register_driver(%s) failed: %d\n", |
419 | ibm->acpi->hid, rc); | 420 | ibm->name, rc); |
420 | kfree(ibm->acpi->driver); | 421 | kfree(ibm->acpi->driver); |
421 | ibm->acpi->driver = NULL; | 422 | ibm->acpi->driver = NULL; |
422 | } else if (!rc) | 423 | } else if (!rc) |
@@ -1316,8 +1317,13 @@ errexit: | |||
1316 | return res; | 1317 | return res; |
1317 | } | 1318 | } |
1318 | 1319 | ||
1320 | static const struct acpi_device_id ibm_htk_device_ids[] = { | ||
1321 | {IBM_HKEY_HID, 0}, | ||
1322 | {"", 0}, | ||
1323 | }; | ||
1324 | |||
1319 | static struct tp_acpi_drv_struct ibm_hotkey_acpidriver = { | 1325 | static struct tp_acpi_drv_struct ibm_hotkey_acpidriver = { |
1320 | .hid = IBM_HKEY_HID, | 1326 | .hid = ibm_htk_device_ids, |
1321 | .notify = hotkey_notify, | 1327 | .notify = hotkey_notify, |
1322 | .handle = &hkey_handle, | 1328 | .handle = &hkey_handle, |
1323 | .type = ACPI_DEVICE_NOTIFY, | 1329 | .type = ACPI_DEVICE_NOTIFY, |
@@ -2080,6 +2086,11 @@ IBM_HANDLE(dock, root, "\\_SB.GDCK", /* X30, X31, X40 */ | |||
2080 | /* don't list other alternatives as we install a notify handler on the 570 */ | 2086 | /* don't list other alternatives as we install a notify handler on the 570 */ |
2081 | IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */ | 2087 | IBM_HANDLE(pci, root, "\\_SB.PCI"); /* 570 */ |
2082 | 2088 | ||
2089 | static const struct acpi_device_id ibm_pci_device_ids[] = { | ||
2090 | {PCI_ROOT_HID_STRING, 0}, | ||
2091 | {"", 0}, | ||
2092 | }; | ||
2093 | |||
2083 | static struct tp_acpi_drv_struct ibm_dock_acpidriver[2] = { | 2094 | static struct tp_acpi_drv_struct ibm_dock_acpidriver[2] = { |
2084 | { | 2095 | { |
2085 | .notify = dock_notify, | 2096 | .notify = dock_notify, |
@@ -2090,7 +2101,7 @@ static struct tp_acpi_drv_struct ibm_dock_acpidriver[2] = { | |||
2090 | /* THIS ONE MUST NEVER BE USED FOR DRIVER AUTOLOADING. | 2101 | /* THIS ONE MUST NEVER BE USED FOR DRIVER AUTOLOADING. |
2091 | * We just use it to get notifications of dock hotplug | 2102 | * We just use it to get notifications of dock hotplug |
2092 | * in very old thinkpads */ | 2103 | * in very old thinkpads */ |
2093 | .hid = PCI_ROOT_HID_STRING, | 2104 | .hid = ibm_pci_device_ids, |
2094 | .notify = dock_notify, | 2105 | .notify = dock_notify, |
2095 | .handle = &pci_handle, | 2106 | .handle = &pci_handle, |
2096 | .type = ACPI_SYSTEM_NOTIFY, | 2107 | .type = ACPI_SYSTEM_NOTIFY, |
@@ -2149,7 +2160,8 @@ static int __init dock_init2(struct ibm_init_struct *iibm) | |||
2149 | static void dock_notify(struct ibm_struct *ibm, u32 event) | 2160 | static void dock_notify(struct ibm_struct *ibm, u32 event) |
2150 | { | 2161 | { |
2151 | int docked = dock_docked(); | 2162 | int docked = dock_docked(); |
2152 | int pci = ibm->acpi->hid && strstr(ibm->acpi->hid, PCI_ROOT_HID_STRING); | 2163 | int pci = ibm->acpi->hid && ibm->acpi->device && |
2164 | acpi_match_device_ids(ibm->acpi->device, ibm_pci_device_ids); | ||
2153 | 2165 | ||
2154 | if (event == 1 && !pci) /* 570 */ | 2166 | if (event == 1 && !pci) /* 570 */ |
2155 | acpi_bus_generate_event(ibm->acpi->device, event, 1); /* button */ | 2167 | acpi_bus_generate_event(ibm->acpi->device, event, 1); /* button */ |
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h index b7a4a888cc8b..88af089d6494 100644 --- a/drivers/misc/thinkpad_acpi.h +++ b/drivers/misc/thinkpad_acpi.h | |||
@@ -193,7 +193,7 @@ static void thinkpad_acpi_module_exit(void); | |||
193 | struct ibm_struct; | 193 | struct ibm_struct; |
194 | 194 | ||
195 | struct tp_acpi_drv_struct { | 195 | struct tp_acpi_drv_struct { |
196 | char *hid; | 196 | const struct acpi_device_id *hid; |
197 | struct acpi_driver *driver; | 197 | struct acpi_driver *driver; |
198 | 198 | ||
199 | void (*notify) (struct ibm_struct *, u32); | 199 | void (*notify) (struct ibm_struct *, u32); |
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 c95485398687..fba319d6fcc8 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 7b696cd66dc5..c6e132d7c0f7 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h | |||
@@ -12,7 +12,7 @@ extern int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | |||
12 | resource_size_t, resource_size_t), | 12 | resource_size_t, resource_size_t), |
13 | void *alignf_data); | 13 | void *alignf_data); |
14 | /* Firmware callbacks */ | 14 | /* Firmware callbacks */ |
15 | extern int (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); | 15 | extern pci_power_t (*platform_pci_choose_state)(struct pci_dev *dev, pm_message_t state); |
16 | extern int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t state); | 16 | extern int (*platform_pci_set_power_state)(struct pci_dev *dev, pci_power_t state); |
17 | 17 | ||
18 | extern int pci_user_read_config_byte(struct pci_dev *dev, int where, u8 *val); | 18 | 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 a00548799e98..fcd32ac575c3 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -21,7 +21,10 @@ | |||
21 | 21 | ||
22 | #include <linux/acpi.h> | 22 | #include <linux/acpi.h> |
23 | #include <linux/pnp.h> | 23 | #include <linux/pnp.h> |
24 | #include <linux/mod_devicetable.h> | ||
24 | #include <acpi/acpi_bus.h> | 25 | #include <acpi/acpi_bus.h> |
26 | #include <acpi/actypes.h> | ||
27 | |||
25 | #include "pnpacpi.h" | 28 | #include "pnpacpi.h" |
26 | 29 | ||
27 | static int num = 0; | 30 | static int num = 0; |
@@ -33,15 +36,17 @@ static int num = 0; | |||
33 | * have irqs (PIC, Timer) because we call acpi_register_gsi. | 36 | * have irqs (PIC, Timer) because we call acpi_register_gsi. |
34 | * Finaly only devices that have a CRS method need to be in this list. | 37 | * Finaly only devices that have a CRS method need to be in this list. |
35 | */ | 38 | */ |
36 | static char __initdata excluded_id_list[] = | 39 | static __initdata struct acpi_device_id excluded_id_list[] ={ |
37 | "PNP0C09," /* EC */ | 40 | {"PNP0C09", 0}, /* EC */ |
38 | "PNP0C0F," /* Link device */ | 41 | {"PNP0C0F", 0}, /* Link device */ |
39 | "PNP0000," /* PIC */ | 42 | {"PNP0000", 0}, /* PIC */ |
40 | "PNP0100," /* Timer */ | 43 | {"PNP0100", 0}, /* Timer */ |
41 | ; | 44 | {"", 0}, |
45 | }; | ||
46 | |||
42 | static inline int is_exclusive_device(struct acpi_device *dev) | 47 | static inline int is_exclusive_device(struct acpi_device *dev) |
43 | { | 48 | { |
44 | return (!acpi_match_ids(dev, excluded_id_list)); | 49 | return (!acpi_match_device_ids(dev, excluded_id_list)); |
45 | } | 50 | } |
46 | 51 | ||
47 | /* | 52 | /* |
@@ -119,11 +124,25 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev) | |||
119 | return ACPI_FAILURE(status) ? -ENODEV : 0; | 124 | return ACPI_FAILURE(status) ? -ENODEV : 0; |
120 | } | 125 | } |
121 | 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 | |||
122 | static struct pnp_protocol pnpacpi_protocol = { | 139 | static struct pnp_protocol pnpacpi_protocol = { |
123 | .name = "Plug and Play ACPI", | 140 | .name = "Plug and Play ACPI", |
124 | .get = pnpacpi_get_resources, | 141 | .get = pnpacpi_get_resources, |
125 | .set = pnpacpi_set_resources, | 142 | .set = pnpacpi_set_resources, |
126 | .disable = pnpacpi_disable_resources, | 143 | .disable = pnpacpi_disable_resources, |
144 | .suspend = pnpacpi_suspend, | ||
145 | .resume = pnpacpi_resume, | ||
127 | }; | 146 | }; |
128 | 147 | ||
129 | static int __init pnpacpi_add_device(struct acpi_device *device) | 148 | static int __init pnpacpi_add_device(struct acpi_device *device) |