summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/drivers/generic/gpio_keys/chip.h28
-rw-r--r--src/drivers/generic/gpio_keys/gpio_keys.c7
-rw-r--r--src/mainboard/google/hatch/variants/hatch/overridetree.cb3
-rw-r--r--src/mainboard/google/hatch/variants/helios/overridetree.cb3
-rw-r--r--src/mainboard/google/hatch/variants/helios_diskswap/overridetree.cb3
-rw-r--r--src/mainboard/google/hatch/variants/kindred/overridetree.cb3
-rw-r--r--src/mainboard/google/hatch/variants/kohaku/overridetree.cb3
-rw-r--r--src/mainboard/google/hatch/variants/mushu/overridetree.cb3
-rw-r--r--src/mainboard/google/octopus/variants/bobba/overridetree.cb3
-rw-r--r--src/mainboard/google/octopus/variants/garg/overridetree.cb3
-rw-r--r--src/mainboard/google/poppy/variants/baseboard/devicetree.cb1
-rw-r--r--src/mainboard/google/poppy/variants/nami/devicetree.cb1
-rw-r--r--src/mainboard/google/poppy/variants/nautilus/devicetree.cb1
13 files changed, 50 insertions, 12 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);
}
diff --git a/src/mainboard/google/hatch/variants/hatch/overridetree.cb b/src/mainboard/google/hatch/variants/hatch/overridetree.cb
index a92ef9b899..76f634f0d7 100644
--- a/src/mainboard/google/hatch/variants/hatch/overridetree.cb
+++ b/src/mainboard/google/hatch/variants/hatch/overridetree.cb
@@ -109,7 +109,8 @@ chip soc/intel/cannonlake
chip drivers/generic/gpio_keys
register "name" = ""PENH""
register "gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_A8)"
- register "key.wake" = "GPE0_DW0_08"
+ register "key.wake_gpe" = "GPE0_DW0_08"
+ register "key.wakeup_route" = "WAKEUP_ROUTE_SCI"
register "key.wakeup_event_action" = "EV_ACT_DEASSERTED"
register "key.dev_name" = ""EJCT""
register "key.linux_code" = "SW_PEN_INSERTED"
diff --git a/src/mainboard/google/hatch/variants/helios/overridetree.cb b/src/mainboard/google/hatch/variants/helios/overridetree.cb
index 0d73814249..34d235856e 100644
--- a/src/mainboard/google/hatch/variants/helios/overridetree.cb
+++ b/src/mainboard/google/hatch/variants/helios/overridetree.cb
@@ -122,7 +122,8 @@ chip soc/intel/cannonlake
chip drivers/generic/gpio_keys
register "name" = ""PENH""
register "gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_A8)"
- register "key.wake" = "GPE0_DW0_08"
+ register "key.wake_gpe" = "GPE0_DW0_08"
+ register "key.wakeup_route" = "WAKEUP_ROUTE_SCI"
register "key.wakeup_event_action" = "EV_ACT_ASSERTED"
register "key.dev_name" = ""EJCT""
register "key.linux_code" = "SW_PEN_INSERTED"
diff --git a/src/mainboard/google/hatch/variants/helios_diskswap/overridetree.cb b/src/mainboard/google/hatch/variants/helios_diskswap/overridetree.cb
index 0422a57bd3..6accd0cc92 100644
--- a/src/mainboard/google/hatch/variants/helios_diskswap/overridetree.cb
+++ b/src/mainboard/google/hatch/variants/helios_diskswap/overridetree.cb
@@ -134,7 +134,8 @@ chip soc/intel/cannonlake
chip drivers/generic/gpio_keys
register "name" = ""PENH""
register "gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_A8)"
- register "key.wake" = "GPE0_DW0_08"
+ register "key.wake_gpe" = "GPE0_DW0_08"
+ register "key.wakeup_route" = "WAKEUP_ROUTE_SCI"
register "key.wakeup_event_action" = "EV_ACT_ASSERTED"
register "key.dev_name" = ""EJCT""
register "key.linux_code" = "SW_PEN_INSERTED"
diff --git a/src/mainboard/google/hatch/variants/kindred/overridetree.cb b/src/mainboard/google/hatch/variants/kindred/overridetree.cb
index 43fdfbf5fa..c75b7ba8c5 100644
--- a/src/mainboard/google/hatch/variants/kindred/overridetree.cb
+++ b/src/mainboard/google/hatch/variants/kindred/overridetree.cb
@@ -172,7 +172,8 @@ chip soc/intel/cannonlake
chip drivers/generic/gpio_keys
register "name" = ""PENH""
register "gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_A8)"
- register "key.wake" = "GPE0_DW0_08"
+ register "key.wake_gpe" = "GPE0_DW0_08"
+ register "key.wakeup_route" = "WAKEUP_ROUTE_SCI"
register "key.wakeup_event_action" = "EV_ACT_ASSERTED"
register "key.dev_name" = ""EJCT""
register "key.linux_code" = "SW_PEN_INSERTED"
diff --git a/src/mainboard/google/hatch/variants/kohaku/overridetree.cb b/src/mainboard/google/hatch/variants/kohaku/overridetree.cb
index df18277408..6720ffce79 100644
--- a/src/mainboard/google/hatch/variants/kohaku/overridetree.cb
+++ b/src/mainboard/google/hatch/variants/kohaku/overridetree.cb
@@ -218,7 +218,8 @@ chip soc/intel/cannonlake
register "name" = ""PENH""
# GPP_A16 is the IRQ source, and GPP_A8 is the wake source
register "gpio" = "ACPI_GPIO_INPUT_ACTIVE_LOW(GPP_A16)"
- register "key.wake" = "GPE0_DW0_08"
+ register "key.wake_gpe" = "GPE0_DW0_08"
+ register "key.wakeup_route" = "WAKEUP_ROUTE_SCI"
register "key.wakeup_event_action" = "EV_ACT_DEASSERTED"
register "key.dev_name" = ""EJCT""
register "key.linux_code" = "SW_PEN_INSERTED"
diff --git a/src/mainboard/google/hatch/variants/mushu/overridetree.cb b/src/mainboard/google/hatch/variants/mushu/overridetree.cb
index db86d68204..4e4d3888bd 100644
--- a/src/mainboard/google/hatch/variants/mushu/overridetree.cb
+++ b/src/mainboard/google/hatch/variants/mushu/overridetree.cb
@@ -129,7 +129,8 @@ chip soc/intel/cannonlake
chip drivers/generic/gpio_keys
register "name" = ""PENH""
register "gpio" = "ACPI_GPIO_IRQ_EDGE_BOTH(GPP_A8)"
- register "key.wake" = "GPE0_DW0_08"
+ register "key.wake_gpe" = "GPE0_DW0_08"
+ register "key.wakeup_route" = "WAKEUP_ROUTE_SCI"
register "key.wakeup_event_action" = "EV_ACT_DEASSERTED"
register "key.dev_name" = ""EJCT""
register "key.linux_code" = "SW_PEN_INSERTED"
diff --git a/src/mainboard/google/octopus/variants/bobba/overridetree.cb b/src/mainboard/google/octopus/variants/bobba/overridetree.cb
index c786a5d2b6..20c376a713 100644
--- a/src/mainboard/google/octopus/variants/bobba/overridetree.cb
+++ b/src/mainboard/google/octopus/variants/bobba/overridetree.cb
@@ -110,7 +110,8 @@ chip soc/intel/apollolake
register "key.linux_code" = "SW_PEN_INSERTED"
register "key.linux_input_type" = "EV_SW"
register "key.label" = ""pen_eject""
- register "key.wake" = "GPE0_DW2_04"
+ register "key.wake_gpe" = "GPE0_DW2_04"
+ register "key.wakeup_route" = "WAKEUP_ROUTE_SCI"
register "key.wakeup_event_action" = "EV_ACT_DEASSERTED"
device generic 0 on end
end
diff --git a/src/mainboard/google/octopus/variants/garg/overridetree.cb b/src/mainboard/google/octopus/variants/garg/overridetree.cb
index a91a730739..f3c580d2c0 100644
--- a/src/mainboard/google/octopus/variants/garg/overridetree.cb
+++ b/src/mainboard/google/octopus/variants/garg/overridetree.cb
@@ -104,7 +104,8 @@ chip soc/intel/apollolake
register "key.linux_code" = "SW_PEN_INSERTED"
register "key.linux_input_type" = "EV_SW"
register "key.label" = ""pen_eject""
- register "key.wake" = "GPE0_DW2_04"
+ register "key.wake_gpe" = "GPE0_DW2_04"
+ register "key.wakeup_route" = "WAKEUP_ROUTE_SCI"
register "key.wakeup_event_action" = "EV_ACT_DEASSERTED"
device generic 0 on end
end
diff --git a/src/mainboard/google/poppy/variants/baseboard/devicetree.cb b/src/mainboard/google/poppy/variants/baseboard/devicetree.cb
index 0f3cc0443f..d57070e61a 100644
--- a/src/mainboard/google/poppy/variants/baseboard/devicetree.cb
+++ b/src/mainboard/google/poppy/variants/baseboard/devicetree.cb
@@ -335,6 +335,7 @@ chip soc/intel/skylake
register "key.linux_code" = "SW_PEN_INSERTED"
register "key.linux_input_type" = "EV_SW"
register "key.label" = ""pen_eject""
+ register "key.wakeup_route" = "WAKEUP_ROUTE_DISABLED"
device generic 0 on end
end
end # I2C #3
diff --git a/src/mainboard/google/poppy/variants/nami/devicetree.cb b/src/mainboard/google/poppy/variants/nami/devicetree.cb
index 4fa41c55ca..a4dcad0d85 100644
--- a/src/mainboard/google/poppy/variants/nami/devicetree.cb
+++ b/src/mainboard/google/poppy/variants/nami/devicetree.cb
@@ -401,6 +401,7 @@ chip soc/intel/skylake
register "key.linux_code" = "SW_PEN_INSERTED"
register "key.linux_input_type" = "EV_SW"
register "key.label" = ""pen_insert""
+ register "key.wakeup_route" = "WAKEUP_ROUTE_DISABLED"
device generic 0 on end
end
end # I2C #2
diff --git a/src/mainboard/google/poppy/variants/nautilus/devicetree.cb b/src/mainboard/google/poppy/variants/nautilus/devicetree.cb
index c55562d0ec..a5f997a427 100644
--- a/src/mainboard/google/poppy/variants/nautilus/devicetree.cb
+++ b/src/mainboard/google/poppy/variants/nautilus/devicetree.cb
@@ -358,6 +358,7 @@ chip soc/intel/skylake
register "key.linux_code" = "SW_PEN_INSERTED"
register "key.linux_input_type" = "EV_SW"
register "key.label" = ""pen_eject""
+ register "key.wakeup_route" = "WAKEUP_ROUTE_DISABLED"
device generic 0 on end
end
end # I2C #3