From ae82b79667d227d58675cbf73fa032d6bead098f Mon Sep 17 00:00:00 2001 From: Jett Rink Date: Wed, 23 May 2018 16:17:17 -0600 Subject: [PATCH] sn5s330: disable under voltage protection We need to disable under voltage protection because it prevents us from enabling the sink path when there is not Vbus on the connector side. We need to enable the sink path before we hibernate otherwise there is no power power to get to the charger which will then assert ACOK. Without this we won't wake up with the ACOK wake when USB power is inserted. BRANCH=none BUG=b:79948623 TEST=bip wakes with USB power insertion Change-Id: Idf16a92dacde63cf943ef68b0258b320d11de44c Signed-off-by: Jett Rink Reviewed-on: https://chromium-review.googlesource.com/1070867 Reviewed-by: Aaron Durbin Reviewed-by: Furquan Shaikh --- driver/ppc/sn5s330.c | 10 +++++++++- driver/ppc/sn5s330.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/driver/ppc/sn5s330.c b/driver/ppc/sn5s330.c index 4971ab798e..c20a665f75 100644 --- a/driver/ppc/sn5s330.c +++ b/driver/ppc/sn5s330.c @@ -268,8 +268,16 @@ static int sn5s330_init(int port) /* * Indicate we are using PP2 configuration 2 and enable OVP comparator * for CC lines. + * + * Also, turn off under-voltage protection for incoming Vbus as it would + * prevent us from enabling SNK path before we hibernate the ec. We + * need to enable the SNK path so USB power will assert ACOK and wake + * the EC up went inserting USB power. We always turn off under-voltage + * protection because the battery charger will boost the voltage up + * to the needed battery voltage either way (and it will have its own + * low voltage protection). */ - regval = SN5S330_OVP_EN_CC | SN5S330_PP2_CONFIG; + regval = SN5S330_OVP_EN_CC | SN5S330_PP2_CONFIG | SN5S330_CONFIG_UVP; status = i2c_write8(i2c_port, i2c_addr, SN5S330_FUNC_SET9, regval); if (status) { CPRINTS("ppc p%d: Failed to set FUNC_SET9!", port); diff --git a/driver/ppc/sn5s330.h b/driver/ppc/sn5s330.h index 2e4b36cbca..7d3ba6103e 100644 --- a/driver/ppc/sn5s330.h +++ b/driver/ppc/sn5s330.h @@ -103,6 +103,7 @@ enum sn5s330_pp_idx { /* FUNC_SET_9 */ #define SN5S330_PP2_CONFIG (1 << 2) #define SN5S330_OVP_EN_CC (1 << 4) +#define SN5S330_CONFIG_UVP (1 << 5) /* INT_STATUS_REG3 */ #define SN5S330_VBUS_GOOD (1 << 0)