From 0e2cc2816089abd4fe655bcc9218b1cbe1bb3731 Mon Sep 17 00:00:00 2001 From: "xiong.huang" Date: Tue, 17 Sep 2019 18:09:59 +0800 Subject: kodama: not provide dock keyboard power supply in S5/G3 When dock keyboard is connected to MB, MB doesn't provide power supply for dock keyboard to save system power in S5/G3. BUG=b:141157295 BRANCH=master TEST=GPIO EN_PP3300_POGO level is 0 through command 'ectool gpioget'. measure power of dock keyboard with multimeter. Change-Id: I587f39063054de83dbbeb12bd23a1113a04e61da Signed-off-by: Xiong Huang Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1809180 Reviewed-by: Ting Shen --- baseboard/kukui/base_detect_kukui.c | 18 ++++++++++++++++-- board/kodama/board.c | 3 --- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/baseboard/kukui/base_detect_kukui.c b/baseboard/kukui/base_detect_kukui.c index f72988543f..12c0090a52 100644 --- a/baseboard/kukui/base_detect_kukui.c +++ b/baseboard/kukui/base_detect_kukui.c @@ -166,11 +166,25 @@ void pogo_adc_interrupt(enum gpio_signal signal) base_detect_debounce_time = time_now + BASE_DETECT_DEBOUNCE_US; } -static void base_init(void) +/* Called on AP S5 -> S3 transition */ +static void pogo_chipset_startup(void) { + /* Enable pogo interrupt */ + gpio_enable_interrupt(GPIO_POGO_ADC_INT_L); + hook_call_deferred(&base_detect_deferred_data, 0); } -DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_INIT_ADC + 1); +DECLARE_HOOK(HOOK_CHIPSET_STARTUP, pogo_chipset_startup, HOOK_PRIO_DEFAULT); + +/* Called on AP S3 -> S5 transition */ +static void pogo_chipset_shutdown(void) +{ + /* Disable pogo interrupt */ + gpio_disable_interrupt(GPIO_POGO_ADC_INT_L); + + enable_power_supply(0); +} +DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, pogo_chipset_shutdown, HOOK_PRIO_DEFAULT); #ifdef VARIANT_KUKUI_POGO_DOCK static void board_pogo_charge_init(void) diff --git a/board/kodama/board.c b/board/kodama/board.c index 721242c240..0650301731 100644 --- a/board/kodama/board.c +++ b/board/kodama/board.c @@ -224,9 +224,6 @@ static void board_init(void) /* Enable interrupt from PMIC. */ gpio_enable_interrupt(GPIO_PMIC_EC_RESETB); - /* Enable pogo interrupt */ - gpio_enable_interrupt(GPIO_POGO_ADC_INT_L); - /* Display bias settings. */ mt6370_db_set_voltages(6000, 5800, 5800); -- cgit v1.2.1