diff options
author | Aseda Aboagye <aaboagye@google.com> | 2021-05-18 12:44:42 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-05-19 20:26:32 +0000 |
commit | 6b5ce8b509a6ca4dbf11258866dc36f4299e4f62 (patch) | |
tree | 5b5cbb444809e15473c9cc6b0d02e57a3281eb79 /common | |
parent | 848a2cb8c29a8b5ca38c6d83578f78f01e496cd1 (diff) | |
download | chrome-ec-6b5ce8b509a6ca4dbf11258866dc36f4299e4f62.tar.gz |
charge_manager: Check extpower after charge port
Some platforms don't have an extpower interrupt and therefore use the
`board_check_extpower` function to determine if extpower is
actually present. Any time the EC changes its charge port selection, we
should re-evaluate the extpower as it likely has now changed.
This commit simply does the above. Note that the default implementation
of `board_check_extpower` doesn't actually do anything, so this
should be a no-op for most boards.
BUG=b:187965740
BRANCH=dedede
TEST=Build and flash drawcia, verify that "AC on" prints are only
printed when we decide to charge from a port and not just when VBUS is
present
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Change-Id: Ib758b480a1e6f59f0f10caa1328b795726927f0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2904546
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/charge_manager.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/common/charge_manager.c b/common/charge_manager.c index 9619209990..a28629c98c 100644 --- a/common/charge_manager.c +++ b/common/charge_manager.c @@ -11,6 +11,7 @@ #include "charge_state_v2.h" #include "charger.h" #include "console.h" +#include "extpower.h" #include "gpio.h" #include "hooks.h" #include "host_command.h" @@ -752,8 +753,11 @@ static void charge_manager_refresh(void) trigger_ocpc_reset(); } - if (board_set_active_charge_port(new_port) == EC_SUCCESS) + if (board_set_active_charge_port(new_port) == EC_SUCCESS) { + if (IS_ENABLED(CONFIG_EXTPOWER)) + board_check_extpower(); break; + } /* 'Dont charge' request must be accepted. */ ASSERT(new_port != CHARGE_PORT_NONE); |