summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-02-06 11:35:11 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-02-07 02:16:23 +0000
commit8d617567ca52d12352239ac5d4497ecc9620d1bd (patch)
tree4ebe1d2353d8f80d7c2cd2ee75dee8bf608296ca
parentc2eb14b9d1d3cec317354faeabb83572d29e379e (diff)
downloadchrome-ec-8d617567ca52d12352239ac5d4497ecc9620d1bd.tar.gz
samus: give more time for recovery from charge circuit wedged
On some systems, recovering from charge circuit being wedged doesn't happen immediately, and we end up constantly detecting charge circuit wedged problems and recovering from it. This CL adds a counter to check_charge_wedged() and reads PROCHOT but does not trigger the charge circuit wedged until after a certain number of checks after the last charge wedged condition. This allows more time for the condition to magically go away before intervening. BUG=chrome-os-partner:36081 BRANCH=samus TEST=found two units that were regularly detecting charge circuit wedged and recovering from it (every 4 seconds, 2 seconds before detecting the issue and 2 seconds to recover). on one unit, the problem went away on its own. On the second unit, I loaded this CL into RO, and ToT in RW, then verified that RO does not continually trigger charge circuit wedged problems, while RW still does. Change-Id: I4c4e5c52ad382f178696d61c7b36faf9e8978926 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/247160 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
-rw-r--r--board/samus/extpower.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/board/samus/extpower.c b/board/samus/extpower.c
index 8fb397f0cb..5cb97c39ca 100644
--- a/board/samus/extpower.c
+++ b/board/samus/extpower.c
@@ -206,6 +206,7 @@ static void extpower_board_hacks(int extpower, int extpower_prev)
static void check_charge_wedged(void)
{
int rv, prochot_status;
+ static int counts_since_wedged;
if (charge_circuit_state == CHARGE_CIRCUIT_OK) {
/* Check PROCHOT warning */
@@ -220,12 +221,19 @@ static void check_charge_wedged(void)
* Note: learn mode is critical here because when in this state
* backboosting causes >20V on boostin even after PD disables
* CHARGE_EN lines.
+ *
+ * If we were recently wedged, then give ourselves a free pass
+ * here. This gives an opportunity for reading the PROCHOT
+ * status to clear it if the error has gone away.
*/
- if (prochot_status) {
+ if (prochot_status && counts_since_wedged >= 2) {
+ counts_since_wedged = 0;
host_command_pd_send_status(PD_CHARGE_NONE);
charger_disable(1);
charge_circuit_state = CHARGE_CIRCUIT_WEDGED;
CPRINTS("Charge circuit wedged!");
+ } else {
+ counts_since_wedged++;
}
} else {
/*