diff options
author | Shawn Nematbakhsh <shawnn@chromium.org> | 2015-10-19 11:13:50 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-10-27 13:19:51 -0700 |
commit | 2bd7dce32eed716b850c370f79717ad47da17c01 (patch) | |
tree | cdbb8d838c14d8e49ca159731e0f12a051c64235 /include | |
parent | cb4a76e8022c73fb0a0b50700912d86f41ea3dbb (diff) | |
download | chrome-ec-2bd7dce32eed716b850c370f79717ad47da17c01.tar.gz |
charger: Add LIMIT_POWER charger param for low bat + weak charger
Add support for two new configs to specify critical energy battery
percentage and critical external charger power. When we are under both
thresholds, set the LIMIT_POWER charger parameter to inform the AP that it
should conserve power to avoid brownout, and consider jumping to EC RW
to negotiate PD.
In addition, modify the existing CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON
to allow power-up regardless of power level if a 15W+ charger is
attached, since there is a reasonable chance it may speak PD and provide
sufficient power to boot the AP.
BUG=chromium:537269
TEST=Manual on Glados. Set CHG_MW thresh to 20000, BAT_PCT to 50. Verify
that LIMIT_POWER charger param is set until Zinger negotiates to 20V. Also
veify that system can boot with Donette.
BRANCH=None
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: Ic963c82fea4ad10e8a5d7e476c5ce3e5ae525dad
Reviewed-on: https://chromium-review.googlesource.com/306774
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/charge_manager.h | 3 | ||||
-rw-r--r-- | include/config.h | 8 | ||||
-rw-r--r-- | include/ec_commands.h | 5 |
3 files changed, 16 insertions, 0 deletions
diff --git a/include/charge_manager.h b/include/charge_manager.h index 6cfd6cc7ce..d3f14117b5 100644 --- a/include/charge_manager.h +++ b/include/charge_manager.h @@ -74,6 +74,9 @@ int charge_manager_get_override(void); /* Returns the current active charge port, as determined by charge manager */ int charge_manager_get_active_charge_port(void); +/* Return the power limit (uW) set by charge manager. */ +int charge_manager_get_power_limit_uw(void); + #ifdef CONFIG_USB_PD_LOGGING /* Save power state log entry for the given port */ void charge_manager_save_log(int port); diff --git a/include/config.h b/include/config.h index 26fced9a46..8f8469f3da 100644 --- a/include/config.h +++ b/include/config.h @@ -400,6 +400,14 @@ #undef CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON /* + * Low energy thresholds - when battery level is below BAT_PCT and an external + * charger provides less than CHG_MW of power, inform the AP of the situation + * through the LIMIT_POWER host event. + */ +#undef CONFIG_CHARGER_LIMIT_POWER_THRESH_BAT_PCT +#undef CONFIG_CHARGER_LIMIT_POWER_THRESH_CHG_MW + +/* * Equivalent of CONFIG_BATTERY_OVERRIDE_PARAMS for use with * CONFIG_CHARGER_V2 */ diff --git a/include/ec_commands.h b/include/ec_commands.h index b959db783e..54f91e3054 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -2839,6 +2839,11 @@ enum charge_state_params { CS_PARAM_CHG_INPUT_CURRENT, /* charger input current limit */ CS_PARAM_CHG_STATUS, /* charger-specific status */ CS_PARAM_CHG_OPTION, /* charger-specific options */ + CS_PARAM_LIMIT_POWER, /* + * Check if power is limited due to + * low battery and / or a weak external + * charger. READ ONLY. + */ /* How many so far? */ CS_NUM_BASE_PARAMS, |