• Rafael J. Wysocki's avatar
    ACPI / PM: Rework device power management to follow ACPI 6 · 20dacb71
    Rafael J. Wysocki authored
    The ACPI 6 specification has made some changes in the device power
    management area.  In particular:
    
     * The D3hot power state is now supposed to be always available
       (instead of D3cold) and D3cold is only regarded as valid if the
       _PR3 object is present for the given device.
    
     * The required ordering of transitions into power states deeper than
       D0 is now such that for a transition into state Dx the _PSx method
       is supposed to be executed first, if present, and the states of
       the power resources the device depends on are supposed to be
       changed after that.
    
     * It is now explicitly forbidden to transition devices from
       lower-power (deeper) into higher-power (shallower) power states
       other than D0.
    
    Those changes have been made so the specification reflects the
    Windows' device power management code that the vast majority of
    systems using ACPI is validated against.
    
    To avoid artificial differences in ACPI device power management
    between Windows and Linux, modify the ACPI device power management
    code to follow the new specification.  Add comments explaining the
    code flow in some unclear places.
    
    This only may affect some real corner cases in which the OS behavior
    expected by the firmware is different from the Windows one, but that's
    quite unlikely.  The transition ordering change affects transitions
    to D1 and D2 which are rarely used (if at all) and into D3hot and
    D3cold for devices actually having _PR3, but those are likely to
    be validated against Windows anyway.  The other changes may affect
    code calling acpi_device_get_power() or acpi_device_update_power()
    where ACPI_STATE_D3_HOT may be returned instead of ACPI_STATE_D3_COLD
    (that's why the ACPI fan driver needs to be updated too) and since
    transitions into ACPI_STATE_D3_HOT may remove power now, it is better
    to avoid this one in acpi_pm_device_sleep_state() if the "no power
    off" PM QoS flag is set.
    
    The only existing user of acpi_device_can_poweroff() really cares
    about the case when _PR3 is present, so the change in that function
    should not cause any problems to happen too.
    
    A plus is that PCI_D3hot can be mapped to ACPI_STATE_D3_HOT
    now and the compatibility with older systems should be covered
    automatically.
    
    In any case, if any real problems result from this, it still will
    be better to follow the Windows' behavior (which now is reflected
    by the specification too) in general and handle the cases when it
    doesn't work via quirks.
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    20dacb71
fan.c 10.5 KB