summaryrefslogtreecommitdiff
path: root/util/ectool.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/ectool.c')
-rw-r--r--util/ectool.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c
index eaf1147950..b8f7d45226 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -36,6 +36,8 @@ const char help_str[] =
" Prints battery info\n"
" batterycutoff\n"
" Cut off battery output power\n"
+ " chargecurrentlimit\n"
+ " Set the maximum battery charging current\n"
" chargedump\n"
" Dump the context of charge state machine\n"
" chargeforceidle\n"
@@ -1974,6 +1976,29 @@ int cmd_lcd_backlight(int argc, char *argv[])
}
+int cmd_charge_current_limit(int argc, char *argv[])
+{
+ struct ec_params_current_limit p;
+ int rv;
+ char *e;
+
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <max_current_mA>\n", argv[0]);
+ return -1;
+ }
+
+ p.limit = strtol(argv[1], &e, 0);
+ if (e && *e) {
+ fprintf(stderr, "Bad value.\n");
+ return -1;
+ }
+
+ rv = ec_command(EC_CMD_CHARGE_CURRENT_LIMIT, 0, &p, sizeof(p),
+ NULL, 0);
+ return rv;
+}
+
+
int cmd_charge_force_idle(int argc, char *argv[])
{
struct ec_params_force_idle p;
@@ -2669,6 +2694,7 @@ const struct command commands[] = {
{"backlight", cmd_lcd_backlight},
{"battery", cmd_battery},
{"batterycutoff", cmd_battery_cut_off},
+ {"chargecurrentlimit", cmd_charge_current_limit},
{"chargedump", cmd_charge_dump},
{"chargeforceidle", cmd_charge_force_idle},
{"chipinfo", cmd_chipinfo},