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 --- power/sc7180.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'power') diff --git a/power/sc7180.c b/power/sc7180.c index 71ada2754a..c1585a47ff 100644 --- a/power/sc7180.c +++ b/power/sc7180.c @@ -318,7 +318,7 @@ static int wait_switchcap_power_good(int enable) poll_deadline = get_time(); poll_deadline.val += SWITCHCAP_PG_CHECK_TIMEOUT; - while (enable != gpio_get_level(GPIO_DA9313_GPIO0) && + while (enable != board_is_switchcap_power_good() && get_time().val < poll_deadline.val) { usleep(SWITCHCAP_PG_CHECK_WAIT); } @@ -327,7 +327,7 @@ static int wait_switchcap_power_good(int enable) * Check the timeout case. Just show a message. More check later * will switch the power state. */ - if (enable != gpio_get_level(GPIO_DA9313_GPIO0)) { + if (enable != board_is_switchcap_power_good()) { if (enable) CPRINTS("SWITCHCAP NO POWER GOOD!"); else @@ -344,7 +344,7 @@ static int wait_switchcap_power_good(int enable) */ static int is_system_powered(void) { - return gpio_get_level(GPIO_SWITCHCAP_ON); + return board_is_switchcap_enabled(); } /** @@ -407,7 +407,7 @@ static int wait_pmic_pwron(int enable, unsigned int timeout) */ static void set_system_power_no_check(int enable) { - gpio_set_level(GPIO_SWITCHCAP_ON, enable); + board_set_switchcap_power(enable); } /** -- cgit v1.2.1