From d8b545b17720ebbbefd9518071b8e8441faacc6e Mon Sep 17 00:00:00 2001 From: Vijay Hiremath Date: Tue, 21 Jun 2016 16:17:59 -0700 Subject: [PATCH] reef: Enable external power interrupt GPIO BUG=chrome-os-partner:54503 BRANCH=none TEST=Manually tested using console commands on both the ports. a. Issued 'gpioget AC_PRESENT', observed AC_PRESENT is 1 when AC connected & 0 when AC disconnected. b. Issued 'hibernate' & on plugging in the AC, device boots to S0. Change-Id: Iad09914d79cdbd798fb650146321eafed06eb91c Signed-off-by: Vijay Hiremath Reviewed-on: https://chromium-review.googlesource.com/354721 Commit-Ready: Vijay P Hiremath Tested-by: Vijay P Hiremath Reviewed-by: Shawn N --- board/reef/board.c | 10 ++++------ board/reef/board.h | 1 + board/reef/gpio.inc | 3 +-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/board/reef/board.c b/board/reef/board.c index 333cca3e87..226925098f 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -140,6 +140,7 @@ uint16_t tcpc_get_alert_status(void) } const enum gpio_signal hibernate_wake_pins[] = { + GPIO_AC_PRESENT, GPIO_LID_OPEN, GPIO_POWER_BUTTON_L, }; @@ -380,12 +381,6 @@ void board_set_charge_limit(int port, int supplier, int charge_ma) CONFIG_CHARGER_INPUT_CURRENT)); } -int extpower_is_present(void) -{ - /* Check VBUS on either port */ - return bd99955_is_vbus_provided(BD99955_CHARGE_PORT_BOTH); -} - /* Enable or disable input devices, based upon chipset state and tablet mode */ static void enable_input_devices(void) { @@ -665,6 +660,9 @@ void board_hibernate(void) { CPRINTS("Enter Pseudo G3"); + /* Enable both the VBUS & VCC ports before entering PG3 */ + bd99955_select_input_port(BD99955_CHARGE_PORT_BOTH); + /* * Clean up the UART buffer and prevent any unwanted garbage characters * before power off and also ensure above debug message is printed. diff --git a/board/reef/board.h b/board/reef/board.h index a42992eac5..d231b8d1bf 100644 --- a/board/reef/board.h +++ b/board/reef/board.h @@ -65,6 +65,7 @@ #define CONFIG_BOARD_VERSION #define CONFIG_BOARD_SPECIFIC_VERSION #define CONFIG_BUTTON_COUNT 2 +#define CONFIG_EXTPOWER_GPIO #define CONFIG_FPU #define CONFIG_I2C #define CONFIG_I2C_MASTER diff --git a/board/reef/gpio.inc b/board/reef/gpio.inc index db168126aa..853aea32a7 100644 --- a/board/reef/gpio.inc +++ b/board/reef/gpio.inc @@ -19,8 +19,7 @@ GPIO_INT(SUSPWRNACK, PIN(7, 2), GPIO_INT_BOTH, power_signal_interrupt) GPIO_INT(RSMRST_L_PGOOD, PIN(6, 0), GPIO_INT_BOTH, power_signal_interrupt) /* PMIC_EC_RSMRST_ODL */ GPIO_INT(ALL_SYS_PGOOD, PIN(5, 0), GPIO_INT_BOTH, power_signal_interrupt) /* PMIC_EC_PWROK_OD */ -/* FIXME(dhendrix): What to do with ACOK_OD? */ -//GPIO_INT(AC_PRESENT, PIN(C, 1), GPIO_INT_BOTH | GPIO_INPUT, extpower_interrupt) /* ACOK_OD from BD99955 */ +GPIO_INT(AC_PRESENT, PIN(C, 1), GPIO_INT_BOTH, extpower_interrupt) /* ACOK_OD from BD99955 */ /* TODO: We might remove external pull-up for POWER_BUTTON_L in EVT */ GPIO_INT(POWER_BUTTON_L, PIN(0, 4), GPIO_INT_BOTH, power_button_interrupt) /* MECH_PWR_BTN_ODL */ /* FIXME(furquan): GPIO_PULL_UP is not required for LID_OPEN on EVT. */