diff options
author | Vincent Palatin <vpalatin@chromium.org> | 2014-06-25 10:50:12 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-07-03 02:55:38 +0000 |
commit | f9c24c37c46b24ce8a0ee1c7b914a87bb61fbe8a (patch) | |
tree | 9a8cfa00d385cf053c3a43ac771f7ff3a26e2933 | |
parent | 2ebf92a0a84e259d86b7c29bed753ca068913aed (diff) | |
download | chrome-ec-f9c24c37c46b24ce8a0ee1c7b914a87bb61fbe8a.tar.gz |
zinger: update OVP latch condition
The Over Voltage Protection was de-activated when the output is disabled
to avoid false positive when doing a down voltage transition,
but as a side effect, we might reset the OVP while the fault is still
present since the OVP first disables the output.
So, we want to keep testing the OVP fault condition if there is a
pre-existing fault.
Also add a hysteris and ensure we recover from OVP only when we go under
the new threshold.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=chrome-os-partner:28331
TEST=trigger an OVP using a voltage source and see the output is not
re-enabled until we shutdown the voltage source.
Change-Id: Idef3f630c3cfeb301e62f1e75c2a424b56bc98dd
Reviewed-on: https://chromium-review.googlesource.com/206185
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/zinger/usb_pd_policy.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/board/zinger/usb_pd_policy.c b/board/zinger/usb_pd_policy.c index f6f0fdeb73..fcb8168542 100644 --- a/board/zinger/usb_pd_policy.c +++ b/board/zinger/usb_pd_policy.c @@ -94,6 +94,8 @@ static timestamp_t fault_deadline; #define UVP_MV(mv) VBUS_MV((mv) * 8 / 10) /* Over-voltage limit is 1.2x Vnom */ #define OVP_MV(mv) VBUS_MV((mv) * 12 / 10) +/* Over-voltage recovery threshold is 1.1x Vnom */ +#define OVP_REC_MV(mv) VBUS_MV((mv) * 11 / 10) /* ----------------------- USB Power delivery policy ---------------------- */ @@ -111,11 +113,12 @@ static const struct { enum volt select; /* GPIO configuration to select the voltage */ int uvp; /* under-voltage limit in mV */ int ovp; /* over-voltage limit in mV */ + int ovp_rec;/* over-voltage recovery threshold in mV */ } voltages[ARRAY_SIZE(pd_src_pdo)] = { - {VO_5V, UVP_MV(5000), OVP_MV(5000)}, - {VO_5V, UVP_MV(5000), OVP_MV(5000)}, - {VO_12V, UVP_MV(12000), OVP_MV(12000)}, - {VO_20V, UVP_MV(20000), OVP_MV(20000)}, + {VO_5V, UVP_MV(5000), OVP_MV(5000), OVP_REC_MV(5000)}, + {VO_5V, UVP_MV(5000), OVP_MV(5000), OVP_REC_MV(5000)}, + {VO_12V, UVP_MV(12000), OVP_MV(12000), OVP_REC_MV(12000)}, + {VO_20V, UVP_MV(20000), OVP_MV(20000), OVP_REC_MV(20000)}, }; /* currently selected PDO entry */ @@ -210,7 +213,8 @@ int pd_board_checks(void) fault_deadline.val = get_time().val + OCP_TIMEOUT; return EC_ERROR_INVAL; } - if (output_is_enabled() && (vbus_volt > voltages[volt_idx].ovp)) { + if ((output_is_enabled() && (vbus_volt > voltages[volt_idx].ovp)) || + (fault && (vbus_volt > voltages[volt_idx].ovp_rec))) { debug_printf("OverVoltage : %d mV\n", vbus_volt * VDDA_MV * VOLT_DIV / ADC_SCALE); /* TODO(crosbug.com/p/28331) discharge */ |