diff options
author | Louis Yung-Chieh Lo <yjlou@chromium.org> | 2014-04-23 16:39:32 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-04-24 19:42:37 +0000 |
commit | b0409436adcf68cda3bf70a2964b9fdee599189a (patch) | |
tree | 85bd0905fda577c8bb0276cd704c6233cdecccee | |
parent | e99512a45602f05b1873375748f517ebd5e943b2 (diff) | |
download | chrome-ec-b0409436adcf68cda3bf70a2964b9fdee599189a.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.
Change-Id: Icc729c52246df1ecfb7f289b5078dbc122b20a74
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>
-rw-r--r-- | common/charge_state_v2.c | 25 |
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? */ |