diff options
author | Aseda Aboagye <aaboagye@google.com> | 2021-05-17 20:26:39 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-05-19 20:26:23 +0000 |
commit | 848a2cb8c29a8b5ca38c6d83578f78f01e496cd1 (patch) | |
tree | 98a65c57ee6f5a9d400c658b70ca498b0300c7e1 /baseboard | |
parent | 48c2e894a960a186a1b19b21ad270d7a2f62ed00 (diff) | |
download | chrome-ec-848a2cb8c29a8b5ca38c6d83578f78f01e496cd1.tar.gz |
dedede: Rework `extpower_is_present()`
The dedede boards erroneously assumed that if VBUS was present, then
"extpower" was present. "extpower" is generally connected to the ACOK
signal for the battery charger IC. It indicates that the voltage
present at the switching node is valid for bucking or boosting. For our
Type-C systems, this needs to be at least 4V. However, just because
VBUS is present doesn't mean that the voltage is present at the
switching node. The FETs on the selected charge port needs to be
enabled first.
This commit simply changes the logic to check the battery charger ICs'
ACOK status to reflect whether extpower is present.
BUG=b:187965740
BRANCH=dedede
TEST=Build and flash drawcia and madoo, verify that "AC on" prints are
emitted when the charge port is selected and not just when VBUS appears
on the port.
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Change-Id: If5a4a10d502f2f08ccf1d3228e42f48fa6d45909
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2901254
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'baseboard')
-rw-r--r-- | baseboard/dedede/baseboard.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/baseboard/dedede/baseboard.c b/baseboard/dedede/baseboard.c index 898791e7ce..3754f04b36 100644 --- a/baseboard/dedede/baseboard.c +++ b/baseboard/dedede/baseboard.c @@ -8,6 +8,8 @@ #include "adc.h" #include "board_config.h" #include "cbi_fw_config.h" +#include "charger/isl923x_public.h" +#include "charger/sm5803.h" #include "chipset.h" #include "common.h" #include "extpower.h" @@ -104,7 +106,7 @@ __override void board_after_rsmrst(int rsmrst) * can call this function once it detects a VBUS presence change with which we * can trigger the HOOK_AC_CHANGE hook. */ -__override void board_vbus_present_change(void) +__override void board_check_extpower(void) { static int last_extpower_present; int extpower_present = extpower_is_present(); @@ -277,18 +279,23 @@ int board_is_i2c_port_powered(int port) int extpower_is_present(void) { - int vbus_present = 0; int port; + int rv; + bool acok; + enum ec_error_list (*check_acok)(int port, bool *acok); + + if (IS_ENABLED(CONFIG_CHARGER_RAA489000)) + check_acok = raa489000_is_acok; + else if (IS_ENABLED(CONFIG_CHARGER_SM5803)) + check_acok = sm5803_is_acok; + + for (port = 0; port < board_get_usb_pd_port_count(); port++) { + rv = check_acok(port, &acok); + if ((rv == EC_SUCCESS) && acok) + return 1; + } - /* - * Boards define pd_snk_is_vbus_provided() with something appropriate - * for their hardware - */ - for (port = 0; port < board_get_usb_pd_port_count(); port++) - if (pd_get_power_role(port) == PD_ROLE_SINK) - vbus_present |= pd_snk_is_vbus_provided(port); - - return vbus_present; + return 0; } __override uint32_t board_override_feature_flags0(uint32_t flags0) |