Skip to content

Commit 481046e

Browse files
JohnWC-Yehquinchou77
authored andcommitted
fwk: pd: return 0 voltage when no active charge port
For commit c7d2e2c. When no AC is connected, prev_charge_port is -1. In such cases, cypd_get_active_port_voltage() should return 0 instead of accessing pd_port_states[-1], since there is no valid PD voltage without AC. BRANCH=fwk-main BUG=PD voltage gets a non 0 value when unplugging the AC TEST=unplug AC and check the EC log "3lv-buck update! V:0mV" Signed-off-by: johnwc_yeh <JohnWC_Yeh@compal.com> (cherry picked from commit 3712efbeae1a3604f02e4aa5e7223f3e3778e52a)
1 parent 259a1d9 commit 481046e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

zephyr/program/framework/src/cypress_pd_common.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,9 @@ int cypd_get_ac_power(void)
14051405

14061406
int cypd_get_active_port_voltage(void)
14071407
{
1408+
if (prev_charge_port == -1)
1409+
return 0;
1410+
14081411
return pd_port_states[prev_charge_port].voltage;
14091412
}
14101413

0 commit comments

Comments
 (0)