mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
PCI: Afford direct-complete to devices with non-standard PM
There are devices not power-manageable by the platform, but still able to runtime suspend to D3cold with a non-standard mechanism. One example is laptop hybrid graphics where the discrete GPU and its built-in HDA controller are power-managed either with a _DSM (AMD PowerXpress, Nvidia Optimus) or a separate gmux controller (MacBook Pro). Another example is Thunderbolt on Macs which is power-managed with custom ACPI methods. When putting the system to sleep, we currently handle such devices improperly by transitioning them from D3cold to D3hot (the default power state defined at the top of pci_target_state()). This wastes energy and prolongs the suspend sequence (powering up the Thunderbolt controller takes 2 seconds). Avoid that by assuming that a non-standard PM mechanism is at work if the device is not platform-power-manageable but currently in D3cold. If the device is wakeup enabled, we might still have to wake it up from D3cold if PME cannot be signaled from that power state. The check for devices without PM capability comes before the check for D3cold since such devices could in theory also be powered down by non-standard means and should then be afforded direct-complete as well. Signed-off-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
29b4817d40
commit
4132a577a0
@ -1959,9 +1959,22 @@ static pci_power_t pci_target_state(struct pci_dev *dev)
|
||||
default:
|
||||
target_state = state;
|
||||
}
|
||||
} else if (!dev->pm_cap) {
|
||||
|
||||
return target_state;
|
||||
}
|
||||
|
||||
if (!dev->pm_cap)
|
||||
target_state = PCI_D0;
|
||||
} else if (device_may_wakeup(&dev->dev)) {
|
||||
|
||||
/*
|
||||
* If the device is in D3cold even though it's not power-manageable by
|
||||
* the platform, it may have been powered down by non-standard means.
|
||||
* Best to let it slumber.
|
||||
*/
|
||||
if (dev->current_state == PCI_D3cold)
|
||||
target_state = PCI_D3cold;
|
||||
|
||||
if (device_may_wakeup(&dev->dev)) {
|
||||
/*
|
||||
* Find the deepest state from which the device can generate
|
||||
* wake-up events, make it the target state and enable device
|
||||
|
Loading…
Reference in New Issue
Block a user