diff options
author | Wai-Hong Tam <waihong@google.com> | 2021-06-22 15:19:50 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-06-23 19:50:19 +0000 |
commit | e8643345cef33ec1b71c5c999ab957d76f066c55 (patch) | |
tree | b30feb7f154139df5245102ba7f72d31e26ca9a5 | |
parent | b65e019399bb7bf54d2dd101f6f85180e2f1c708 (diff) | |
download | chrome-ec-e8643345cef33ec1b71c5c999ab957d76f066c55.tar.gz |
trogdor: Move the switchcap code out
Move the switchcap implementation to another file so it can be
more readily used by the Zephyr OS build.
BRANCH=None
BUG=b:191803008
TEST=Built the trogdor image successfully.
Change-Id: I7b42f29b79e53d97c0cd86abf61f3a9f7db96de9
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2980444
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | board/trogdor/board.c | 16 | ||||
-rw-r--r-- | board/trogdor/build.mk | 2 | ||||
-rw-r--r-- | board/trogdor/switchcap.c | 22 |
3 files changed, 23 insertions, 17 deletions
diff --git a/board/trogdor/board.c b/board/trogdor/board.c index 39ebec5506..36a6259f98 100644 --- a/board/trogdor/board.c +++ b/board/trogdor/board.c @@ -21,7 +21,6 @@ #include "lid_switch.h" #include "pi3usb9201.h" #include "power.h" -#include "power/qcom.h" #include "power_button.h" #include "pwm.h" #include "pwm_chip.h" @@ -328,21 +327,6 @@ 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_SWITCHCAP_PG); -} - void board_reset_pd_mcu(void) { cprints(CC_USB, "Resetting TCPCs..."); diff --git a/board/trogdor/build.mk b/board/trogdor/build.mk index 73e2a290a9..2fff43af4c 100644 --- a/board/trogdor/build.mk +++ b/board/trogdor/build.mk @@ -11,4 +11,4 @@ CHIP_FAMILY:=npcx7 CHIP_VARIANT:=npcx7m6fc BASEBOARD:=trogdor -board-y=battery.o board.o led.o +board-y=battery.o board.o led.o switchcap.o diff --git a/board/trogdor/switchcap.c b/board/trogdor/switchcap.c new file mode 100644 index 0000000000..16b0db6ef6 --- /dev/null +++ b/board/trogdor/switchcap.c @@ -0,0 +1,22 @@ +/* Copyright 2021 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "gpio.h" +#include "power/qcom.h" + +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_SWITCHCAP_PG); +} |