diff options
author | Lijian Zhao <lijian.zhao@intel.com> | 2019-01-10 19:31:15 -0800 |
---|---|---|
committer | Duncan Laurie <dlaurie@chromium.org> | 2019-01-24 22:03:32 +0000 |
commit | a31872c6151986cd43ae7560cb6f31e80e049167 (patch) | |
tree | ee6e81a813512aca09437a3d1c4e6e42a1b46171 /src/ec | |
parent | 2bbffc0442ac58539d57895de2311bc3dc634771 (diff) | |
download | coreboot-a31872c6151986cd43ae7560cb6f31e80e049167.tar.xz |
ec/google/wilco: Turn on wake up from lid
Send required EC command to enable ACPI S3 wake up from lid switch.
BUG=b:120748824
TEST=Put Sarien system into S3 and then wake up from lid switch
successful.
Signed-off-by: Lijian Zhao <lijian.zhao@intel.com>
Change-Id: I13f3469847b0886147b8b624311a1ece796f847b
Signed-off-by: Lijian Zhao <lijian.zhao@intel.com>
Reviewed-on: https://review.coreboot.org/c/30824
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Diffstat (limited to 'src/ec')
-rw-r--r-- | src/ec/google/wilco/commands.c | 9 | ||||
-rw-r--r-- | src/ec/google/wilco/commands.h | 23 | ||||
-rw-r--r-- | src/ec/google/wilco/smihandler.c | 2 |
3 files changed, 34 insertions, 0 deletions
diff --git a/src/ec/google/wilco/commands.c b/src/ec/google/wilco/commands.c index c42699d28c..1c7646106c 100644 --- a/src/ec/google/wilco/commands.c +++ b/src/ec/google/wilco/commands.c @@ -158,3 +158,12 @@ int wilco_ec_radio_control(enum ec_radio radio, uint8_t state) radio_control, ARRAY_SIZE(radio_control), NULL, 0); } + +int wilco_ec_change_wake(uint8_t source, enum ec_wake_change change) +{ + uint8_t wake_source[3] = { change, source }; + + return wilco_ec_mailbox(WILCO_EC_MSG_DEFAULT, KB_ACPI_WAKEUP_CHANGE, + wake_source, ARRAY_SIZE(wake_source), + NULL, 0); +} diff --git a/src/ec/google/wilco/commands.h b/src/ec/google/wilco/commands.h index 752e19ba69..53f6d0f401 100644 --- a/src/ec/google/wilco/commands.h +++ b/src/ec/google/wilco/commands.h @@ -38,6 +38,8 @@ enum { KB_EC_INFO = 0x38, /* Set ACPI mode on or off */ KB_ACPI = 0x3a, + /* Change ACPI wake up source */ + KB_ACPI_WAKEUP_CHANGE = 0x4a, /* Manage the EC power button passthru to the host */ KB_POWER_BUTTON_TO_HOST = 0x3e, /* Manage the EC control of speaker mute */ @@ -257,4 +259,25 @@ int wilco_ec_get_pm(struct ec_pm_event_state *pm, bool clear); */ int wilco_ec_get_lid_state(void); +enum ec_wake_change { + WAKE_OFF = 0, + WAKE_ON +}; +/** + * wilco_ec_change_wake_source + * + * Change acpi wake up source. + * @source: Wake up source that can be enabled/disabled. + * @ec_wake_change: On/off switch. + * + * Returns -1 if the EC command failed + */ +int wilco_ec_change_wake(uint8_t source, enum ec_wake_change change); + +enum ec_acpi_wake_events { + EC_ACPI_WAKE_PWRB = BIT(0), /* Wake up by power button */ + EC_ACPI_WAKE_LID = BIT(1), /* Wake up by lid switch */ + EC_ACPI_WAKE_RTC = BIT(5), /* Wake up by RTC */ +}; + #endif /* EC_GOOGLE_WILCO_COMMANDS_H */ diff --git a/src/ec/google/wilco/smihandler.c b/src/ec/google/wilco/smihandler.c index 60ad8139fe..e127434726 100644 --- a/src/ec/google/wilco/smihandler.c +++ b/src/ec/google/wilco/smihandler.c @@ -26,6 +26,8 @@ void wilco_ec_smi_sleep(int slp_type) switch (slp_type) { case ACPI_S3: wilco_ec_send_noargs(KB_SAVE); + wilco_ec_change_wake((EC_ACPI_WAKE_PWRB|EC_ACPI_WAKE_LID), + WAKE_ON); wilco_ec_slp_en(); break; case ACPI_S5: |