summaryrefslogtreecommitdiff
path: root/src/drivers/generic
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2020-06-26 01:19:46 -0700
committerFurquan Shaikh <furquan@google.com>2020-06-28 05:22:41 +0000
commitfa8b75fb17ccd739d3e08a184a014d7dca35d3ce (patch)
treed9bc98cda8ff0829a7a589810ffae05a441c1625 /src/drivers/generic
parent490473edec3817902c0fff0d6635ac9bbb58bac2 (diff)
gpio_keys: Allow boards to configure different wakeup routes
This change allows mainboard to configure different wakeup routes that can be used by a GPIO key: 1. SCI: This is selected when SCI route is used to wake the system. It results in _PRW property being exposed in ACPI tables. 2. GPIO IRQ: This is selected when GPIO controller wake is used to wake the system. It is typically used when the input signal is not dual routed and the GPIO controller block is not capable of applying filters for IRQ and wake separately. In this case, _PRW is not exposed in ACPI tables for the key device. 3. Disabled: No wakeup supported. Based on these wakeup routes, gpio_keys_add_child_node() is updated to expose _PRW and _DSD properties for wakeup appropriately. Additionally, the change updates mainboards that were already using gpio_keys to set wakeup_route attribute correctly and renames "wake" to "wake_gpe" to make the usage clear. BUG=b:159942427 Change-Id: Ib32b866b5f0ca559ed680b46218454bdfd8c6457 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/42826 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'src/drivers/generic')
-rw-r--r--src/drivers/generic/gpio_keys/chip.h28
-rw-r--r--src/drivers/generic/gpio_keys/gpio_keys.c7
2 files changed, 31 insertions, 4 deletions
diff --git a/src/drivers/generic/gpio_keys/chip.h b/src/drivers/generic/gpio_keys/chip.h
index 7bc5007df3..a2ff59dc73 100644
--- a/src/drivers/generic/gpio_keys/chip.h
+++ b/src/drivers/generic/gpio_keys/chip.h
@@ -24,6 +24,28 @@ enum {
EV_ACT_DEASSERTED,
};
+enum {
+ /*
+ * GPIO key uses SCI route to wake the system from suspend state. This is typically used
+ * when the input line is dual routed i.e. one for IRQ and other for SCI or if the GPIO
+ * controller is capable of handling the filtering for IRQ and SCI separately. This
+ * requires "wake" property to be provided by the board which represents the GPE # for
+ * wake. It is exposed as _PRW in ACPI tables.
+ */
+ WAKEUP_ROUTE_SCI,
+ /*
+ * GPIO key uses GPIO controller IRQ route for wake. This is used when IRQ and wake are
+ * routed to the same pad and the GPIO controller is not capable of handling the trigger
+ * filtering separately for IRQ and wake. Kernel driver for gpio-keys takes care of
+ * reconfiguring the IRQ trigger as both edges when used in S0 and the edge requested by
+ * BIOS (as per wakeup_event_action) when entering suspend. In this case, _PRW is not
+ * exposed for the key device.
+ */
+ WAKEUP_ROUTE_GPIO_IRQ,
+ /* GPIO key does not support wake. */
+ WAKEUP_ROUTE_DISABLED,
+};
+
/* Details of the child node defining key */
struct key_info {
/* Device name of the child node - Mandatory */
@@ -37,8 +59,10 @@ struct key_info {
uint32_t linux_input_type;
/* Descriptive name of the key */
const char *label;
- /* Wake GPE */
- unsigned int wake;
+ /* Wakeup route (if any) for the key. See WAKEUP_ROUTE_* macros above. */
+ unsigned int wakeup_route;
+ /* Wake GPE -- SCI GPE # for wake. Required for WAKEUP_ROUTE_SCI. */
+ unsigned int wake_gpe;
/* Trigger for Wakeup Event Action as defined in EV_ACT_* enum */
unsigned int wakeup_event_action;
/* Can this key be disabled? */
diff --git a/src/drivers/generic/gpio_keys/gpio_keys.c b/src/drivers/generic/gpio_keys/gpio_keys.c
index 693fbb54de..f9d71876fa 100644
--- a/src/drivers/generic/gpio_keys/gpio_keys.c
+++ b/src/drivers/generic/gpio_keys/gpio_keys.c
@@ -26,9 +26,12 @@ static struct acpi_dp *gpio_keys_add_child_node(
key->linux_input_type);
if (key->label)
acpi_dp_add_string(dsd, "label", key->label);
- if (key->wake) {
+
+ if (key->wakeup_route == WAKEUP_ROUTE_SCI)
+ acpigen_write_PRW(key->wake_gpe, 3);
+
+ if (key->wakeup_route != WAKEUP_ROUTE_DISABLED) {
acpi_dp_add_integer(dsd, "wakeup-source", 1);
- acpigen_write_PRW(key->wake, 3);
acpi_dp_add_integer(dsd, "wakeup-event-action",
key->wakeup_event_action);
}