3636#define CPRINTS (format , args ...) cprints(CC_CHIPSET, format, ## args)
3737
3838static int forcing_shutdown ; /* Forced shutdown in progress? */
39+ static int custom_forcing_shutdown ;
3940
4041/*
4142 * define wake source for keep PCH power
@@ -75,6 +76,7 @@ void chipset_force_shutdown(enum chipset_shutdown_reason reason)
7576 if (!chipset_in_state (CHIPSET_STATE_ANY_OFF )) {
7677 report_ap_reset (reason );
7778 forcing_shutdown = 1 ;
79+ custom_forcing_shutdown = 1 ;
7880 chipset_force_g3 ();
7981 }
8082}
@@ -91,6 +93,7 @@ void chipset_handle_espi_reset_assert(void)
9193 forcing_shutdown ) {
9294 power_button_pch_release ();
9395 forcing_shutdown = 0 ;
96+
9497 }
9598}
9699
@@ -110,8 +113,10 @@ int keep_pch_power(void)
110113
111114 system_get_bbram (SYSTEM_BBRAM_IDX_VPRO_STATUS , & vpro_change );
112115
113- if (forcing_shutdown )
116+ if (custom_forcing_shutdown && power_get_state () == POWER_S5G3 ) {
117+ custom_forcing_shutdown = 0 ;
114118 return false;
119+ }
115120 else if (version & BIT (0 ) && extpower_is_present () && vpro_change )
116121 return true;
117122#ifdef CONFIG_EMI_REGION1
@@ -393,11 +398,9 @@ enum power_state power_handle_state(enum power_state state)
393398 case POWER_S5 :
394399 CPRINTS ("PH S5" );
395400
396- if (forcing_shutdown ) {
401+ if (custom_forcing_shutdown )
397402 /* force shutdown process shouldn't keep PCH power */
398- forcing_shutdown = 0 ;
399403 return POWER_S5G3 ;
400- }
401404
402405 if (power_s5_up || stress_test_enable ) {
403406 /* Wait S5 signal when power up from S5 */
@@ -562,9 +565,8 @@ enum power_state power_handle_state(enum power_state state)
562565 /* if we need to keep pch power, return to G3S5 state */
563566
564567#ifdef CONFIG_EMI_REGION1
565- if (keep_pch_power ()) {
568+ if (keep_pch_power ())
566569 return POWER_S5 ;
567- }
568570#endif
569571 chipset_force_g3 ();
570572 /* clear suspend flag when system shutdown */
0 commit comments