summaryrefslogtreecommitdiff
path: root/power
diff options
context:
space:
mode:
authorWai-Hong Tam <waihong@google.com>2020-08-31 15:28:37 -0700
committerCommit Bot <commit-bot@chromium.org>2020-09-02 01:45:15 +0000
commit60dc637cf3dd8366467925b74c646a825eff53a8 (patch)
treed806a03d993fc04bab2b56b4944b51063f0bd6c3 /power
parenta88a71767b5984f0ab5e8fe0ba753b092435e99e (diff)
downloadchrome-ec-60dc637cf3dd8366467925b74c646a825eff53a8.tar.gz
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 <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2386480 Reviewed-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org>
Diffstat (limited to 'power')
-rw-r--r--power/sc7180.c8
1 files changed, 4 insertions, 4 deletions
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);
}
/**