summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Yung-Chieh Lo <yjlou@chromium.org>2014-04-23 16:39:32 -0700
committerYung-chieh Lo <yjlou@chromium.org>2014-04-25 00:25:09 +0000
commitf185c9eb8defb2763588b273084fd13fb9757e70 (patch)
tree2ca5d4a84a5ce3a599dfa9c931ac29461f5e29cd
parent4cf1a729d72ee29daad22b288ce1ad5c3ff8dca3 (diff)
downloadchrome-ec-f185c9eb8defb2763588b273084fd13fb9757e70.tar.gz
charger v2: only configure charger when AC is on.
The CL fcf26a4 enabled periodically charge_request(). However, that could fail and generates lots of error message in the EC console if the AC is not on and charger refuses the request (even it is 0v/0mA). BUG=none BRANCH=tot,nyan TEST=make runtests. Tested on big. Expect NO below annoying error message [1.353104 charge_request(0mV, 0mA)] [1.453170 charge_request(0mV, 0mA)] [1.553281 charge_request(0mV, 0mA)] [1.653317 charge_request(0mV, 0mA)] in the follwing cases: AC on, battery attached, power on, then remove/plug in AC. AC on, battery attached, power on, then remove/plug in battery. AC on, battery removed, power on, then plug in and remove battery. AC off, battery attached, power on, then plug in and remove AC. 'chgstate' also shows good state. At final, charge for 10 mins. Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/196678 Reviewed-by: Lin Cloud <cloud_lin@compal.com> Tested-by: Lin Cloud <cloud_lin@compal.com> Reviewed-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-by: Bill Richardson <wfrichar@chromium.org> (cherry picked from commit b0409436adcf68cda3bf70a2964b9fdee599189a) Change-Id: I7d89a8ce8c4de3d35fb7e540813e296f8a764cf3 Original-Change-Id: I22cbf13debcb55a64f50af0e774e6934f07dbeda Reviewed-on: https://chromium-review.googlesource.com/196947 Reviewed-by: Yung-chieh Lo <yjlou@chromium.org> Commit-Queue: Yung-chieh Lo <yjlou@chromium.org> Tested-by: Yung-chieh Lo <yjlou@chromium.org>
-rw-r--r--common/charge_state_v2.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c
index 2527d7f92a..36addbe332 100644
--- a/common/charge_state_v2.c
+++ b/common/charge_state_v2.c
@@ -617,16 +617,21 @@ wait_for_it:
curr.requested_current =
charger_closest_current(curr.requested_current);
- /*
- * As a safety feature, some chargers will stop charging if
- * we don't communicate with it frequently enough. In manual
- * mode, we'll just tell it what it already knows
- */
- if (manual_mode) {
- charge_request(curr.chg.voltage, curr.chg.current);
- } else {
- charge_request(curr.requested_voltage,
- curr.requested_current);
+ /* Charger only accpets request when AC is on. */
+ if (curr.ac) {
+ /*
+ * As a safety feature, some chargers will stop
+ * charging if we don't communicate with it frequently
+ * enough. In manual mode, we'll just tell it what it
+ * knows.
+ */
+ if (manual_mode) {
+ charge_request(curr.chg.voltage,
+ curr.chg.current);
+ } else {
+ charge_request(curr.requested_voltage,
+ curr.requested_current);
+ }
}
/* How long to sleep? */