summaryrefslogtreecommitdiff
path: root/common/charger.c
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2018-05-31 11:19:41 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-06-01 17:44:41 -0700
commit32255f2989a2087479c0a0f440290ce1efc3e4f4 (patch)
tree33cf653a77fcce3a9b11365bd32df2a6b45fa357 /common/charger.c
parenta011b79bfb73e121fc86da7e6d448161dab9fa91 (diff)
downloadchrome-ec-32255f2989a2087479c0a0f440290ce1efc3e4f4.tar.gz
chgstv2: Fix manual control via EC console.
There was a recent change to save the manual setting of charge current and voltage, however it was done so assuming that the parameters were set via the host command interface. (CL:922069) However, there are times where the charge voltage/current would like to be manipulated without booting the AP. This commit simply makes the EC console command work again. BUG=None BRANCH=None TEST=make -j buildall TEST=Flash nocturne, `chgstate idle on; charger current 256; charger voltage 7400`; verify that the charge voltage and current is actually changed. Change-Id: Id250d9704f8509162518495556603950248fb267 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/1081120 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org>
Diffstat (limited to 'common/charger.c')
-rw-r--r--common/charger.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/charger.c b/common/charger.c
index 35e73cccba..f43ada4ff2 100644
--- a/common/charger.c
+++ b/common/charger.c
@@ -6,6 +6,7 @@
*/
#include "battery_smart.h"
+#include "charge_state_v2.h"
#include "charger.h"
#include "common.h"
#include "console.h"
@@ -187,11 +188,17 @@ static int command_charger(int argc, char **argv)
d = strtoi(argv[2], &e, 0);
if (*e)
return EC_ERROR_PARAM2;
+#ifdef CONFIG_CHARGER_V2
+ chgstate_set_manual_current(d);
+#endif /* CONFIG_CHARGER_V2 */
return charger_set_current(d);
} else if (strcasecmp(argv[1], "voltage") == 0) {
d = strtoi(argv[2], &e, 0);
if (*e)
return EC_ERROR_PARAM2;
+#ifdef CONFIG_CHARGER_V2
+ chgstate_set_manual_voltage(d);
+#endif /* CONFIG_CHARGER_V2 */
return charger_set_voltage(d);
} else if (strcasecmp(argv[1], "dptf") == 0) {
d = strtoi(argv[2], &e, 0);