Patrick Georgi merged this change.

View Change

Approvals: build bot (Jenkins): Verified Furquan Shaikh: Looks good to me, approved
drivers/generic/gpio_keys: Add trigger for wakeup event action

Currently without any trigger the wakeup event is generated on both the
rising and falling edges of the GPIO input. Add support to specify the
trigger explicitly so that the configuration can be passed to the
kernel.

BRANCH=octopus
BUG=b:117953118
TEST=Ensure that the system boots to ChromeOS. Ensure that the stylus tools
open on pen eject. Ensure that the system wakes on Pen Eject. Ensure that
the system enters S0ix and S3 states after the pen is ejected. Ensure that
the system enters S0ix and S3 states when the pen remains inserted in its
holder. Ensured that the system does not wake when the pen is inserted.
Ensure that the suspend_stress_test runs successfully for 25 iterations
with the pen placed in its holder and ejected from its holder.

Change-Id: Ifb08ba01106031aa2655c1ae2faab284926f1ceb
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Reviewed-on: https://review.coreboot.org/c/30451
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
---
M src/drivers/generic/gpio_keys/chip.h
M src/drivers/generic/gpio_keys/gpio_keys.c
2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/drivers/generic/gpio_keys/chip.h b/src/drivers/generic/gpio_keys/chip.h
index 818f14c..9d33b4f 100644
--- a/src/drivers/generic/gpio_keys/chip.h
+++ b/src/drivers/generic/gpio_keys/chip.h
@@ -30,6 +30,13 @@
SW_PEN_INSERTED = 0xf,
};

+/* Trigger for wakeup event action */
+enum {
+ EV_ACT_ANY,
+ EV_ACT_ASSERTED,
+ EV_ACT_DEASSERTED,
+};
+
/* Details of the child node defining key */
struct key_info {
/* Device name of the child node - Mandatory */
@@ -47,6 +54,8 @@
bool is_wakeup_source;
/* Wake GPE */
unsigned int wake;
+ /* Trigger for Wakeup Event Action as defined in EV_ACT_* enum */
+ unsigned int wakeup_event_action;
/* Can this key be disabled? */
bool can_be_disabled;
/* Debounce interval time in milliseconds */
diff --git a/src/drivers/generic/gpio_keys/gpio_keys.c b/src/drivers/generic/gpio_keys/gpio_keys.c
index 77e7740..f9869d6 100644
--- a/src/drivers/generic/gpio_keys/gpio_keys.c
+++ b/src/drivers/generic/gpio_keys/gpio_keys.c
@@ -43,8 +43,12 @@
if (key->is_wakeup_source)
acpi_dp_add_integer(dsd, "wakeup-source",
key->is_wakeup_source);
- if (key->wake)
+ if (key->wake) {
acpigen_write_PRW(key->wake, 3);
+ acpi_dp_add_integer(dsd, "wakeup-event-action",
+ key->wakeup_event_action);
+ }
+
if (key->can_be_disabled)
acpi_dp_add_integer(dsd, "linux,can-disable",
key->can_be_disabled);

To view, visit change 30451. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ifb08ba01106031aa2655c1ae2faab284926f1ceb
Gerrit-Change-Number: 30451
Gerrit-PatchSet: 3
Gerrit-Owner: Karthik Ramasubramanian <kramasub@google.com>
Gerrit-Reviewer: Aaron Durbin <adurbin@chromium.org>
Gerrit-Reviewer: Furquan Shaikh <furquan@google.com>
Gerrit-Reviewer: Justin TerAvest <teravest@chromium.org>
Gerrit-Reviewer: Karthik Ramasubramanian <kramasub@google.com>
Gerrit-Reviewer: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged