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>
This commit is contained in:
Nicolas Boichat
2017-05-04 09:09:10 +08:00
committed by chrome-bot
parent 2b2478ec6b
commit db7b881214

View File

@@ -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;