diff options
author | Aseda Aboagye <aaboagye@google.com> | 2020-02-18 21:24:01 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-02-25 04:02:04 +0000 |
commit | 30e20eecf5a8e0c425611d0bd75cac0c585a9d2a (patch) | |
tree | d87fca0ec033c5686568d7a53e2b5faa4233c9ca | |
parent | 36564aa905fa79922db41f11ceff932f2f435cfc (diff) | |
download | chrome-ec-30e20eecf5a8e0c425611d0bd75cac0c585a9d2a.tar.gz |
waddledoo: Set CMPOUT as inverted to enable 5V
The charger has a general comparator which is enabled by default. The
output of this comparator enables the sub board power rails. This
commit adds a mechanism to turn on the 5V on the sub board tied to when
the system decides to enable 5V.
BUG=b:149794574
BRANCH=None
TEST=Build and flash waddledoo, boot to S0, plug in a sink, verify that
VCONN is sourced.
Change-Id: I05384bdbdde4ccc033c2057b3c45fcaeae4589cc
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2065495
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Auto-Submit: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r-- | baseboard/dedede/baseboard.h | 1 | ||||
-rw-r--r-- | board/waddledoo/board.c | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/baseboard/dedede/baseboard.h b/baseboard/dedede/baseboard.h index 4f3dd6551b..09447ed27b 100644 --- a/baseboard/dedede/baseboard.h +++ b/baseboard/dedede/baseboard.h @@ -86,6 +86,7 @@ #define CONFIG_I2C #define CONFIG_I2C_MASTER #define CONFIG_LOW_POWER_IDLE +#define CONFIG_POWER_PP5000_CONTROL #define CONFIG_VBOOT_HASH #define CONFIG_VSTORE #define CONFIG_VSTORE_SLOT_COUNT 1 diff --git a/board/waddledoo/board.c b/board/waddledoo/board.c index e0cc88d09b..cf697d6564 100644 --- a/board/waddledoo/board.c +++ b/board/waddledoo/board.c @@ -10,6 +10,7 @@ #include "charge_manager.h" #include "charge_state_v2.h" #include "charger.h" +#include "chipset.h" #include "common.h" #include "compile_time_macros.h" #include "driver/accel_bma2x2.h" @@ -72,8 +73,14 @@ static void sub_usb_c1_interrupt(enum gpio_signal s) void board_init(void) { + int on; + gpio_enable_interrupt(GPIO_USB_C0_INT_ODL); gpio_enable_interrupt(GPIO_SUB_USB_C1_INT_ODL); + + /* Turn on 5V if the system is on, otherwise turn it off. */ + on = chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND); + board_power_5v_enable(on); } DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); @@ -85,6 +92,19 @@ void board_reset_pd_mcu(void) */ } +__override void board_power_5v_enable(int enable) +{ + /* + * Port 0 simply has a GPIO to turn on the 5V regulator, however, 5V is + * generated locally on the sub board and we need to set the comparator + * polarity on the sub board charger IC. + */ + gpio_set_level(GPIO_EN_PP5000, !!enable); + if (isl923x_set_comparator_inversion(1, !!enable)) + CPRINTS("Failed to %sable sub rails!", enable ? "en" : "dis"); + +} + int board_is_sourcing_vbus(int port) { int regval; |