diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-07-30 11:55:59 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2019-07-30 12:26:21 +0200 |
commit | 10a08fd65ec1a68ccd86b19ec822ed5f2e50113f (patch) | |
tree | 2f3385d230b870c37e2f9067193aaeed73d1adeb /drivers/acpi/ec.c | |
parent | PM: sleep: Drop dpm_noirq_begin() and dpm_noirq_end() (diff) | |
download | linux-10a08fd65ec1a68ccd86b19ec822ed5f2e50113f.tar.xz linux-10a08fd65ec1a68ccd86b19ec822ed5f2e50113f.zip |
ACPI: PM: Set up EC GPE for system wakeup from drivers that need it
The EC GPE needs to be set up for system wakeup only if there is a
driver depending on it, either intel-hid or intel-vbtn, bound to a
button device that is expected to wake up the system from sleep (such
as the power button on some Dell systems, like the XPS13 9360). It
doesn't need to be set up for waking up the system from sleep in any
other cases and whether or not it is expected to wake up the system
from sleep doesn't depend on whether or not the LPS0 device is
present in the ACPI namespace.
For this reason, rearrange the ACPI suspend-to-idle code to make the
drivers depending on the EC GPE wakeup take care of setting it up and
decouple that from the LPS0 device handling.
While at it, make intel-hid and intel-vbtn prepare for system wakeup
only if they are allowed to wake up the system from sleep by user
space (via sysfs).
[Note that acpi_ec_mark_gpe_for_wake() and acpi_ec_set_gpe_wake_mask()
are there to prevent the EC GPE from being disabled by the
acpi_enable_all_wakeup_gpes() call in acpi_s2idle_prepare(), so on
systems with either intel-hid or intel-vbtn this change doesn't
affect any interactions with the hardware or platform firmware.]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r-- | drivers/acpi/ec.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 58c7ad402d8d..b996ca5f253f 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -25,6 +25,7 @@ #include <linux/list.h> #include <linux/spinlock.h> #include <linux/slab.h> +#include <linux/suspend.h> #include <linux/acpi.h> #include <linux/dmi.h> #include <asm/io.h> @@ -1048,17 +1049,21 @@ void acpi_ec_unblock_transactions(void) acpi_ec_start(first_ec, true); } +#ifdef CONFIG_PM_SLEEP void acpi_ec_mark_gpe_for_wake(void) { if (first_ec && !ec_no_wakeup) acpi_mark_gpe_for_wake(NULL, first_ec->gpe); } +EXPORT_SYMBOL_GPL(acpi_ec_mark_gpe_for_wake); void acpi_ec_set_gpe_wake_mask(u8 action) { - if (first_ec && !ec_no_wakeup) + if (pm_suspend_no_platform() && first_ec && !ec_no_wakeup) acpi_set_gpe_wake_mask(NULL, first_ec->gpe, action); } +EXPORT_SYMBOL_GPL(acpi_ec_set_gpe_wake_mask); +#endif bool acpi_ec_dispatch_gpe(void) { |