Skip to content

Commit b9907b9

Browse files
Josh-Tsaiquinchou77
authored andcommitted
fwk: CCG8: set the active current limit before multi-port switching
When the EC processes a multi-port switch, the sink path is enabled first, and then the input current limit for the active port is set. This sequence can cause a lower power adapter to operate with a higher input current limit , potentially triggering an OCP event. To ensure the adapter operates within a safe operating current, the EC should set the input current limit to the active one before enabling the sink path or completing the multi-port switching. BRANCH=fwk-main BUG=https://app.clickup.com/t/86ev81hyn TEST=The EC log will not print the AC off during the multi-port switching Signed-off-by: Josh Tsai <Josh_Tsai@compal.com> (cherry picked from commit 3c8aa8752ef20f0d49b177a0f1e8ac1c8e7611bd)
1 parent 2ca443b commit b9907b9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

zephyr/program/framework/src/cypress_pd_common.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,6 +1639,17 @@ int board_set_active_charge_port(int charge_port)
16391639
prev_charge_port != charge_port) {
16401640
/* Turn off the previous charge port before turning on the next port */
16411641
cypd_cfet_vbus_control(prev_charge_port, false, true);
1642+
1643+
/**
1644+
* Multi-port switch, we should force set the current limit to the active
1645+
* port before enabling the sink path.
1646+
*/
1647+
if (charge_port != -1) {
1648+
if (IS_ENABLED(CONFIG_PLATFORM_EC_CHARGE_MANAGER)) {
1649+
charger_set_input_current_limit(0,
1650+
pd_port_states[charge_port].current);
1651+
}
1652+
}
16421653
#ifdef CONFIG_BOARD_LOTUS
16431654
board_disable_bypass_oneshot();
16441655

0 commit comments

Comments
 (0)