diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-01-22 12:54:38 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-01-22 12:54:38 +0100 |
commit | a2367807b8d2c0aca5afb92fead2537dcd3d10b0 (patch) | |
tree | a6514b303fd5c4814d2dc61f6b6d8305c5e9a6d9 /drivers/acpi/device_pm.c | |
parent | d79beb39922e41083e8bbbb3de084a6ca958e25f (diff) | |
download | op-kernel-dev-a2367807b8d2c0aca5afb92fead2537dcd3d10b0.zip op-kernel-dev-a2367807b8d2c0aca5afb92fead2537dcd3d10b0.tar.gz |
ACPI / PM: Make acpi_bus_init_power() more robust
The ACPI specification requires the _PSC method to be present under
a device object if its power state cannot be inferred from the states
of power resources used by it (ACPI 5, Section 7.6.2). However, it
also requires that (for power states D0-D2 and D3hot) if the _PSn
(n = 0, 1, 2, 3) method is present under the device object, it also
must be executed after the power resources have been set
appropriately for the device to go into power state Dn (D3 means
D3hot in this case). Thus it is not clear from the specification
whether or not the _PSn method should be executed if the initial
configuraion of power resources used by the device indicates power
state Dn and the _PSC method is not present.
The current implementation of acpi_bus_init_power() is based on the
assumption that it should not be necessary to execute _PSn in the
above situation, but experience shows that in fact that assumption
need not be satisfied. For this reason, make acpi_bus_init_power()
always execute _PSn if the initial configuration of device power
resources indicates power state Dn.
Reported-and-tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/device_pm.c')
-rw-r--r-- | drivers/acpi/device_pm.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index 43116cd..c87853f 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -330,13 +330,23 @@ int acpi_bus_init_power(struct acpi_device *device) if (result) return result; - if (device->power.flags.power_resources) + if (state < ACPI_STATE_D3_COLD && device->power.flags.power_resources) { result = acpi_power_on_resources(device, state); + if (result) + return result; - if (!result) - device->power.state = state; + if (device->power.states[state].flags.explicit_set) { + char method[5] = { '_', 'P', 'S', '0' + state, '\0' }; + acpi_status status; - return result; + status = acpi_evaluate_object(device->handle, method, + NULL, NULL); + if (ACPI_FAILURE(status)) + return -ENODEV; + } + } + device->power.state = state; + return 0; } int acpi_bus_update_power(acpi_handle handle, int *state_p) |