ec/google/wilco: Save and restore PS/2 data for S3

Send a command to the EC on the way into S3 suspend state telling
it to save the PS/2 data, and on resume send it a command for
restoring the PS/2 data that was previously saved.

Change-Id: Ic4b5d6d2656dbb1c476b9211b0d60c71b0cd7b32
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://review.coreboot.org/29120
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Duncan Laurie 2018-10-15 13:39:35 -07:00 committed by Duncan Laurie
parent d978174d1d
commit 3fbe1949b1
3 changed files with 11 additions and 0 deletions

View File

@ -44,6 +44,12 @@ static void wilco_ec_post_video_init(void *unused)
BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_EXIT, BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_EXIT,
wilco_ec_post_video_init, NULL); wilco_ec_post_video_init, NULL);
static void wilco_ec_resume(void *unused)
{
wilco_ec_send_noargs(KB_RESTORE);
}
BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, wilco_ec_resume, NULL);
static void wilco_ec_init(struct device *dev) static void wilco_ec_init(struct device *dev)
{ {
if (!dev->enabled) if (!dev->enabled)

View File

@ -26,6 +26,10 @@ enum {
KB_POWER_STATUS = 0x05, KB_POWER_STATUS = 0x05,
/* Inform the EC aboout the reason host is turning off */ /* Inform the EC aboout the reason host is turning off */
KB_POWER_OFF = 0x08, KB_POWER_OFF = 0x08,
/* Save PS/2 data before S3 suspend */
KB_SAVE = 0x2f,
/* Restore PS/2 data after S3 resume */
KB_RESTORE = 0x30,
/* Retrieve information about the EC */ /* Retrieve information about the EC */
KB_EC_INFO = 0x38, KB_EC_INFO = 0x38,
/* Set ACPI mode on or off */ /* Set ACPI mode on or off */

View File

@ -25,6 +25,7 @@ void wilco_ec_smi_sleep(int slp_type)
{ {
switch (slp_type) { switch (slp_type) {
case ACPI_S3: case ACPI_S3:
wilco_ec_send_noargs(KB_SAVE);
wilco_ec_slp_en(); wilco_ec_slp_en();
break; break;
case ACPI_S5: case ACPI_S5: