From edbca223efd0bdc6c734735430144e95024dd4d0 Mon Sep 17 00:00:00 2001 From: Xin Ji Date: Wed, 19 Jan 2022 15:01:26 +0800 Subject: tcpm: anx7447: Set vbus & vconn ADC threshold To avoid report VBUS_VOLTAGE_ALARM_HI while no device attached, set VBUS max threshold to around 25V. Set vconn maximum voltage threshold to 6V. BUG=b:153989733, b:214893572 BRANCH=none TEST=Tested on STM32 EVB board Change-Id: Ieea3789cbb89a3c02a881cc6f1eda892072e273d Signed-off-by: Xin Ji Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3400770 Reviewed-by: Diana Z Commit-Queue: Eric Yilun Lin Tested-by: Eric Yilun Lin --- driver/tcpm/anx7447.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'driver/tcpm/anx7447.c') diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c index 70b51feb07..93631d2c5c 100644 --- a/driver/tcpm/anx7447.c +++ b/driver/tcpm/anx7447.c @@ -346,14 +346,10 @@ static int anx7447_init(int port) if (rv) return rv; - /* - * Specifically disable voltage alarms, as VBUS_VOLTAGE_ALARM_HI may - * trigger repeatedly despite being masked (b/153989733) - */ - rv = tcpc_update16(port, TCPC_REG_POWER_CTRL, - TCPC_REG_POWER_CTRL_VBUS_VOL_MONITOR_DIS, MASK_SET); - if (rv) - return rv; + /* Set VBUS_VOLTAGE_ALARM_HI threshold */ + RETURN_ERROR(tcpc_write16(port, TCPC_REG_VBUS_VOLTAGE_ALARM_HI_CFG, 0x3FF)); + /* Set VCONN_VOLTAGE_ALARM_HI threshold to 6V */ + RETURN_ERROR(tcpc_write16(port, VCONN_VOLTAGE_ALARM_HI_CFG, 0xF0)); /* ADC enable, use to monitor VBUS voltage */ rv = tcpc_read(port, ANX7447_REG_ADC_CTRL_1, ®); -- cgit v1.2.1