summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Herrmann <eherrmann@chromium.org>2020-11-30 12:24:18 -0800
committerCommit Bot <commit-bot@chromium.org>2020-12-21 23:10:11 +0000
commit9b2fa9111e3f92590f6a6f28b36aebf18cc15bb0 (patch)
tree728cd388e158d8d597dc4e57e1e221ab432a5092
parentfe951556a7be3bc68b342dc941be13ff4f82f41b (diff)
downloadchrome-ec-9b2fa9111e3f92590f6a6f28b36aebf18cc15bb0.tar.gz
SYV682x: Stop VCONN configuration if there is OVP
If a VBAT OVP is triggered while VCONN is being configured, a PPC re-init will reset the PPC. But, the VCONN configuration would undo this because it is a RMW. Instead, if VBAT OVP is triggered, don't update the VCONN state. BUG=b:171461736 TEST=On a Voxel which experiences VBAT OVPs, ensure that it recovers from these TEST=make buildall BRANCH=None Signed-off-by: Eric Herrmann <eherrmann@chromium.org> Change-Id: I427c43144c8774627783908c0d921fa170686f7f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2572236 Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--driver/ppc/syv682x.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/driver/ppc/syv682x.c b/driver/ppc/syv682x.c
index ed3fc5a502..3d2142e76f 100644
--- a/driver/ppc/syv682x.c
+++ b/driver/ppc/syv682x.c
@@ -274,7 +274,7 @@ static void syv682x_handle_status_interrupt(int port, int regval)
}
}
-static void syv682x_handle_control_4_interrupt(int port, int regval)
+static int syv682x_handle_control_4_interrupt(int port, int regval)
{
/*
* VCONN OC is actually notifying that it is current limiting
@@ -305,13 +305,16 @@ static void syv682x_handle_control_4_interrupt(int port, int regval)
* On VBAT OVP, CC/VCONN are cut. Re-enable before sending the hard
* reset using a PPC re-init. We could reconfigure CC based on flags,
* but these will be updated anyway due to a hard reset so just re-init
- * for simplicity.
+ * for simplicity. If this happens return an error since this isn't
+ * recoverable.
*/
if (regval & SYV682X_CONTROL_4_VBAT_OVP) {
ppc_prints("VBAT or CC OVP!", port);
syv682x_init(port);
pd_handle_cc_overvoltage(port);
+ return EC_ERROR_UNKNOWN;
}
+ return EC_SUCCESS;
}
static int syv682x_vbus_sink_enable(int port, int enable)
@@ -457,7 +460,9 @@ static int syv682x_set_vconn(int port, int enable)
* register value to see if there are interrupts to avoid race
* conditions with the interrupt handler
*/
- syv682x_handle_control_4_interrupt(port, regval);
+ rv = syv682x_handle_control_4_interrupt(port, regval);
+ if (rv)
+ return rv;
regval &= ~(SYV682X_CONTROL_4_VCONN2 | SYV682X_CONTROL_4_VCONN1);
if (enable) {