From 7378a1792a986ca5137da9bd0868bbc1b496839d Mon Sep 17 00:00:00 2001 From: Duncan Laurie Date: Thu, 29 Jun 2017 23:52:17 -0700 Subject: ec/google/chromeec: Add support for EC device events Add support for the new EC device event interface which is used to report events from devices that are connected behind the EC. This can be used to differentiate wake sources from the EC in the case that the EC has the wake pins from various devices. This can be used in case the AP is unable to directly wake from the device itself, for example when using the Deep S3 state on Intel platforms only a few pins can directly wake the AP. BUG=b:30624430 TEST=build google/* boards that use chrome EC. Feature is used and tested further in a subsequent commit. Change-Id: I5126c6d6ffb6b0ef6e8db8dcd5aec62db925a371 Signed-off-by: Duncan Laurie Reviewed-on: https://review.coreboot.org/20426 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin Reviewed-by: Furquan Shaikh --- src/ec/google/chromeec/smihandler.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/ec/google/chromeec/smihandler.c') diff --git a/src/ec/google/chromeec/smihandler.c b/src/ec/google/chromeec/smihandler.c index 75636ea8c1..379ff68019 100644 --- a/src/ec/google/chromeec/smihandler.c +++ b/src/ec/google/chromeec/smihandler.c @@ -73,6 +73,24 @@ void chromeec_smi_sleep(int slp_type, uint32_t s3_mask, uint32_t s5_mask) clear_pending_events(); } +void chromeec_smi_device_event_sleep(int slp_type, uint32_t s3_mask, + uint32_t s5_mask) +{ + switch (slp_type) { + case ACPI_S3: + /* Enable device wake events */ + google_chromeec_set_device_enabled_events(s3_mask); + break; + case ACPI_S5: + /* Enable device wake events */ + google_chromeec_set_device_enabled_events(s5_mask); + break; + } + + /* Read and clear pending events that may trigger immediate wake */ + google_chromeec_get_device_current_events(); +} + void chromeec_smi_apmc(int apmc, uint32_t sci_mask, uint32_t smi_mask) { switch (apmc) { -- cgit v1.2.3