From 224667711a684241ef24cc3338b112097b10eba4 Mon Sep 17 00:00:00 2001 From: Wai-Hong Tam Date: Thu, 26 Jul 2018 17:04:05 -0700 Subject: cheza: Use POWER_GOOD signal instead of AP_RST_L The AP_RST_L is not a good signal to indicate power good. For an AP initiated warm reset (the Qualcomm way), AP pulls down PS_HOLD for a short pulse, and then PMIC pulls down AP_RST_L for another short pulse. This short pulse confuses EC from a power-lost. We use a confirmation logic to differentiate this case as a workaround. This CL uses another signal POWER_GOOD, which is SRC_PP1800_S4A from PMIC, as an indicator. CQ-DEPEND=CL:1169952 BRANCH=none BUG=b:78455067 TEST=Checked "power on", "power off", "apshutdown", and "apreset". Verifed the power-off sequence: * if the PMIC registers not programmed, it forces off switchcap. * if the PMIC registers programmed, it does graceful PMIC shutdown. Change-Id: I847eef5d4202485b70354b3f65ce24cd1ccb7ece Signed-off-by: Wai-Hong Tam Reviewed-on: https://chromium-review.googlesource.com/1169953 Reviewed-by: Stephen Boyd --- board/cheza/board.c | 14 -------------- board/cheza/gpio.inc | 5 +++-- 2 files changed, 3 insertions(+), 16 deletions(-) (limited to 'board/cheza') diff --git a/board/cheza/board.c b/board/cheza/board.c index 55b48e2859..21ef62ae19 100644 --- a/board/cheza/board.c +++ b/board/cheza/board.c @@ -160,20 +160,6 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); /* Power signal list. Must match order of enum power_signal. */ -/* - * PMIC pulls up the AP_RST_L signal to power-on AP. Once AP is up, it then - * pulls up the PS_HOLD signal. - * - * +--> GPIO_AP_RST_L >--+ - * PMIC AP - * +--< GPIO_PS_HOLD <---+ - * - * When AP initiates shutdown, it pulls down the PS_HOLD signal to notify - * PMIC. PMIC then pulls down the AP_RST_L. - * - * TODO(b/78455067): By far, we use the AP_RST_L signal to indicate AP in a - * good state. Address the issue of AP-initiated warm reset. - */ const struct power_signal_info power_signal_list[] = { [SDM845_AP_RST_L] = { GPIO_AP_RST_L, POWER_SIGNAL_ACTIVE_HIGH, "AP_RST_L"}, diff --git a/board/cheza/gpio.inc b/board/cheza/gpio.inc index 9a33e47179..e355462f79 100644 --- a/board/cheza/gpio.inc +++ b/board/cheza/gpio.inc @@ -29,9 +29,10 @@ GPIO_INT(LID_OPEN, PIN(D, 2), GPIO_INT_BOTH, lid_interrupt) /* LID_OPE GPIO_INT(AP_RST_REQ, PIN(C, 2), GPIO_INT_RISING | GPIO_PULL_DOWN | GPIO_SEL_1P8V, chipset_reset_request_interrupt) /* Reset request from AP */ /* AP_RST_L and PS_HOLD are used for PMIC and AP negotiation. Don't change their states. */ GPIO_INT(AP_RST_L, PIN(C, 1), GPIO_INT_BOTH | GPIO_SEL_1P8V, power_signal_interrupt) -GPIO_INT(PS_HOLD, PIN(D, 4), GPIO_INT_BOTH | GPIO_SEL_1P8V, power_signal_interrupt) /* Indicate when AP triggers reset/shutdown */ +GPIO_INT(PS_HOLD, PIN(D, 4), GPIO_INT_BOTH | GPIO_PULL_DOWN | GPIO_SEL_1P8V, power_signal_interrupt) /* Indicate when AP triggers reset/shutdown */ GPIO_INT(PMIC_FAULT_L, PIN(7, 6), GPIO_INT_BOTH | GPIO_SEL_1P8V, power_signal_interrupt) /* Any PMIC fault? */ -GPIO_INT(POWER_GOOD, PIN(5, 4), GPIO_INT_BOTH | GPIO_SEL_1P8V, power_signal_interrupt) /* SRC_PP1800_S4A from PMIC */ +/* When switch-cap is off, the POWER_GOOD signal is floating. Need a pull-down to make it low. */ +GPIO_INT(POWER_GOOD, PIN(5, 4), GPIO_INT_BOTH | GPIO_PULL_DOWN | GPIO_SEL_1P8V, power_signal_interrupt) /* SRC_PP1800_S4A from PMIC */ GPIO_INT(SHI_CS_L, PIN(5, 3), GPIO_INT_FALLING | GPIO_PULL_DOWN | GPIO_SEL_1P8V, shi_cs_event) /* AP_EC_SPI_CS_L */ GPIO_INT(CC_LID_BASE_ADC, PIN(4, 5), GPIO_INT_BOTH, base_detect_interrupt) /* Base detection */ -- cgit v1.2.1