• R
    ACPI / sleep: EC-based wakeup from suspend-to-idle on recent systems · 8110dd28
    Rafael J. Wysocki 提交于
    Some recent Dell laptops, including the XPS13 model numbers 9360 and
    9365, cannot be woken up from suspend-to-idle by pressing the power
    button which is unexpected and makes that feature less usable on
    those systems.  Moreover, on the 9365 ACPI S3 (suspend-to-RAM) is
    not expected to be used at all (the OS these systems ship with never
    exercises the ACPI S3 path in the firmware) and suspend-to-idle is
    the only viable system suspend mechanism there.
    
    The reason why the power button wakeup from suspend-to-idle doesn't
    work on those systems is because their power button events are
    signaled by the EC (Embedded Controller), whose GPE (General Purpose
    Event) line is disabled during suspend-to-idle transitions in Linux.
    That is done on purpose, because in general the EC tends to be noisy
    for various reasons (battery and thermal updates and similar, for
    example) and all events signaled by it would kick the CPUs out of
    deep idle states while in suspend-to-idle, which effectively might
    defeat its purpose.
    
    Of course, on the Dell systems in question the EC GPE must be enabled
    during suspend-to-idle transitions for the button press events to
    be signaled while suspended at all, but fortunately there is a way
    out of this puzzle.
    
    First of all, those systems have the ACPI_FADT_LOW_POWER_S0 flag set
    in their ACPI tables, which means that the OS is expected to prefer
    the "low power S0 idle" system state over ACPI S3 on them.  That
    causes the most recent versions of other OSes to simply ignore ACPI
    S3 on those systems, so it is reasonable to expect that it should not
    be necessary to block GPEs during suspend-to-idle on them.
    
    Second, in addition to that, the systems in question provide a special
    firmware interface that can be used to indicate to the platform that
    the OS is transitioning into a system-wide low-power state in which
    certain types of activity are not desirable or that it is leaving
    such a state and that (in principle) should allow the platform to
    adjust its operation mode accordingly.
    
    That interface is a special _DSM object under a System Power
    Management Controller device (PNP0D80).  The expected way to use it
    is to invoke function 0 from it on system initialization, functions
    3 and 5 during suspend transitions and functions 4 and 6 during
    resume transitions (to reverse the actions carried out by the
    former).  In particular, function 5 from the "Low-Power S0" device
    _DSM is expected to cause the platform to put itself into a low-power
    operation mode which should include making the EC less verbose (so to
    speak).  Next, on resume, function 6 switches the platform back to
    the "working-state" operation mode.
    
    In accordance with the above, modify the ACPI suspend-to-idle code
    to look for the "Low-Power S0" _DSM interface on platforms with the
    ACPI_FADT_LOW_POWER_S0 flag set in the ACPI tables.  If it's there,
    use it during suspend-to-idle transitions as prescribed and avoid
    changing the GPE configuration in that case.  [That should reflect
    what the most recent versions of other OSes do.]
    
    Also modify the ACPI EC driver to make it handle events during
    suspend-to-idle in the usual way if the "Low-Power S0" _DSM interface
    is going to be used to make the power button events work while
    suspended on the Dell machines mentioned above
    
    Link: http://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdfSigned-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
    8110dd28
ec.c 51.8 KB