summaryrefslogtreecommitdiff
path: root/driver/tcpm/anx7447.c
diff options
context:
space:
mode:
authorXin Ji <xji@analogixsemi.com>2022-01-19 15:01:26 +0800
committerCommit Bot <commit-bot@chromium.org>2022-02-08 07:13:16 +0000
commitedbca223efd0bdc6c734735430144e95024dd4d0 (patch)
tree7038acdb30bcd6dfbb338ffd73bac99c1ec36713 /driver/tcpm/anx7447.c
parent80e36d02d24d30030f4fff6774916dd5b71090cc (diff)
downloadchrome-ec-edbca223efd0bdc6c734735430144e95024dd4d0.tar.gz
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 <xji@analogixsemi.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3400770 Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com>
Diffstat (limited to 'driver/tcpm/anx7447.c')
-rw-r--r--driver/tcpm/anx7447.c12
1 files changed, 4 insertions, 8 deletions
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, &reg);