diff options
author | Wai-Hong Tam <waihong@google.com> | 2018-08-30 15:11:03 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-09-03 08:50:39 -0700 |
commit | 9cb48c2c876b5b327e132f5d38d66c6308238793 (patch) | |
tree | e885c6eac6f9da079a0c44e057e7e531ba189bb7 /board/cheza | |
parent | 6e853562c94698916c7f582df064a154b154f3d6 (diff) | |
download | chrome-ec-9cb48c2c876b5b327e132f5d38d66c6308238793.tar.gz |
cheza: Disable the base explicitly in S5
On r3+ board, when going to S5, the power to the base is off and the
base detection voltage is off too. The ADC value may not be accurate.
This CL disables the base explicitly to prevent any side effect.
BRANCH=none
BUG=b:112614067
TEST=Tried power-cycle, S0, S5 on r2 board. Unplugged the USB power
to emulate disabling the base power. Will do more test on r3 board.
Change-Id: I650fed7a446a9880bc6edaeaeba37f59bc0420b6
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1198044
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'board/cheza')
-rw-r--r-- | board/cheza/base_detect.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/board/cheza/base_detect.c b/board/cheza/base_detect.c index b70b6b3433..c14638b5ac 100644 --- a/board/cheza/base_detect.c +++ b/board/cheza/base_detect.c @@ -170,6 +170,23 @@ void base_detect_interrupt(enum gpio_signal signal) base_detect_debounce_time = time_now + BASE_DETECT_DEBOUNCE_US; } +static void base_detect_enable(void) +{ + /* Enable base detection interrupt. */ + base_detect_debounce_time = get_time().val; + hook_call_deferred(&base_detect_deferred_data, 0); + gpio_enable_interrupt(GPIO_CC_LID_BASE_ADC); +} +DECLARE_HOOK(HOOK_CHIPSET_STARTUP, base_detect_enable, HOOK_PRIO_DEFAULT); + +static void base_detect_disable(void) +{ + /* Disable base detection interrupt and disable power to base. */ + gpio_disable_interrupt(GPIO_CC_LID_BASE_ADC); + base_detect_change(BASE_DISCONNECTED); +} +DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, base_detect_disable, HOOK_PRIO_DEFAULT); + static void base_init(void) { /* @@ -178,9 +195,5 @@ static void base_init(void) */ gpio_set_level(GPIO_EN_PPVAR_VAR_BASE, 0); gpio_set_level(GPIO_EN_CC_LID_BASE_PULLDN, 1); - - /* Enable base detection interrupt. */ - hook_call_deferred(&base_detect_deferred_data, BASE_DETECT_DEBOUNCE_US); - gpio_enable_interrupt(GPIO_CC_LID_BASE_ADC); } DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT+1); |