diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/Kconfig | 58 | ||||
-rw-r--r-- | drivers/acpi/ac.c | 9 | ||||
-rw-r--r-- | drivers/acpi/acpi_memhotplug.c | 8 | ||||
-rw-r--r-- | drivers/acpi/asus_acpi.c | 11 | ||||
-rw-r--r-- | drivers/acpi/battery.c | 9 | ||||
-rw-r--r-- | drivers/acpi/button.c | 12 | ||||
-rw-r--r-- | drivers/acpi/container.c | 10 | ||||
-rw-r--r-- | drivers/acpi/ec.c | 8 | ||||
-rw-r--r-- | drivers/acpi/events/evrgnini.c | 2 | ||||
-rw-r--r-- | drivers/acpi/fan.c | 8 | ||||
-rw-r--r-- | drivers/acpi/namespace/nsxfeval.c | 2 | ||||
-rw-r--r-- | drivers/acpi/pci_link.c | 9 | ||||
-rw-r--r-- | drivers/acpi/pci_root.c | 9 | ||||
-rw-r--r-- | drivers/acpi/power.c | 8 | ||||
-rw-r--r-- | drivers/acpi/processor_core.c | 8 | ||||
-rw-r--r-- | drivers/acpi/processor_throttling.c | 59 | ||||
-rw-r--r-- | drivers/acpi/sbs.c | 10 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 156 | ||||
-rw-r--r-- | drivers/acpi/sleep/Makefile | 2 | ||||
-rw-r--r-- | drivers/acpi/sleep/main.c | 244 | ||||
-rw-r--r-- | drivers/acpi/sleep/proc.c | 24 | ||||
-rw-r--r-- | drivers/acpi/sleep/sleep.h | 2 | ||||
-rw-r--r-- | drivers/acpi/sleep/wakeup.c | 2 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 8 | ||||
-rw-r--r-- | drivers/acpi/utilities/uteval.c | 4 | ||||
-rw-r--r-- | drivers/acpi/video.c | 8 |
26 files changed, 479 insertions, 211 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 408b45168aba..f1372de4ce79 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -43,50 +43,30 @@ menuconfig ACPI | |||
43 | if ACPI | 43 | if ACPI |
44 | 44 | ||
45 | config ACPI_SLEEP | 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 | 46 | bool |
67 | depends on ACPI_SLEEP && PROC_FS | 47 | depends on PM_SLEEP |
68 | default y | 48 | default y |
69 | 49 | ||
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 | 50 | config ACPI_PROCFS |
79 | bool "Procfs interface (deprecated)" | 51 | bool "Deprecated /proc/acpi files" |
80 | default y | 52 | depends on PROC_FS |
81 | ---help--- | 53 | ---help--- |
82 | The Procfs interface for ACPI is made optional for backward compatibility. | 54 | For backwards compatibility, this option allows |
83 | As the same functions are duplicated in the sysfs interface | 55 | depricated /proc/acpi/ files to exist, even when |
84 | and this proc interface will be removed some time later, | 56 | they have been replaced by functions in /sys. |
85 | it's marked as deprecated. | 57 | The deprecated files (and their replacements) include: |
86 | ( /proc/acpi/debug_layer && debug_level are deprecated by | 58 | |
87 | /sys/module/acpi/parameters/debug_layer && debug_level. | 59 | /proc/acpi/sleep (/sys/power/state) |
88 | /proc/acpi/info is deprecated by | 60 | /proc/acpi/info (/sys/modules/acpi/parameters/acpica_version) |
89 | /sys/module/acpi/parameters/acpica_version ) | 61 | /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT) |
62 | /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) | ||
63 | /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) | ||
64 | /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level) | ||
65 | |||
66 | This option has no effect on /proc/acpi/ files | ||
67 | and functions which do not yet exist in /sys. | ||
68 | |||
69 | Say N to delete /proc/acpi/ files that have moved to /sys/ | ||
90 | 70 | ||
91 | config ACPI_AC | 71 | config ACPI_AC |
92 | tristate "AC Adapter" | 72 | 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..195a4f69c0f7 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-$(CONFIG_ACPI_SLEEP) += main.o |
3 | obj-$(CONFIG_ACPI_SLEEP_PROC_FS) += proc.o | 3 | obj-$(CONFIG_ACPI_SLEEP) += 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..e8cff5dd4cbc 100644 --- a/drivers/acpi/sleep/main.c +++ b/drivers/acpi/sleep/main.c | |||
@@ -21,6 +21,9 @@ | |||
21 | 21 | ||
22 | u8 sleep_states[ACPI_S_STATE_COUNT]; | 22 | u8 sleep_states[ACPI_S_STATE_COUNT]; |
23 | 23 | ||
24 | static u32 acpi_target_sleep_state = ACPI_STATE_S0; | ||
25 | |||
26 | #ifdef CONFIG_SUSPEND | ||
24 | static struct pm_ops acpi_pm_ops; | 27 | static struct pm_ops acpi_pm_ops; |
25 | 28 | ||
26 | extern void do_suspend_lowlevel(void); | 29 | extern void do_suspend_lowlevel(void); |
@@ -35,34 +38,49 @@ static u32 acpi_suspend_states[] = { | |||
35 | static int init_8259A_after_S1; | 38 | static int init_8259A_after_S1; |
36 | 39 | ||
37 | /** | 40 | /** |
41 | * acpi_pm_set_target - Set the target system sleep state to the state | ||
42 | * associated with given @pm_state, if supported. | ||
43 | */ | ||
44 | |||
45 | static int acpi_pm_set_target(suspend_state_t pm_state) | ||
46 | { | ||
47 | u32 acpi_state = acpi_suspend_states[pm_state]; | ||
48 | int error = 0; | ||
49 | |||
50 | if (sleep_states[acpi_state]) { | ||
51 | acpi_target_sleep_state = acpi_state; | ||
52 | } else { | ||
53 | printk(KERN_ERR "ACPI does not support this state: %d\n", | ||
54 | pm_state); | ||
55 | error = -ENOSYS; | ||
56 | } | ||
57 | return error; | ||
58 | } | ||
59 | |||
60 | /** | ||
38 | * acpi_pm_prepare - Do preliminary suspend work. | 61 | * acpi_pm_prepare - Do preliminary suspend work. |
39 | * @pm_state: suspend state we're entering. | 62 | * @pm_state: ignored |
40 | * | 63 | * |
41 | * Make sure we support the state. If we do, and we need it, set the | 64 | * If necessary, set the firmware waking vector and do arch-specific |
42 | * firmware waking vector and do arch-specific nastiness to get the | 65 | * nastiness to get the wakeup code to the waking vector. |
43 | * wakeup code to the waking vector. | ||
44 | */ | 66 | */ |
45 | 67 | ||
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) | 68 | static int acpi_pm_prepare(suspend_state_t pm_state) |
50 | { | 69 | { |
51 | u32 acpi_state = acpi_suspend_states[pm_state]; | 70 | int error = acpi_sleep_prepare(acpi_target_sleep_state); |
52 | 71 | ||
53 | if (!sleep_states[acpi_state]) { | 72 | if (error) |
54 | printk("acpi_pm_prepare does not support %d \n", pm_state); | 73 | acpi_target_sleep_state = ACPI_STATE_S0; |
55 | return -EPERM; | 74 | |
56 | } | 75 | return error; |
57 | return acpi_sleep_prepare(acpi_state); | ||
58 | } | 76 | } |
59 | 77 | ||
60 | /** | 78 | /** |
61 | * acpi_pm_enter - Actually enter a sleep state. | 79 | * acpi_pm_enter - Actually enter a sleep state. |
62 | * @pm_state: State we're entering. | 80 | * @pm_state: ignored |
63 | * | 81 | * |
64 | * Flush caches and go to sleep. For STR or STD, we have to call | 82 | * 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(). | 83 | * assembly, which in turn call acpi_enter_sleep_state(). |
66 | * It's unfortunate, but it works. Please fix if you're feeling frisky. | 84 | * It's unfortunate, but it works. Please fix if you're feeling frisky. |
67 | */ | 85 | */ |
68 | 86 | ||
@@ -70,31 +88,31 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
70 | { | 88 | { |
71 | acpi_status status = AE_OK; | 89 | acpi_status status = AE_OK; |
72 | unsigned long flags = 0; | 90 | unsigned long flags = 0; |
73 | u32 acpi_state = acpi_suspend_states[pm_state]; | 91 | u32 acpi_state = acpi_target_sleep_state; |
74 | 92 | ||
75 | ACPI_FLUSH_CPU_CACHE(); | 93 | ACPI_FLUSH_CPU_CACHE(); |
76 | 94 | ||
77 | /* Do arch specific saving of state. */ | 95 | /* Do arch specific saving of state. */ |
78 | if (pm_state > PM_SUSPEND_STANDBY) { | 96 | if (acpi_state == ACPI_STATE_S3) { |
79 | int error = acpi_save_state_mem(); | 97 | int error = acpi_save_state_mem(); |
80 | if (error) | 98 | |
99 | if (error) { | ||
100 | acpi_target_sleep_state = ACPI_STATE_S0; | ||
81 | return error; | 101 | return error; |
102 | } | ||
82 | } | 103 | } |
83 | 104 | ||
84 | local_irq_save(flags); | 105 | local_irq_save(flags); |
85 | acpi_enable_wakeup_device(acpi_state); | 106 | acpi_enable_wakeup_device(acpi_state); |
86 | switch (pm_state) { | 107 | switch (acpi_state) { |
87 | case PM_SUSPEND_STANDBY: | 108 | case ACPI_STATE_S1: |
88 | barrier(); | 109 | barrier(); |
89 | status = acpi_enter_sleep_state(acpi_state); | 110 | status = acpi_enter_sleep_state(acpi_state); |
90 | break; | 111 | break; |
91 | 112 | ||
92 | case PM_SUSPEND_MEM: | 113 | case ACPI_STATE_S3: |
93 | do_suspend_lowlevel(); | 114 | do_suspend_lowlevel(); |
94 | break; | 115 | break; |
95 | |||
96 | default: | ||
97 | return -EINVAL; | ||
98 | } | 116 | } |
99 | 117 | ||
100 | /* ACPI 3.0 specs (P62) says that it's the responsabilty | 118 | /* ACPI 3.0 specs (P62) says that it's the responsabilty |
@@ -107,12 +125,8 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
107 | local_irq_restore(flags); | 125 | local_irq_restore(flags); |
108 | printk(KERN_DEBUG "Back to C!\n"); | 126 | printk(KERN_DEBUG "Back to C!\n"); |
109 | 127 | ||
110 | /* restore processor state | 128 | /* restore processor state */ |
111 | * We should only be here if we're coming back from STR or STD. | 129 | 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(); | 130 | acpi_restore_state_mem(); |
117 | 131 | ||
118 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; | 132 | return ACPI_SUCCESS(status) ? 0 : -EFAULT; |
@@ -120,7 +134,7 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
120 | 134 | ||
121 | /** | 135 | /** |
122 | * acpi_pm_finish - Finish up suspend sequence. | 136 | * acpi_pm_finish - Finish up suspend sequence. |
123 | * @pm_state: State we're coming out of. | 137 | * @pm_state: ignored |
124 | * | 138 | * |
125 | * This is called after we wake back up (or if entering the sleep state | 139 | * This is called after we wake back up (or if entering the sleep state |
126 | * failed). | 140 | * failed). |
@@ -128,7 +142,7 @@ static int acpi_pm_enter(suspend_state_t pm_state) | |||
128 | 142 | ||
129 | static int acpi_pm_finish(suspend_state_t pm_state) | 143 | static int acpi_pm_finish(suspend_state_t pm_state) |
130 | { | 144 | { |
131 | u32 acpi_state = acpi_suspend_states[pm_state]; | 145 | u32 acpi_state = acpi_target_sleep_state; |
132 | 146 | ||
133 | acpi_leave_sleep_state(acpi_state); | 147 | acpi_leave_sleep_state(acpi_state); |
134 | acpi_disable_wakeup_device(acpi_state); | 148 | acpi_disable_wakeup_device(acpi_state); |
@@ -136,28 +150,17 @@ static int acpi_pm_finish(suspend_state_t pm_state) | |||
136 | /* reset firmware waking vector */ | 150 | /* reset firmware waking vector */ |
137 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); | 151 | acpi_set_firmware_waking_vector((acpi_physical_address) 0); |
138 | 152 | ||
153 | acpi_target_sleep_state = ACPI_STATE_S0; | ||
154 | |||
155 | #ifdef CONFIG_X86 | ||
139 | if (init_8259A_after_S1) { | 156 | if (init_8259A_after_S1) { |
140 | printk("Broken toshiba laptop -> kicking interrupts\n"); | 157 | printk("Broken toshiba laptop -> kicking interrupts\n"); |
141 | init_8259A(0); | 158 | init_8259A(0); |
142 | } | 159 | } |
160 | #endif | ||
143 | return 0; | 161 | return 0; |
144 | } | 162 | } |
145 | 163 | ||
146 | int acpi_suspend(u32 acpi_state) | ||
147 | { | ||
148 | suspend_state_t states[] = { | ||
149 | [1] = PM_SUSPEND_STANDBY, | ||
150 | [3] = PM_SUSPEND_MEM, | ||
151 | [5] = PM_SUSPEND_MAX | ||
152 | }; | ||
153 | |||
154 | if (acpi_state < 6 && states[acpi_state]) | ||
155 | return pm_suspend(states[acpi_state]); | ||
156 | if (acpi_state == 4) | ||
157 | return hibernate(); | ||
158 | return -EINVAL; | ||
159 | } | ||
160 | |||
161 | static int acpi_pm_state_valid(suspend_state_t pm_state) | 164 | static int acpi_pm_state_valid(suspend_state_t pm_state) |
162 | { | 165 | { |
163 | u32 acpi_state; | 166 | u32 acpi_state; |
@@ -176,12 +179,34 @@ static int acpi_pm_state_valid(suspend_state_t pm_state) | |||
176 | 179 | ||
177 | static struct pm_ops acpi_pm_ops = { | 180 | static struct pm_ops acpi_pm_ops = { |
178 | .valid = acpi_pm_state_valid, | 181 | .valid = acpi_pm_state_valid, |
182 | .set_target = acpi_pm_set_target, | ||
179 | .prepare = acpi_pm_prepare, | 183 | .prepare = acpi_pm_prepare, |
180 | .enter = acpi_pm_enter, | 184 | .enter = acpi_pm_enter, |
181 | .finish = acpi_pm_finish, | 185 | .finish = acpi_pm_finish, |
182 | }; | 186 | }; |
183 | 187 | ||
184 | #ifdef CONFIG_SOFTWARE_SUSPEND | 188 | /* |
189 | * Toshiba fails to preserve interrupts over S1, reinitialization | ||
190 | * of 8259 is needed after S1 resume. | ||
191 | */ | ||
192 | static int __init init_ints_after_s1(struct dmi_system_id *d) | ||
193 | { | ||
194 | printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident); | ||
195 | init_8259A_after_S1 = 1; | ||
196 | return 0; | ||
197 | } | ||
198 | |||
199 | static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | ||
200 | { | ||
201 | .callback = init_ints_after_s1, | ||
202 | .ident = "Toshiba Satellite 4030cdt", | ||
203 | .matches = {DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),}, | ||
204 | }, | ||
205 | {}, | ||
206 | }; | ||
207 | #endif /* CONFIG_SUSPEND */ | ||
208 | |||
209 | #ifdef CONFIG_HIBERNATION | ||
185 | static int acpi_hibernation_prepare(void) | 210 | static int acpi_hibernation_prepare(void) |
186 | { | 211 | { |
187 | return acpi_sleep_prepare(ACPI_STATE_S4); | 212 | return acpi_sleep_prepare(ACPI_STATE_S4); |
@@ -233,41 +258,114 @@ static struct hibernation_ops acpi_hibernation_ops = { | |||
233 | .pre_restore = acpi_hibernation_pre_restore, | 258 | .pre_restore = acpi_hibernation_pre_restore, |
234 | .restore_cleanup = acpi_hibernation_restore_cleanup, | 259 | .restore_cleanup = acpi_hibernation_restore_cleanup, |
235 | }; | 260 | }; |
236 | #endif /* CONFIG_SOFTWARE_SUSPEND */ | 261 | #endif /* CONFIG_HIBERNATION */ |
237 | 262 | ||
238 | /* | 263 | int acpi_suspend(u32 acpi_state) |
239 | * Toshiba fails to preserve interrupts over S1, reinitialization | ||
240 | * of 8259 is needed after S1 resume. | ||
241 | */ | ||
242 | static int __init init_ints_after_s1(struct dmi_system_id *d) | ||
243 | { | 264 | { |
244 | printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident); | 265 | suspend_state_t states[] = { |
245 | init_8259A_after_S1 = 1; | 266 | [1] = PM_SUSPEND_STANDBY, |
246 | return 0; | 267 | [3] = PM_SUSPEND_MEM, |
268 | [5] = PM_SUSPEND_MAX | ||
269 | }; | ||
270 | |||
271 | if (acpi_state < 6 && states[acpi_state]) | ||
272 | return pm_suspend(states[acpi_state]); | ||
273 | if (acpi_state == 4) | ||
274 | return hibernate(); | ||
275 | return -EINVAL; | ||
247 | } | 276 | } |
248 | 277 | ||
249 | static struct dmi_system_id __initdata acpisleep_dmi_table[] = { | 278 | /** |
250 | { | 279 | * acpi_pm_device_sleep_state - return preferred power state of ACPI device |
251 | .callback = init_ints_after_s1, | 280 | * in the system sleep state given by %acpi_target_sleep_state |
252 | .ident = "Toshiba Satellite 4030cdt", | 281 | * @dev: device to examine |
253 | .matches = {DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),}, | 282 | * @wake: if set, the device should be able to wake up the system |
254 | }, | 283 | * @d_min_p: used to store the upper limit of allowed states range |
255 | {}, | 284 | * Return value: preferred power state of the device on success, -ENODEV on |
256 | }; | 285 | * failure (ie. if there's no 'struct acpi_device' for @dev) |
286 | * | ||
287 | * Find the lowest power (highest number) ACPI device power state that | ||
288 | * device @dev can be in while the system is in the sleep state represented | ||
289 | * by %acpi_target_sleep_state. If @wake is nonzero, the device should be | ||
290 | * able to wake up the system from this sleep state. If @d_min_p is set, | ||
291 | * the highest power (lowest number) device power state of @dev allowed | ||
292 | * in this system sleep state is stored at the location pointed to by it. | ||
293 | * | ||
294 | * The caller must ensure that @dev is valid before using this function. | ||
295 | * The caller is also responsible for figuring out if the device is | ||
296 | * supposed to be able to wake up the system and passing this information | ||
297 | * via @wake. | ||
298 | */ | ||
299 | |||
300 | int acpi_pm_device_sleep_state(struct device *dev, int wake, int *d_min_p) | ||
301 | { | ||
302 | acpi_handle handle = DEVICE_ACPI_HANDLE(dev); | ||
303 | struct acpi_device *adev; | ||
304 | char acpi_method[] = "_SxD"; | ||
305 | unsigned long d_min, d_max; | ||
306 | |||
307 | if (!handle || ACPI_FAILURE(acpi_bus_get_device(handle, &adev))) { | ||
308 | printk(KERN_ERR "ACPI handle has no context!\n"); | ||
309 | return -ENODEV; | ||
310 | } | ||
311 | |||
312 | acpi_method[2] = '0' + acpi_target_sleep_state; | ||
313 | /* | ||
314 | * If the sleep state is S0, we will return D3, but if the device has | ||
315 | * _S0W, we will use the value from _S0W | ||
316 | */ | ||
317 | d_min = ACPI_STATE_D0; | ||
318 | d_max = ACPI_STATE_D3; | ||
319 | |||
320 | /* | ||
321 | * If present, _SxD methods return the minimum D-state (highest power | ||
322 | * state) we can use for the corresponding S-states. Otherwise, the | ||
323 | * minimum D-state is D0 (ACPI 3.x). | ||
324 | * | ||
325 | * NOTE: We rely on acpi_evaluate_integer() not clobbering the integer | ||
326 | * provided -- that's our fault recovery, we ignore retval. | ||
327 | */ | ||
328 | if (acpi_target_sleep_state > ACPI_STATE_S0) | ||
329 | acpi_evaluate_integer(handle, acpi_method, NULL, &d_min); | ||
330 | |||
331 | /* | ||
332 | * If _PRW says we can wake up the system from the target sleep state, | ||
333 | * the D-state returned by _SxD is sufficient for that (we assume a | ||
334 | * wakeup-aware driver if wake is set). Still, if _SxW exists | ||
335 | * (ACPI 3.x), it should return the maximum (lowest power) D-state that | ||
336 | * can wake the system. _S0W may be valid, too. | ||
337 | */ | ||
338 | if (acpi_target_sleep_state == ACPI_STATE_S0 || | ||
339 | (wake && adev->wakeup.state.enabled && | ||
340 | adev->wakeup.sleep_state <= acpi_target_sleep_state)) { | ||
341 | acpi_method[3] = 'W'; | ||
342 | acpi_evaluate_integer(handle, acpi_method, NULL, &d_max); | ||
343 | /* Sanity check */ | ||
344 | if (d_max < d_min) | ||
345 | d_min = d_max; | ||
346 | } | ||
347 | |||
348 | if (d_min_p) | ||
349 | *d_min_p = d_min; | ||
350 | return d_max; | ||
351 | } | ||
257 | 352 | ||
258 | int __init acpi_sleep_init(void) | 353 | int __init acpi_sleep_init(void) |
259 | { | 354 | { |
355 | acpi_status status; | ||
356 | u8 type_a, type_b; | ||
357 | #ifdef CONFIG_SUSPEND | ||
260 | int i = 0; | 358 | int i = 0; |
261 | 359 | ||
262 | dmi_check_system(acpisleep_dmi_table); | 360 | dmi_check_system(acpisleep_dmi_table); |
361 | #endif | ||
263 | 362 | ||
264 | if (acpi_disabled) | 363 | if (acpi_disabled) |
265 | return 0; | 364 | return 0; |
266 | 365 | ||
366 | #ifdef CONFIG_SUSPEND | ||
267 | printk(KERN_INFO PREFIX "(supports"); | 367 | printk(KERN_INFO PREFIX "(supports"); |
268 | for (i = 0; i < ACPI_S_STATE_COUNT; i++) { | 368 | for (i = ACPI_STATE_S0; i < ACPI_STATE_S4; i++) { |
269 | acpi_status status; | ||
270 | u8 type_a, type_b; | ||
271 | status = acpi_get_sleep_type_data(i, &type_a, &type_b); | 369 | status = acpi_get_sleep_type_data(i, &type_a, &type_b); |
272 | if (ACPI_SUCCESS(status)) { | 370 | if (ACPI_SUCCESS(status)) { |
273 | sleep_states[i] = 1; | 371 | sleep_states[i] = 1; |
@@ -277,10 +375,14 @@ int __init acpi_sleep_init(void) | |||
277 | printk(")\n"); | 375 | printk(")\n"); |
278 | 376 | ||
279 | pm_set_ops(&acpi_pm_ops); | 377 | pm_set_ops(&acpi_pm_ops); |
378 | #endif | ||
280 | 379 | ||
281 | #ifdef CONFIG_SOFTWARE_SUSPEND | 380 | #ifdef CONFIG_HIBERNATION |
282 | if (sleep_states[ACPI_STATE_S4]) | 381 | status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b); |
382 | if (ACPI_SUCCESS(status)) { | ||
283 | hibernation_set_ops(&acpi_hibernation_ops); | 383 | hibernation_set_ops(&acpi_hibernation_ops); |
384 | sleep_states[ACPI_STATE_S4] = 1; | ||
385 | } | ||
284 | #else | 386 | #else |
285 | sleep_states[ACPI_STATE_S4] = 0; | 387 | sleep_states[ACPI_STATE_S4] = 0; |
286 | #endif | 388 | #endif |
diff --git a/drivers/acpi/sleep/proc.c b/drivers/acpi/sleep/proc.c index 61f1822cc350..66b62b0d3609 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_SLEEP |
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; |
@@ -58,7 +66,7 @@ acpi_system_write_sleep(struct file *file, | |||
58 | goto Done; | 66 | goto Done; |
59 | } | 67 | } |
60 | state = simple_strtoul(str, NULL, 0); | 68 | state = simple_strtoul(str, NULL, 0); |
61 | #ifdef CONFIG_SOFTWARE_SUSPEND | 69 | #ifdef CONFIG_HIBERNATION |
62 | if (state == 4) { | 70 | if (state == 4) { |
63 | error = hibernate(); | 71 | error = hibernate(); |
64 | goto Done; | 72 | goto Done; |
@@ -68,9 +76,9 @@ 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_SLEEP */ |
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) || !defined(CONFIG_X86) |
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 */ |
75 | #else | 83 | #else |
76 | #define HAVE_ACPI_LEGACY_ALARM | 84 | #define HAVE_ACPI_LEGACY_ALARM |
@@ -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_SLEEP |
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_SLEEP */ |
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_SLEEP |
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/sleep.h b/drivers/acpi/sleep/sleep.h index f3e70397a7d6..ff1f8504f497 100644 --- a/drivers/acpi/sleep/sleep.h +++ b/drivers/acpi/sleep/sleep.h | |||
@@ -6,3 +6,5 @@ extern void acpi_enable_wakeup_device_prep(u8 sleep_state); | |||
6 | extern void acpi_enable_wakeup_device(u8 sleep_state); | 6 | extern void acpi_enable_wakeup_device(u8 sleep_state); |
7 | extern void acpi_disable_wakeup_device(u8 sleep_state); | 7 | extern void acpi_disable_wakeup_device(u8 sleep_state); |
8 | extern void acpi_gpe_sleep_prepare(u32 sleep_state); | 8 | extern void acpi_gpe_sleep_prepare(u32 sleep_state); |
9 | |||
10 | extern int acpi_sleep_prepare(u32 acpi_state); | ||
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, |