diff options
author | Wai-Hong Tam <waihong@google.com> | 2022-02-14 18:11:14 -0800 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-09-20 00:30:51 +0000 |
commit | 7c2fa195590a1e496fe97ac10cc545138a66699c (patch) | |
tree | 306959b00a61cd4ea9e83e7e7449875f52746620 /common/charger.c | |
parent | 145cc9689197c98c509fc4bd7352adc3daf2c092 (diff) | |
download | chrome-ec-7c2fa195590a1e496fe97ac10cc545138a66699c.tar.gz |
herobrine: Wait negotiated VBUS transition before enabling 5V rail
Previous, the PP5000 is enabled at GPIO init. In the dead battery
case, enabling PP5000 overloads the battery charger at the initial
5V 500mA supply. We want to defer it until the PD negotiated VBUS
transition, so the battery charger won't be overloaded.
A window of PD negotiation is created. It starts from the Type-C
state reaching Attached.SNK, and eneds when the PD contract is
created. The VBUS may be raised anytime in this window.
The current implementation is the worst case scenario. Every message
the PD negotiation is received at the last moment before timeout.
The extra time is added to compensate the delay internally, like the
decision of the DPM.
The unit tests are added.
BRANCH=None
BUG=b:215726554
TEST=Booted the Herobrine board with no-battery. The 5V rail got
delayed.
Change-Id: I5529762de3495e4cb6702e887bf6ee09d1711f14
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3501013
Reviewed-by: Sam Hurst <shurst@google.com>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Diffstat (limited to 'common/charger.c')
-rw-r--r-- | common/charger.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/charger.c b/common/charger.c index 81404ed275..c19dd85832 100644 --- a/common/charger.c +++ b/common/charger.c @@ -778,3 +778,10 @@ enum ec_error_list charger_enable_linear_charge(int chgnum, bool enable) return EC_ERROR_UNIMPLEMENTED; } + +#ifdef CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON +inline int charger_get_min_bat_pct_for_power_on(void) +{ + return CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON; +} +#endif |