summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-04-02 15:52:31 +0800
committerChromeBot <chrome-bot@google.com>2013-04-02 20:42:48 -0700
commit13c74da5ade0b98c9c024bf72e0c78c5155a8d08 (patch)
tree7143a4f6cb56532d93179522ae6dc9eb993eda20 /util
parent3c9827a64643008fbac1970871097512c6a24293 (diff)
downloadchrome-ec-13c74da5ade0b98c9c024bf72e0c78c5155a8d08.tar.gz
spring: Add host command to limit external power current
This is useful for debugging and the factory. BUG=chrome-os-partner:18530 TEST=On spring, check we can set PWM duty cycle and can go back to automatic control. BRANCH=spring Change-Id: I3da75f0a356cc0f21d748bf135e3b95fbd9c465b Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47105 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'util')
-rw-r--r--util/ectool.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c
index 0332ea6c45..09166b4ae3 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -28,6 +28,8 @@ static inline int MIN(int a, int b) { return a < b ? a : b; }
const char help_str[] =
"Commands:\n"
+ " extpwrcurrentlimit\n"
+ " Set the maximum external power current\n"
" autofanctrl <on>\n"
" Turn on automatic fan speed control.\n"
" backlight <enabled>\n"
@@ -2024,6 +2026,29 @@ int cmd_lcd_backlight(int argc, char *argv[])
}
+int cmd_ext_power_current_limit(int argc, char *argv[])
+{
+ struct ec_params_ext_power_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_EXT_POWER_CURRENT_LIMIT, 0, &p, sizeof(p),
+ NULL, 0);
+ return rv;
+}
+
+
int cmd_charge_current_limit(int argc, char *argv[])
{
struct ec_params_current_limit p;
@@ -2730,6 +2755,7 @@ struct command {
/* NULL-terminated list of commands */
const struct command commands[] = {
+ {"extpwrcurrentlimit", cmd_ext_power_current_limit},
{"autofanctrl", cmd_thermal_auto_fan_ctrl},
{"backlight", cmd_lcd_backlight},
{"battery", cmd_battery},