summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAbe Levkoy <alevkoy@chromium.org>2020-12-23 14:48:35 -0700
committerCommit Bot <commit-bot@chromium.org>2021-01-22 00:01:46 +0000
commitcc65a4bc8a1a39cd884878e3d57e1325493895b7 (patch)
tree1a89a1c572fa46c008be9b6d01d6f48c658616c3 /common
parent9231ab69831726630be34f08cb4dfe61846872ec (diff)
downloadchrome-ec-cc65a4bc8a1a39cd884878e3d57e1325493895b7.tar.gz
TCPMv2: Ignore BIST messages when appropriate
Ignore BIST messages when not operating at vSafe5V. Ignore unsupported BIST modes. BUG=b:169385081 TEST=make buildall BRANCH=firmware-volteer-13672.B-main Signed-off-by: Abe Levkoy <alevkoy@chromium.org> Change-Id: Ia7504cf0f7cf16273aa641edb364eef7e666a3ff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2602720 Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/usbc/usb_pe_drp_sm.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index dc336386dc..fe2c7baec2 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -10,6 +10,8 @@
#include "charge_state.h"
#include "common.h"
#include "console.h"
+#include "driver/tcpm/tcpm.h"
+#include "ec_commands.h"
#include "hooks.h"
#include "host_command.h"
#include "stdbool.h"
@@ -4817,6 +4819,21 @@ static void pe_bist_tx_entry(int port)
print_current_state(port);
+ /*
+ * Ignore BIST messages when not operating at vSafe5V. If charge_manager
+ * isn't enabled, but PD has gotten this far, then VBUS should be at
+ * vSafe5V.
+ */
+ if (IS_ENABLED(CONFIG_CHARGE_MANAGER)) {
+ int vbus_voltage_mv = charge_manager_get_vbus_voltage(port);
+
+ if (vbus_voltage_mv < PD_V_SAFE5V_MIN ||
+ vbus_voltage_mv > PD_V_SAFE5V_MAX) {
+ pe_set_ready_state(port);
+ return;
+ }
+ }
+
if (mode == BIST_CARRIER_MODE_2) {
/*
* PE_BIST_Carrier_Mode embedded here.
@@ -4839,6 +4856,10 @@ static void pe_bist_tx_entry(int port)
* sending Hard Reset Signaling to reset the UUT.
*/
pe[port].bist_cont_mode_timer = TIMER_DISABLED;
+ } else {
+ /* Ignore unsupported BIST messages. */
+ pe_set_ready_state(port);
+ return;
}
}