Skip to content

Commit e27425f

Browse files
authored
Merge pull request #366 from FrameworkComputer/fix_force_shutdown_abnormal
Clear the wake source flag to avoid the wrong pwoer state
2 parents 862c076 + 4d24126 commit e27425f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

board/hx20/power_sequence.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
3737

3838
static int forcing_shutdown; /* Forced shutdown in progress? */
39-
static int custom_forcing_shutdown;
4039

4140
/*
4241
* define wake source for keep PCH power
@@ -76,8 +75,10 @@ void chipset_force_shutdown(enum chipset_shutdown_reason reason)
7675
if (!chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
7776
report_ap_reset(reason);
7877
forcing_shutdown = 1;
79-
custom_forcing_shutdown = 1;
8078
chipset_force_g3();
79+
/* we need to clear the wake source to avoid the wrong power state */
80+
*host_get_customer_memmap(0x02) = 0x00;
81+
system_set_bbram(SYSTEM_BBRAM_IDX_VPRO_STATUS, 0);
8182
}
8283
}
8384

@@ -113,10 +114,8 @@ int keep_pch_power(void)
113114

114115
system_get_bbram(SYSTEM_BBRAM_IDX_VPRO_STATUS, &vpro_change);
115116

116-
if (custom_forcing_shutdown && power_get_state() == POWER_S5G3) {
117-
custom_forcing_shutdown = 0;
117+
if (forcing_shutdown)
118118
return false;
119-
}
120119
else if (version & BIT(0) && extpower_is_present() && vpro_change)
121120
return true;
122121
#ifdef CONFIG_EMI_REGION1
@@ -398,9 +397,11 @@ enum power_state power_handle_state(enum power_state state)
398397
case POWER_S5:
399398
CPRINTS("PH S5");
400399

401-
if (custom_forcing_shutdown)
400+
if (forcing_shutdown) {
402401
/* force shutdown process shouldn't keep PCH power */
402+
forcing_shutdown = 0;
403403
return POWER_S5G3;
404+
}
404405

405406
if (power_s5_up || stress_test_enable) {
406407
/* Wait S5 signal when power up from S5 */

0 commit comments

Comments
 (0)