From 60dc637cf3dd8366467925b74c646a825eff53a8 Mon Sep 17 00:00:00 2001 From: Wai-Hong Tam Date: Mon, 31 Aug 2020 15:28:37 -0700 Subject: sc7180: Decouple the switchcap control from the power sequence Currently, SC7180 power sequence is tightly coupled with a single switchcap part, i.e. DA9313. Should decouple the switchcap control from the power sequence, such that more different switchcap parts can be supported. BRANCH=None BUG=b:163867792 TEST=Built the affect images and booted into kernel. Change-Id: I7f63cd22bbc308672c40a734be4f6dfc80e07158 Signed-off-by: Wai-Hong Tam Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2386480 Reviewed-by: Stephen Boyd Reviewed-by: Philip Chen --- board/trogdor/board.c | 15 +++++++++++++++ board/trogdor/board.h | 4 ++++ 2 files changed, 19 insertions(+) (limited to 'board/trogdor') diff --git a/board/trogdor/board.c b/board/trogdor/board.c index 00c8e3c024..8fd4e51f9d 100644 --- a/board/trogdor/board.c +++ b/board/trogdor/board.c @@ -302,6 +302,21 @@ static void board_chipset_resume(void) } DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT); +void board_set_switchcap_power(int enable) +{ + gpio_set_level(GPIO_SWITCHCAP_ON, enable); +} + +int board_is_switchcap_enabled(void) +{ + return gpio_get_level(GPIO_SWITCHCAP_ON); +} + +int board_is_switchcap_power_good(void) +{ + return gpio_get_level(GPIO_DA9313_GPIO0); +} + void board_reset_pd_mcu(void) { cprints(CC_USB, "Resetting TCPCs..."); diff --git a/board/trogdor/board.h b/board/trogdor/board.h index ca8303a3a4..ffac3e5a48 100644 --- a/board/trogdor/board.h +++ b/board/trogdor/board.h @@ -73,6 +73,10 @@ enum pwm_channel { PWM_CH_COUNT }; +/* Swithcap functions */ +void board_set_switchcap_power(int enable); +int board_is_switchcap_enabled(void); +int board_is_switchcap_power_good(void); /* Custom function to indicate if sourcing VBUS */ int board_is_sourcing_vbus(int port); /* Enable VBUS sink for a given port */ -- cgit v1.2.1