Skip to content

Commit aa23ca3

Browse files
jwrdegoedelinusw
authored andcommitted
gpiolib: acpi: Add honor_wakeup module-option + quirk mechanism
On some laptops enabling wakeup on the GPIO interrupts used for ACPI _AEI event handling causes spurious wakeups. This commit adds a new honor_wakeup option, defaulting to true (our current behavior), which can be used to disable wakeup on troublesome hardware to avoid these spurious wakeups. This is a workaround for an architectural problem with s2idle under Linux where we do not have any mechanism to immediately go back to sleep after wakeup events, other then for embedded-controller events using the standard ACPI EC interface, for details see: https://lore.kernel.org/linux-acpi/[email protected]/ One series of laptops which is not able to suspend without this workaround is the HP x2 10 Cherry Trail models, this commit adds a DMI based quirk which makes sets honor_wakeup to false on these models. Cc: [email protected] Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 1ad1b54 commit aa23ca3

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

drivers/gpio/gpiolib-acpi.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,18 @@
2222
#include "gpiolib-acpi.h"
2323

2424
#define QUIRK_NO_EDGE_EVENTS_ON_BOOT 0x01l
25+
#define QUIRK_NO_WAKEUP 0x02l
2526

2627
static int run_edge_events_on_boot = -1;
2728
module_param(run_edge_events_on_boot, int, 0444);
2829
MODULE_PARM_DESC(run_edge_events_on_boot,
2930
"Run edge _AEI event-handlers at boot: 0=no, 1=yes, -1=auto");
3031

32+
static int honor_wakeup = -1;
33+
module_param(honor_wakeup, int, 0444);
34+
MODULE_PARM_DESC(honor_wakeup,
35+
"Honor the ACPI wake-capable flag: 0=no, 1=yes, -1=auto");
36+
3137
/**
3238
* struct acpi_gpio_event - ACPI GPIO event handler data
3339
*
@@ -283,7 +289,7 @@ static acpi_status acpi_gpiochip_alloc_event(struct acpi_resource *ares,
283289
event->handle = evt_handle;
284290
event->handler = handler;
285291
event->irq = irq;
286-
event->irq_is_wake = agpio->wake_capable == ACPI_WAKE_CAPABLE;
292+
event->irq_is_wake = honor_wakeup && agpio->wake_capable == ACPI_WAKE_CAPABLE;
287293
event->pin = pin;
288294
event->desc = desc;
289295

@@ -1337,6 +1343,23 @@ static const struct dmi_system_id gpiolib_acpi_quirks[] = {
13371343
},
13381344
.driver_data = (void *)QUIRK_NO_EDGE_EVENTS_ON_BOOT,
13391345
},
1346+
{
1347+
/*
1348+
* Various HP X2 10 Cherry Trail models use an external
1349+
* embedded-controller connected via I2C + an ACPI GPIO
1350+
* event handler. The embedded controller generates various
1351+
* spurious wakeup events when suspended. So disable wakeup
1352+
* for its handler (it uses the only ACPI GPIO event handler).
1353+
* This breaks wakeup when opening the lid, the user needs
1354+
* to press the power-button to wakeup the system. The
1355+
* alternative is suspend simply not working, which is worse.
1356+
*/
1357+
.matches = {
1358+
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
1359+
DMI_MATCH(DMI_PRODUCT_NAME, "HP x2 Detachable 10-p0XX"),
1360+
},
1361+
.driver_data = (void *)QUIRK_NO_WAKEUP,
1362+
},
13401363
{} /* Terminating entry */
13411364
};
13421365

@@ -1356,6 +1379,13 @@ static int acpi_gpio_setup_params(void)
13561379
run_edge_events_on_boot = 1;
13571380
}
13581381

1382+
if (honor_wakeup < 0) {
1383+
if (quirks & QUIRK_NO_WAKEUP)
1384+
honor_wakeup = 0;
1385+
else
1386+
honor_wakeup = 1;
1387+
}
1388+
13591389
return 0;
13601390
}
13611391

0 commit comments

Comments
 (0)