summaryrefslogtreecommitdiff
path: root/board/waddledoo
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2020-02-18 21:24:01 -0800
committerCommit Bot <commit-bot@chromium.org>2020-02-25 04:02:04 +0000
commit30e20eecf5a8e0c425611d0bd75cac0c585a9d2a (patch)
treed87fca0ec033c5686568d7a53e2b5faa4233c9ca /board/waddledoo
parent36564aa905fa79922db41f11ceff932f2f435cfc (diff)
downloadchrome-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>
Diffstat (limited to 'board/waddledoo')
-rw-r--r--board/waddledoo/board.c20
1 files changed, 20 insertions, 0 deletions
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;