diff --git a/zephyr/program/framework/src/cypd_ccg8.c b/zephyr/program/framework/src/cypd_ccg8.c index 7e3738bf6c..f239d41df0 100644 --- a/zephyr/program/framework/src/cypd_ccg8.c +++ b/zephyr/program/framework/src/cypd_ccg8.c @@ -471,6 +471,9 @@ static void epr_flow_pending_deferred(void) pd_port_states[port_idx].epr_retry_count = 0; pd_port_states[port_idx].epr_support = 0; pd_epr_in_progress &= EPR_PROCESS_MASK; + /* the transition ended, release the transition throttle */ + update_pmf_events(BIT(PD_PROGRESS_ENTER_EPR_MODE), 0); + update_pmf_events(BIT(PD_PROGRESS_EXIT_EPR_MODE), 0); if (charge_port != -1) { int controller = PORT_TO_CONTROLLER(charge_port); int port = PORT_TO_CONTROLLER_PORT(charge_port); @@ -580,6 +583,8 @@ static void buck_ready_for_epr(void) /* Retry mechanism */ if (++epr_buck_ctx.retry_count > 4) { + int charge_port = get_active_charge_pd_port(); + if (is_enter_epr) { CPRINTS("3Level-Buck enter epr failed, reverting to SPR mode"); board_set_buck_mode(LEVEL_BUCK_SPR); @@ -589,6 +594,16 @@ static void buck_ready_for_epr(void) } epr_buck_ctx.retry_count = 0; epr_buck_ctx.phase = BUCK_PHASE_IDLE; + /* the transition ended, restore the standing contract state */ + pd_epr_in_progress &= EPR_PROCESS_MASK; + update_pmf_events(BIT(PD_PROGRESS_ENTER_EPR_MODE), 0); + update_pmf_events(BIT(PD_PROGRESS_EXIT_EPR_MODE), 0); + if (charge_port != -1) { + int controller = PORT_TO_CONTROLLER(charge_port); + int port = PORT_TO_CONTROLLER_PORT(charge_port); + + cypd_update_port_state(controller, port); + } return; } @@ -761,6 +776,9 @@ void cypd_update_epr_state(int controller, int port, int response_len) #endif /* EPR fail, do not retry */ pd_port_states[port_idx].epr_active = 0xff; + /* the transition ended, release the transition throttle */ + update_pmf_events(BIT(PD_PROGRESS_ENTER_EPR_MODE), 0); + update_pmf_events(BIT(PD_PROGRESS_EXIT_EPR_MODE), 0); } } diff --git a/zephyr/program/framework/src/cypress_pd_common.c b/zephyr/program/framework/src/cypress_pd_common.c index af4bb255c5..961987a27a 100644 --- a/zephyr/program/framework/src/cypress_pd_common.c +++ b/zephyr/program/framework/src/cypress_pd_common.c @@ -2054,6 +2054,11 @@ void cypd_port_int(int controller, int port) case CCG_RESPONSE_PORT_CONNECT: CPRINTS("CYPD_RESPONSE_PORT_CONNECT %d", port_idx); record_ucsi_connector_change_event(controller, port); +#ifdef CONFIG_PD_CCG8_EPR + /* the EPR fail latch applies to the failed connection only */ + if (pd_port_states[port_idx].epr_active == 0xff) + pd_port_states[port_idx].epr_active = 0; +#endif cypd_update_port_state(controller, port); cypd_evaluate_port_profile(controller, port, data2[0]); break;