summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2018-01-23 13:26:04 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-02-01 00:48:24 +0000
commit4cb1d792b969bc6f46b809dbcb8ccb97a58ea10d (patch)
treea58f189b6bbd88de1260f0df7347119732701c69 /board
parentb8394c4fbcb7d036979a0e1efa75cb2b5f49a111 (diff)
downloadchrome-ec-4cb1d792b969bc6f46b809dbcb8ccb97a58ea10d.tar.gz
cr50: fix ec and servo detection
This change reenables the gpio interrupts if the signal is not high. BUG=none BRANCH=cr50 TEST=firmware_Cr50DeviceState Change-Id: Iae4e18594954789cd6841e01d1c943de3b389415 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/884306 Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 4d0eb3be49fac06cdb932a3ac9fb429d97f7a340) Reviewed-on: https://chromium-review.googlesource.com/896788 Tested-by: Vadim Bendebury <vbendeb@chromium.org> Commit-Queue: Vadim Bendebury <vbendeb@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/cr50/ec_state.c6
-rw-r--r--board/cr50/servo_state.c11
2 files changed, 13 insertions, 4 deletions
diff --git a/board/cr50/ec_state.c b/board/cr50/ec_state.c
index a208cbfd2c..ddea279909 100644
--- a/board/cr50/ec_state.c
+++ b/board/cr50/ec_state.c
@@ -112,6 +112,11 @@ static void ec_detect(void)
set_ec_on();
return;
}
+ /*
+ * Make sure the interrupt is enabled. We will need to detect the on
+ * transition if we enter the off or debouncing state
+ */
+ gpio_enable_interrupt(GPIO_DETECT_EC);
/* EC wasn't detected. If we're already off, done. */
if (state == DEVICE_STATE_OFF)
@@ -134,6 +139,5 @@ static void ec_detect(void)
set_state(DEVICE_STATE_INIT_DEBOUNCING);
else
set_state(DEVICE_STATE_DEBOUNCING);
- gpio_enable_interrupt(GPIO_DETECT_EC);
}
DECLARE_HOOK(HOOK_SECOND, ec_detect, HOOK_PRIO_DEFAULT);
diff --git a/board/cr50/servo_state.c b/board/cr50/servo_state.c
index 8c574f5a4e..505e694142 100644
--- a/board/cr50/servo_state.c
+++ b/board/cr50/servo_state.c
@@ -139,7 +139,6 @@ static void servo_detect(void)
servo_connect();
return;
}
-
/*
* If servo has become detectable but wasn't detected above, assume
* it's disconnected.
@@ -152,8 +151,15 @@ static void servo_detect(void)
* debouncing state below, because we want to give priority to servo
* being able to drive it again.
*/
- if (state == DEVICE_STATE_UNDETECTABLE)
+ if (state == DEVICE_STATE_UNDETECTABLE) {
set_state(DEVICE_STATE_DISCONNECTED);
+ return;
+ }
+ /*
+ * Make sure the interrupt is enabled. We will need to detect the on
+ * transition if we enter the off or debouncing state
+ */
+ gpio_enable_interrupt(GPIO_DETECT_SERVO);
/* Servo wasn't detected. If we're already disconnected, done. */
if (state == DEVICE_STATE_DISCONNECTED)
@@ -180,7 +186,6 @@ static void servo_detect(void)
set_state(DEVICE_STATE_INIT_DEBOUNCING);
else
set_state(DEVICE_STATE_DEBOUNCING);
- gpio_enable_interrupt(GPIO_DETECT_SERVO);
}
/*
* Do this at slightly elevated priority so it runs before rdd_check_pin() and