summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-02-27 13:36:53 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-02-28 03:46:30 +0000
commit8fe9304ae24d736698f8c7d02b299b8c815de91f (patch)
tree889ffd575683f3b600853a679c0ef21bf7908131
parent9bdbc71c455ccc11c98892f44ebc7a629ae341e2 (diff)
downloadchrome-ec-8fe9304ae24d736698f8c7d02b299b8c815de91f.tar.gz
samus: don't unwedge charging when purposely discharging on AC
For factory testing, when purposely discharging on AC, don't automatically detect and unwedged charge circuit. BUG=chrome-os-partner:37171 BRANCH=samus TEST=plug in AC and run: "ectool chargecontrol discharge". check on ec console that battery is discharging. let sit for 3 minutes and make sure charge circuit unwedge code never runs. run "ectool chargecontrol normal" and make sure battery starts charging again. Also force discharge with "ectool chargecontrol discharge" and then unplug and replug AC, make sure battery is not charging nor discharging, then set mode back to normal and make sure we start charging again. Tested without this CL and everytime you force discharge the charge unwedge is activated and messes everything up. Change-Id: Icc7a504c148e1e08777e7aafce64ff4cc38a32c5 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/254722 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
-rw-r--r--board/samus/board.c17
-rw-r--r--board/samus/board.h1
-rw-r--r--board/samus/extpower.c8
3 files changed, 23 insertions, 3 deletions
diff --git a/board/samus/board.c b/board/samus/board.c
index 9dfcd1a8b4..9002e0e92f 100644
--- a/board/samus/board.c
+++ b/board/samus/board.c
@@ -229,12 +229,27 @@ enum battery_present battery_is_present(void)
}
#endif
+static int discharging_on_ac;
+
/**
* Discharge battery when on AC power for factory test.
*/
int board_discharge_on_ac(int enable)
{
- return charger_discharge_on_ac(enable);
+ int rv = charger_discharge_on_ac(enable);
+
+ if (rv == EC_SUCCESS)
+ discharging_on_ac = enable;
+
+ return rv;
+}
+
+/**
+ * Check if we are discharging while connected to AC
+ */
+int board_is_discharging_on_ac(void)
+{
+ return discharging_on_ac;
}
/* Base Sensor mutex */
diff --git a/board/samus/board.h b/board/samus/board.h
index 59a59841be..c6a6b64ec4 100644
--- a/board/samus/board.h
+++ b/board/samus/board.h
@@ -177,6 +177,7 @@ enum als_id {
/* Discharge battery when on AC power for factory test. */
int board_discharge_on_ac(int enable);
+int board_is_discharging_on_ac(void);
/* Backboost detected interrupt */
void bkboost_det_interrupt(enum gpio_signal signal);
diff --git a/board/samus/extpower.c b/board/samus/extpower.c
index 8a73c91a56..b842f7d3ea 100644
--- a/board/samus/extpower.c
+++ b/board/samus/extpower.c
@@ -398,8 +398,12 @@ void extpower_task(void)
while (1) {
if (task_wait_event(CHARGE_WEDGE_CHECK_INTERVAL) ==
TASK_EVENT_TIMER) {
- /* Periodically check if charge circuit is wedged */
- check_charge_wedged();
+ /*
+ * If we are NOT purposely discharging on AC, then
+ * periodically check if charge circuit is wedged.
+ */
+ if (!board_is_discharging_on_ac())
+ check_charge_wedged();
} else {
/* Must have received power change interrupt */
extpower = extpower_is_present();