summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@google.com>2017-05-04 09:09:10 +0800
committerchrome-bot <chrome-bot@chromium.org>2017-05-05 03:10:58 -0700
commitdb7b881214118ac6fbb457c394bab5ef87a1fd06 (patch)
treef6055de58106b69fa57eee8c1d078464a7a5a88a
parent2b2478ec6bea2b0117c9ae9c2e610c12e16b5a2d (diff)
downloadchrome-ec-db7b881214118ac6fbb457c394bab5ef87a1fd06.tar.gz
poppy: Add new set of detection values for rev1
rev1 uses 600K pull-up on lid, 10K pull-down, 1% tolerance, let's adjust the detection interval accordingly. Let's also widen rev0 detection interval upper bound, based on experimental values. BRANCH=none BUG=b:35582031 TEST=make BOARD=poppy; make BOARD=soraka TEST=Poppy: Base is detected, despite the fact that ADC shows 187. Change-Id: Ic2122f0b480414a0ec8fa351fbaa5aa79e90eb65 Reviewed-on: https://chromium-review.googlesource.com/495926 Commit-Ready: Nicolas Boichat <drinkcat@chromium.org> Tested-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
-rw-r--r--board/poppy/board.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/board/poppy/board.c b/board/poppy/board.c
index b9b5875273..f1e364d4ff 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -124,13 +124,25 @@ void anx74xx_cable_det_interrupt(enum gpio_signal signal)
/*
* Base detection and debouncing
*
- * Lid has 100K pull-up, base has 5.1K pull-down, so the ADC
- * value should be around 5.1/(100+5.1)*3300 = 160.
- * TODO(crosbug.com/p/61098): Fine-tune these values.
+ * TODO(b/35585396): Fine-tune these values.
*/
#define BASE_DETECT_DEBOUNCE_US (5 * MSEC)
+
+#ifdef POPPY_REV0
+/*
+ * rev0: Lid has 100K pull-up, base has 5.1K pull-down, so the ADC
+ * value should be around 5.1/(100+5.1)*3300 = 160.
+ */
#define BASE_DETECT_MIN_MV 140
-#define BASE_DETECT_MAX_MV 180
+#define BASE_DETECT_MAX_MV 200
+#else
+/*
+ * >=rev1: Lid has 600K pull-up, base has 10K pull-down, 1% tolerance, so the
+ * ADC value should be around 10.0/(604+10.0)*3300 = 54
+ */
+#define BASE_DETECT_MIN_MV 50
+#define BASE_DETECT_MAX_MV 60
+#endif
static uint64_t base_detect_debounce_time;