Angel Pons | 58c0d32 | 2020-04-05 13:20:46 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Marc Jones | 07cf24c | 2015-06-09 14:42:55 -0600 | [diff] [blame] | 2 | |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 3 | #include <acpi/acpi.h> |
Marc Jones | 07cf24c | 2015-06-09 14:42:55 -0600 | [diff] [blame] | 4 | #include <console/console.h> |
| 5 | #include <ec/google/chromeec/ec.h> |
| 6 | #include "ec.h" |
| 7 | |
| 8 | void mainboard_ec_init(void) |
| 9 | { |
Furquan Shaikh | 2749c52 | 2017-10-04 14:01:41 -0700 | [diff] [blame] | 10 | const struct google_chromeec_event_info info = { |
| 11 | .log_events = MAINBOARD_EC_LOG_EVENTS, |
| 12 | .sci_events = MAINBOARD_EC_SCI_EVENTS, |
| 13 | .s3_wake_events = MAINBOARD_EC_S3_WAKE_EVENTS, |
| 14 | .s5_wake_events = MAINBOARD_EC_S5_WAKE_EVENTS, |
| 15 | }; |
| 16 | |
Matt DeVillier | 0868f96 | 2020-02-18 16:06:04 -0600 | [diff] [blame] | 17 | int s3_wakeup = acpi_is_wakeup_s3(); |
| 18 | |
Marc Jones | 07cf24c | 2015-06-09 14:42:55 -0600 | [diff] [blame] | 19 | printk(BIOS_DEBUG, "mainboard_ec_init\n"); |
| 20 | post_code(0xf0); |
| 21 | |
Matt DeVillier | 0868f96 | 2020-02-18 16:06:04 -0600 | [diff] [blame] | 22 | google_chromeec_events_init(&info, s3_wakeup); |
| 23 | if (s3_wakeup) { |
| 24 | /* Clear pending events. */ |
Rob Barnes | f1ade48 | 2021-06-14 10:22:21 -0600 | [diff] [blame] | 25 | while (google_chromeec_get_event() != EC_HOST_EVENT_NONE) |
Matt DeVillier | 0868f96 | 2020-02-18 16:06:04 -0600 | [diff] [blame] | 26 | ; |
| 27 | } |
Marc Jones | 07cf24c | 2015-06-09 14:42:55 -0600 | [diff] [blame] | 28 | |
| 29 | post_code(0xf1); |
| 30 | } |