diff options
author | Alec Berg <alecaberg@chromium.org> | 2015-02-23 14:13:37 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-02-25 03:32:50 +0000 |
commit | f6cff1fa6bead660a12222615f84f3f930a5e6f2 (patch) | |
tree | 7a86994f8f757a5d36b5ea63b0a6308a0044fb97 /board | |
parent | d2964ba0cf936dc46da3b8f102a420483d0e69d2 (diff) | |
download | chrome-ec-f6cff1fa6bead660a12222615f84f3f930a5e6f2.tar.gz |
samus: make sure EC sends battery percentage to PD on change
Make sure the EC sends the battery state of charge to the PD every
time it changes.
BUG=none
BRANCH=samus
TEST=create command to fake battery percentage in
driver/battery/smart.c:
static int cmd_battfake(int argc, char **argv)
{
char *e;
if (argc > 1)
batt_fake = strtoi(argv[1], &e, 0);
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(battfake, cmd_battfake, NULL, "", NULL);
and in battery_get_params():
if (batt_cap > -1)
batt_new.remaining_capacity = batt_cap;
On samus use battfake command to change battery percentage back and
forth every few seconds for minutes and make sure the PD receives
host command 0x100 and that it is still happy.
Change-Id: Ic69ab2af900fa2a38e3d2f6562675684487f556e
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/252350
Reviewed-by: Shawn N <shawnn@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/samus/extpower.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/board/samus/extpower.c b/board/samus/extpower.c index 1da30de076..8a73c91a56 100644 --- a/board/samus/extpower.c +++ b/board/samus/extpower.c @@ -119,8 +119,10 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, cancel_charging_cutoff, HOOK_PRIO_DEFAULT); static void batt_soc_change(void) { /* If in S0, leave charging alone */ - if (chipset_in_state(CHIPSET_STATE_ON)) + if (chipset_in_state(CHIPSET_STATE_ON)) { + host_command_pd_send_status(PD_CHARGE_NO_CHANGE); return; + } /* Check to disable or enable charging based on batt state of charge */ if (!charge_is_disabled && charge_get_percent() == 100) { @@ -129,6 +131,9 @@ static void batt_soc_change(void) } else if (charge_is_disabled && charge_get_percent() < 100) { charge_is_disabled = 0; host_command_pd_send_status(PD_CHARGE_5V); + } else { + /* Leave charging alone, but update battery SOC */ + host_command_pd_send_status(PD_CHARGE_NO_CHANGE); } } DECLARE_HOOK(HOOK_BATTERY_SOC_CHANGE, batt_soc_change, HOOK_PRIO_DEFAULT); |