• Lukas Wunner's avatar
    PCI: Afford direct-complete to devices with non-standard PM · 4132a577
    Lukas Wunner authored
    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: default avatarLukas Wunner <lukas@wunner.de>
    Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    4132a577
pci.c 136 KB