@@ -253,16 +253,19 @@ void board_check_current(void)
253253 static int curr_status = EC_DEASSERTED_PROCHOT ;
254254 static int pre_status = EC_DEASSERTED_PROCHOT ;
255255 static int active_port ;
256+ static int active_current ;
256257 static int pre_active_port ;
257258 static int shunt_register ;
258259
259260 active_port = charge_manager_get_active_charge_port ();
261+ active_current = pd_get_active_current (active_port );
260262
261- if (active_port == CHARGE_PORT_NONE ) {
263+ if (active_port == CHARGE_PORT_NONE || ! extpower_is_present () ) {
262264 if (pre_active_port != active_port ) {
263265 curr_status = EC_DEASSERTED_PROCHOT ;
264266 throttle_ap (THROTTLE_OFF , THROTTLE_HARD , THROTTLE_SRC_AC );
265267
268+ pre_status = curr_status ;
266269 pre_active_port = active_port ;
267270 }
268271 hook_call_deferred (& board_check_current_data , 100 * MSEC );
@@ -274,8 +277,8 @@ void board_check_current(void)
274277 else
275278 shunt_register = 5 ;
276279
277- if (ABS (INA2XX_SHUNT_UV (sv ) / shunt_register ) > pd_get_active_current ( active_port )) {
278- /* Only assert the prochot at EVT phase */
280+ if (ABS (INA2XX_SHUNT_UV (sv ) / shunt_register ) > active_current &&
281+ ( INA2XX_SHUNT_UV ( sv ) > 0 ) && ( active_current != 0 )) {
279282 curr_status = EC_ASSERTED_PROCHOT ;
280283 hook_call_deferred (& board_check_current_data , 10 * MSEC );
281284 } else if (chipset_in_state (CHIPSET_STATE_ANY_OFF )) {
0 commit comments