|
36 | 36 | #define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args) |
37 | 37 |
|
38 | 38 | static int forcing_shutdown; /* Forced shutdown in progress? */ |
39 | | -static int custom_forcing_shutdown; |
40 | 39 |
|
41 | 40 | /* |
42 | 41 | * define wake source for keep PCH power |
@@ -76,8 +75,10 @@ void chipset_force_shutdown(enum chipset_shutdown_reason reason) |
76 | 75 | if (!chipset_in_state(CHIPSET_STATE_ANY_OFF)) { |
77 | 76 | report_ap_reset(reason); |
78 | 77 | forcing_shutdown = 1; |
79 | | - custom_forcing_shutdown = 1; |
80 | 78 | 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); |
81 | 82 | } |
82 | 83 | } |
83 | 84 |
|
@@ -113,10 +114,8 @@ int keep_pch_power(void) |
113 | 114 |
|
114 | 115 | system_get_bbram(SYSTEM_BBRAM_IDX_VPRO_STATUS, &vpro_change); |
115 | 116 |
|
116 | | - if (custom_forcing_shutdown && power_get_state() == POWER_S5G3) { |
117 | | - custom_forcing_shutdown = 0; |
| 117 | + if (forcing_shutdown) |
118 | 118 | return false; |
119 | | - } |
120 | 119 | else if (version & BIT(0) && extpower_is_present() && vpro_change) |
121 | 120 | return true; |
122 | 121 | #ifdef CONFIG_EMI_REGION1 |
@@ -398,9 +397,11 @@ enum power_state power_handle_state(enum power_state state) |
398 | 397 | case POWER_S5: |
399 | 398 | CPRINTS("PH S5"); |
400 | 399 |
|
401 | | - if (custom_forcing_shutdown) |
| 400 | + if (forcing_shutdown) { |
402 | 401 | /* force shutdown process shouldn't keep PCH power */ |
| 402 | + forcing_shutdown = 0; |
403 | 403 | return POWER_S5G3; |
| 404 | + } |
404 | 405 |
|
405 | 406 | if (power_s5_up || stress_test_enable) { |
406 | 407 | /* Wait S5 signal when power up from S5 */ |
|
0 commit comments