diff options
author | Diana Z <dzigterman@chromium.org> | 2020-07-23 22:50:54 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-28 04:09:00 +0000 |
commit | a787987e6a2cc7878ee9d58a6431d365a3fb195d (patch) | |
tree | 0228687d6f69e560cd1f1ae447f5edbf1d32cd0b /baseboard/dedede/baseboard.c | |
parent | aaab7ae298c52c0e71f91b30ef78a46a06df54eb (diff) | |
download | chrome-ec-a787987e6a2cc7878ee9d58a6431d365a3fb195d.tar.gz |
Dedede: Move extpower_is_present() to baseboard
This consolidates dedede boards to use a baseboard extpower_is_present()
and also adds the condition to verify that the port is sinking, instead
of providing Vbus. It also converts the RAA489000 boards to use the
cached Vbus presence in pd_snk_is_vbus_provided().
BRANCH=None
BUG=None
TEST=on waddledoo and waddledee, verify "AC on" prints when a charger or
charge-through servo v4 is plugged in, verify no "AC on" prints when a
dongle is plugged in
Signed-off-by: Diana Z <dzigterman@chromium.org>
Change-Id: I5941da789a4e810f6d8cc40cef4d32a5a03c5662
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2317062
Tested-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'baseboard/dedede/baseboard.c')
-rw-r--r-- | baseboard/dedede/baseboard.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/baseboard/dedede/baseboard.c b/baseboard/dedede/baseboard.c index 6ec8b42742..251db7d120 100644 --- a/baseboard/dedede/baseboard.c +++ b/baseboard/dedede/baseboard.c @@ -15,6 +15,7 @@ #include "host_command.h" #include "intel_x86.h" #include "system.h" +#include "usb_pd.h" /******************************************************************************/ /* @@ -242,3 +243,19 @@ int board_is_i2c_port_powered(int port) /* Sensor rails are off in S5/G3 */ return chipset_in_state(CHIPSET_STATE_ANY_OFF) ? 0 : 1; } + +int extpower_is_present(void) +{ + int vbus_present = 0; + int port; + + /* + * 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; +} |