diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2018-08-13 15:53:42 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-08-17 11:17:47 -0700 |
commit | 986a7f2288ff8fee458013d4b96fe0323d9e2d90 (patch) | |
tree | 7abb08573bdf7979ee7dfd85b206666fa1041053 /common | |
parent | 7f3f8308afb350e6d35cce707ca220d87a8aad21 (diff) | |
download | chrome-ec-986a7f2288ff8fee458013d4b96fe0323d9e2d90.tar.gz |
chgstv2: Use lower charge threshold for boot if AC power is present
If one of the following conditions is met, EC boots AP:
1. Battery charge >= CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON
2. AC power >= CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
3. Battery charge >= CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC
and
AC power >= CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT
This reduces users' wait time significantly when a battery is drained.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=b:112172032
BRANCH=Nami
TEST=Verified Akali and Sona boot and perform soft sync successfully.
The power consumption is measured during boot and verified even worn
out battery can supply enough power to sustain the system together with
a 15W charger.
Change-Id: I3220b4660a1b50ba5ead8f570cb6992c0a30e390
Reviewed-on: https://chromium-review.googlesource.com/1177722
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/charge_state_v2.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/common/charge_state_v2.c b/common/charge_state_v2.c index 35c495d310..6f72d4e82b 100644 --- a/common/charge_state_v2.c +++ b/common/charge_state_v2.c @@ -1992,10 +1992,19 @@ int charge_prevent_power_on(int power_button_pressed) #if defined(CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON) && \ defined(CONFIG_CHARGE_MANAGER) /* However, we can power on if a sufficient charger is present. */ - if (prevent_power_on) + if (prevent_power_on) { if (charge_manager_get_power_limit_uw() >= CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON * 1000) prevent_power_on = 0; +#if defined(CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT) && \ + defined(CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC) + else if (charge_manager_get_power_limit_uw() >= + CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT * 1000 + && (current_batt_params->state_of_charge >= + CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC)) + prevent_power_on = 0; +#endif + } #endif /* CONFIG_CHARGE_MANAGER && CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON */ /* |