From cdecc0db4becbe47927b649e410fd2d0b58d1531 Mon Sep 17 00:00:00 2001 From: Hannah Williams Date: Thu, 4 Jan 2018 11:57:14 -0800 Subject: [PATCH] soc/intel/apollolake: Fix prev_sleep_state on G3 exit If waking up from S5, then prev_sleep_state was correct but not when waking up from G3. Change-Id: I39011a0846f042d224a7cd65f736e749acc8ec75 Signed-off-by: Hannah Williams Reviewed-on: https://review.coreboot.org/23221 Reviewed-by: Aaron Durbin Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/soc/intel/apollolake/pmutil.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/soc/intel/apollolake/pmutil.c b/src/soc/intel/apollolake/pmutil.c index 162290ac17..dbaed70ca3 100644 --- a/src/soc/intel/apollolake/pmutil.c +++ b/src/soc/intel/apollolake/pmutil.c @@ -186,6 +186,17 @@ void soc_fill_power_state(struct chipset_power_state *ps) ps->gen_pmcon1, ps->gen_pmcon2, ps->gen_pmcon3); } +/* Return 0, 3, or 5 to indicate the previous sleep state. */ +int soc_prev_sleep_state(const struct chipset_power_state *ps, + int prev_sleep_state) +{ + /* WAK_STS bit will not be set when waking from G3 state */ + + if (!(ps->pm1_sts & WAK_STS) && (ps->gen_pmcon1 & COLD_BOOT_STS)) + prev_sleep_state = ACPI_S5; + return prev_sleep_state; +} + void enable_pm_timer_emulation(void) { /* ACPI PM timer emulation */