aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-17 08:11:07 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-01-17 08:11:07 -0500
commit0596a52b8357b25185e06af32973225baeb7196a (patch)
tree90d1d8572a390c47109bf2fe8da545a60f2f1032 /drivers
parente88c9c603b2ad0cd0fbe90afedba3f1becbbeb79 (diff)
ACPI: Use system level attribute of wakeup power resources
The system level attribute of ACPI power resources is the lowest system sleep level (S0, S2 etc.) in which the given resource can be "on" (ACPI 5.0, Section 7.1). On the other hand, wakeup power resources have to be "on" for devices depending on them to be able to signal wakeup. Therefore devices cannot wake up the system from sleep states higher than the minimum of the system level attributes of their wakeup power resources. Use the wakeup power resources' system level values to get the deepest system sleep state (highest system sleep level) the given device can wake up the system from. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/internal.h1
-rw-r--r--drivers/acpi/power.c14
-rw-r--r--drivers/acpi/scan.c11
3 files changed, 26 insertions, 0 deletions
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 8a6c67c9da42..07f61dbd8136 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -55,6 +55,7 @@ int acpi_extract_power_resources(union acpi_object *package, unsigned int start,
55 struct list_head *list); 55 struct list_head *list);
56int acpi_add_power_resource(acpi_handle handle); 56int acpi_add_power_resource(acpi_handle handle);
57void acpi_power_add_remove_device(struct acpi_device *adev, bool add); 57void acpi_power_add_remove_device(struct acpi_device *adev, bool add);
58int acpi_power_min_system_level(struct list_head *list);
58int acpi_device_sleep_wake(struct acpi_device *dev, 59int acpi_device_sleep_wake(struct acpi_device *dev,
59 int enable, int sleep_state, int dev_state); 60 int enable, int sleep_state, int dev_state);
60int acpi_power_get_inferred_state(struct acpi_device *device, int *state); 61int acpi_power_get_inferred_state(struct acpi_device *device, int *state);
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index 1600f753fafe..089a7c39348f 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -429,6 +429,20 @@ void acpi_power_add_remove_device(struct acpi_device *adev, bool add)
429 } 429 }
430} 430}
431 431
432int acpi_power_min_system_level(struct list_head *list)
433{
434 struct acpi_power_resource_entry *entry;
435 int system_level = 5;
436
437 list_for_each_entry(entry, list, node) {
438 struct acpi_power_resource *resource = entry->resource;
439
440 if (system_level > resource->system_level)
441 system_level = resource->system_level;
442 }
443 return system_level;
444}
445
432/* -------------------------------------------------------------------------- 446/* --------------------------------------------------------------------------
433 Device Power Management 447 Device Power Management
434 -------------------------------------------------------------------------- */ 448 -------------------------------------------------------------------------- */
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 0b6a6b4febd6..1fc57a349a3c 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -950,6 +950,17 @@ static int acpi_bus_extract_wakeup_device_power_package(acpi_handle handle,
950 if (err) 950 if (err)
951 goto out; 951 goto out;
952 952
953 if (!list_empty(&wakeup->resources)) {
954 int sleep_state;
955
956 sleep_state = acpi_power_min_system_level(&wakeup->resources);
957 if (sleep_state < wakeup->sleep_state) {
958 acpi_handle_warn(handle, "Overriding _PRW sleep state "
959 "(S%d) by S%d from power resources\n",
960 (int)wakeup->sleep_state, sleep_state);
961 wakeup->sleep_state = sleep_state;
962 }
963 }
953 acpi_setup_gpe_for_wake(handle, wakeup->gpe_device, wakeup->gpe_number); 964 acpi_setup_gpe_for_wake(handle, wakeup->gpe_device, wakeup->gpe_number);
954 965
955 out: 966 out: