diff options
author | Bill Richardson <wfrichar@chromium.org> | 2014-04-04 09:10:14 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-04-05 01:42:21 +0000 |
commit | f06ad7e2ab4fa1a03c2e48a8bca3fdf2abbdffa9 (patch) | |
tree | 96cbbda28b09d2ac48199ae39ad91c2c8fd47eb0 /driver | |
parent | 3e1db94ea03e43c37a165a5dd2f1693a54dbfefd (diff) | |
download | chrome-ec-f06ad7e2ab4fa1a03c2e48a8bca3fdf2abbdffa9.tar.gz |
Add host command to control charge state v2
This replaces the obsolete and temporary (ha!) EC_CMD_CHARGE_DUMP host
command with EC_CMD_CHARGE_STATE. This is used to monitor and adjust the new
charge state implementation, including any board-specific customizations.
This command is a single catch-all command with multiple subcommands
(similar to EC_CMD_LIGHTBAR_CMD) so that we don't have to keep adding new
top-level host commands just to support incremental changes.
BUG=chrome-os-partner:23776
BRANCH=ToT
TEST=manual
From the AP, try these commands:
ectool chargestate show
ectool chargestate param
ectool chargestate param <NUM>
ectool chargestate param <NUM> <VALUE>
Watch the EC console and use its "chg" command to verify the effects of
setting various params.
Note: the Samus-specific fast-charging profile override is param 0x10000.
You can check it with the EC console "fastcharge" command.
Change-Id: Iad2f773a085bc25c05073b3eed9866f122ae9d78
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/193305
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r-- | driver/battery/samus.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/driver/battery/samus.c b/driver/battery/samus.c index d99a2397a6..41519261d8 100644 --- a/driver/battery/samus.c +++ b/driver/battery/samus.c @@ -7,6 +7,7 @@ #include "charge_state.h" #include "console.h" +#include "ec_commands.h" #include "util.h" static const struct battery_info info = { @@ -112,6 +113,29 @@ int charger_profile_override(struct charge_state_data *curr) return 0; } +/* Customs options controllable by host command. */ +#define PARAM_FASTCHARGE (CS_PARAM_CUSTOM_PROFILE_MIN + 0) + +enum ec_status charger_profile_override_get_param(uint32_t param, + uint32_t *value) +{ + if (param == PARAM_FASTCHARGE) { + *value = fast_charging_allowed; + return EC_RES_SUCCESS; + } + return EC_RES_INVALID_PARAM; +} + +enum ec_status charger_profile_override_set_param(uint32_t param, + uint32_t value) +{ + if (param == PARAM_FASTCHARGE) { + fast_charging_allowed = value; + return EC_RES_SUCCESS; + } + return EC_RES_INVALID_PARAM; +} + static int command_fastcharge(int argc, char **argv) { if (argc > 1 && !parse_bool(argv[1], &fast_charging_allowed)) |