diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2021-02-01 10:06:15 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-12 03:00:46 +0000 |
commit | eb0d724fdf3e7ce15ac2b7c13403aefc355f718f (patch) | |
tree | 86575374d6ed7e6b8c3db10bd9ffdfd3091af827 /include | |
parent | 6776d3250648aab3c685c0a4de372094aba7d742 (diff) | |
download | chrome-ec-eb0d724fdf3e7ce15ac2b7c13403aefc355f718f.tar.gz |
pchg: Notify host of full charge
Currently, full charge status is implied by capacity = 100 and
PCHG_STATE_DETECTED (i.e. state='not charging'). If the charger
stops charging before 100% (for battery health control), this
condition doesn't work.
This patch makes PCHG send PCHG_STATE_FULL explicitly when it sees
the soc goes above the threshold in PCHG_STATE_DETECTED.
BUG=b:179390065,b:173235954
BRANCH=trogdor
TEST=CoachZ. Charge till 96% and verify PCHG0/state becomes 'Full'.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: I634f96992cdc7ef44b5e43544603cc5cc9b3a62d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691366
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/ec_commands.h | 3 | ||||
-rw-r--r-- | include/peripheral_charger.h | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/include/ec_commands.h b/include/ec_commands.h index 8f4e313ee4..d1f03e516a 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -6811,6 +6811,8 @@ enum pchg_state { PCHG_STATE_DETECTED, /* Device is being charged. */ PCHG_STATE_CHARGING, + /* Device is fully charged. It implies DETECTED (& not charging). */ + PCHG_STATE_FULL, }; #define EC_PCHG_STATE_TEXT { \ @@ -6819,6 +6821,7 @@ enum pchg_state { [PCHG_STATE_ENABLED] = "ENABLED", \ [PCHG_STATE_DETECTED] = "DETECTED", \ [PCHG_STATE_CHARGING] = "CHARGING", \ + [PCHG_STATE_FULL] = "FULL", \ } /*****************************************************************************/ diff --git a/include/peripheral_charger.h b/include/peripheral_charger.h index 1f7b3236f7..2ede2c6f2c 100644 --- a/include/peripheral_charger.h +++ b/include/peripheral_charger.h @@ -109,6 +109,8 @@ struct pchg_config { const int i2c_port; /* GPIO pin used for IRQ */ const enum gpio_signal irq_pin; + /* Full battery percentage */ + const uint8_t full_percent; }; /** |