mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
ACPI / PM: Change the way power transitions to D3cold are carried out
During power transitions into D3cold from any shallower power states we are supposed to transition the device into D3hot and remove power from it afterward, but the current code in acpi_device_set_power() doesn't work this way. At the same time, though, we need to be careful enough to preserve backwards compatibility for systems that don't distinguish between D3hot and D3cold (e.g. designed before ACPI 4). Modify acpi_device_set_power() so that it works in accordance with the expectations in both cases. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
0596a52b83
commit
ff0c41942f
1 changed files with 10 additions and 2 deletions
|
@ -270,6 +270,7 @@ int acpi_device_set_power(struct acpi_device *device, int state)
|
|||
int result = 0;
|
||||
acpi_status status = AE_OK;
|
||||
char object_name[5] = { '_', 'P', 'S', '0' + state, '\0' };
|
||||
bool cut_power = false;
|
||||
|
||||
if (!device || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD))
|
||||
return -EINVAL;
|
||||
|
@ -294,9 +295,13 @@ int acpi_device_set_power(struct acpi_device *device, int state)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
/* For D3cold we should execute _PS3, not _PS4. */
|
||||
if (state == ACPI_STATE_D3_COLD)
|
||||
/* For D3cold we should first transition into D3hot. */
|
||||
if (state == ACPI_STATE_D3_COLD
|
||||
&& device->power.states[ACPI_STATE_D3_COLD].flags.os_accessible) {
|
||||
state = ACPI_STATE_D3_HOT;
|
||||
object_name[3] = '3';
|
||||
cut_power = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Transition Power
|
||||
|
@ -341,6 +346,9 @@ int acpi_device_set_power(struct acpi_device *device, int state)
|
|||
}
|
||||
}
|
||||
|
||||
if (cut_power)
|
||||
result = acpi_power_transition(device, ACPI_STATE_D3_COLD);
|
||||
|
||||
end:
|
||||
if (result)
|
||||
printk(KERN_WARNING PREFIX
|
||||
|
|
Loading…
Reference in a new issue