Skip to content

Commit ce5c251

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 a5f07f8 commit ce5c251

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

zephyr/program/framework/src/cypress_pd_common.c

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

13981398
int cypd_get_active_port_voltage(void)
13991399
{
1400+
if (prev_charge_port == -1)
1401+
return 0;
1402+
14001403
return pd_port_states[prev_charge_port].voltage;
14011404
}
14021405

0 commit comments

Comments
 (0)