summaryrefslogtreecommitdiff
path: root/board/poppy
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2021-05-20 18:16:41 +0800
committerCommit Bot <commit-bot@chromium.org>2021-05-27 09:17:00 +0000
commit00d63619edf7b6c1f62d7cfce7a2bd520635dbd3 (patch)
treedd379764d34d67abb3cac4c40499321c33651842 /board/poppy
parente9aae45d73c326331b07a0db171e64d73402907f (diff)
downloadchrome-ec-00d63619edf7b6c1f62d7cfce7a2bd520635dbd3.tar.gz
base_state: implement basestate host command
This CL introduces an unified method to force base attach/detach, to deprecate the hard-coded gpio pin name table in hammerd/hammertests/common.py. Also modifies base_force_state to use the same parameter type as host command. BUG=b:188625010 TEST=manually, run `ectool basestate attach|detach|reset` on coachz BRANCH=trogdor,kukui Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I5235661727cbbd15015c49d588ec70605e4a33e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2910472 Reviewed-by: Wai-Hong Tam <waihong@google.com> Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'board/poppy')
-rw-r--r--board/poppy/base_detect_lux.c6
-rw-r--r--board/poppy/base_detect_poppy.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/board/poppy/base_detect_lux.c b/board/poppy/base_detect_lux.c
index 155243af0e..14a937a7fd 100644
--- a/board/poppy/base_detect_lux.c
+++ b/board/poppy/base_detect_lux.c
@@ -219,13 +219,13 @@ static void base_init(void)
}
DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT+1);
-void base_force_state(int state)
+void base_force_state(enum ec_set_base_state_cmd state)
{
- if (state == 1) {
+ if (state == EC_SET_BASE_STATE_ATTACH) {
gpio_disable_interrupt(GPIO_BASE_DET_A);
base_detect_change(BASE_CONNECTED);
CPRINTS("BD forced connected");
- } else if (state == 0) {
+ } else if (state == EC_SET_BASE_STATE_DETACH) {
gpio_disable_interrupt(GPIO_BASE_DET_A);
base_detect_change(BASE_DISCONNECTED);
CPRINTS("BD forced disconnected");
diff --git a/board/poppy/base_detect_poppy.c b/board/poppy/base_detect_poppy.c
index 358461896e..8a202a21d9 100644
--- a/board/poppy/base_detect_poppy.c
+++ b/board/poppy/base_detect_poppy.c
@@ -246,13 +246,13 @@ static void base_init(void)
}
DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT+1);
-void base_force_state(int state)
+void base_force_state(enum ec_set_base_state_cmd state)
{
- if (state == 1) {
+ if (state == EC_SET_BASE_STATE_ATTACH) {
gpio_disable_interrupt(GPIO_BASE_DET_A);
base_detect_change(BASE_CONNECTED);
CPRINTS("BD forced connected");
- } else if (state == 0) {
+ } else if (state == EC_SET_BASE_STATE_DETACH) {
gpio_disable_interrupt(GPIO_BASE_DET_A);
base_detect_change(BASE_DISCONNECTED);
CPRINTS("BD forced disconnected");