From aeeeafb1929d38f4ae6575688832d7dee1794cf5 Mon Sep 17 00:00:00 2001 From: Bruce Date: Tue, 14 Feb 2017 19:01:38 +0800 Subject: [PATCH] pyro: add ANX74XX low power mode for different DRP state Follow reef setting. BUG=chrome-os-partner:58384 BRANCH=reef TEST=make buildall Change-Id: Icd661ed4ab78a7c8d2d5f1694934ad6723db2ddb Signed-off-by: Bruce.Wan Reviewed-on: https://chromium-review.googlesource.com/442254 Commit-Ready: Devin Lu Tested-by: Devin Lu Reviewed-by: Aaron Durbin --- board/pyro/board.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/board/pyro/board.c b/board/pyro/board.c index 44d8e09bea..a6250c25d1 100644 --- a/board/pyro/board.c +++ b/board/pyro/board.c @@ -81,9 +81,18 @@ static void tcpc_alert_event(enum gpio_signal signal) #ifdef CONFIG_USB_PD_TCPC_LOW_POWER static void anx74xx_cable_det_handler(void) { + int level = gpio_get_level(GPIO_USB_C0_CABLE_DET); + + /* + * Setting the low power is handled by DRP status hence + * handle only the attach event. + */ + if (level) + anx74xx_handle_power_mode(NPCX_I2C_PORT0_0, + ANX74XX_NORMAL_MODE); + /* confirm if cable_det is asserted */ - if (!gpio_get_level(GPIO_USB_C0_CABLE_DET) || - gpio_get_level(GPIO_USB_C0_PD_RST_L)) + if (!level || gpio_get_level(GPIO_USB_C0_PD_RST_L)) return; task_set_event(TASK_ID_PD_C0, PD_EVENT_TCPC_RESET, 0);