summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Yilun Lin <yllin@chromium.org>2023-03-13 10:40:15 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-03-14 07:13:31 +0000
commit161345edccfa114304de55ca9411cfd35dac2201 (patch)
treeb8efd4adf80f277ef7f5288bf9da241bf42a9333
parent3b6293d3027c03c42d700747d7dfc152174e8e74 (diff)
downloadchrome-ec-161345edccfa114304de55ca9411cfd35dac2201.tar.gz
anx7447: replace anx7447_get_vbus_voltage
Replace the function to use the generic TCPCI API instead. BUG=b:272664811 TEST=1. ./twister -T zephyr/test/drivers 2. test steelix C0 anx3447 port, and VBUS reporting is correct BRANCH=none Change-Id: I5916ed6f010d863d003c9fb1d981c7817f495206 Signed-off-by: Eric Yilun Lin <yllin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4333419 Reviewed-by: Ting Shen <phoenixshen@chromium.org> Auto-Submit: Eric Yilun Lin <yllin@google.com> Commit-Queue: Eric Yilun Lin <yllin@google.com> Tested-by: Eric Yilun Lin <yllin@google.com>
-rw-r--r--driver/tcpm/anx7447.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c
index c26806dacb..bedc3a3807 100644
--- a/driver/tcpm/anx7447.c
+++ b/driver/tcpm/anx7447.c
@@ -403,26 +403,6 @@ static int anx7447_release(int port)
return EC_SUCCESS;
}
-static int anx7447_get_vbus_voltage(int port, int *vbus)
-{
- int val;
- int error;
-
- /*
- * b:214893572#comment33: This function is partially copied from
- * tcpci_get_vbus_voltage because ANX7447 dev_cap_1 reports VBUS_MEASURE
- * unsupported, however, it actually does. So we have an identical
- * implementation but just skip the dev_cap_1 check.
- */
-
- error = tcpc_read16(port, TCPC_REG_VBUS_VOLTAGE, &val);
- if (error)
- return error;
-
- *vbus = TCPC_REG_VBUS_VOLTAGE_VBUS(val);
- return EC_SUCCESS;
-}
-
static void anx7447_vendor_defined_alert(int port)
{
int alert;
@@ -990,7 +970,11 @@ const struct tcpm_drv anx7447_tcpm_drv = {
#ifdef CONFIG_USB_PD_VBUS_DETECT_TCPC
.check_vbus_level = &tcpci_tcpm_check_vbus_level,
#endif
- .get_vbus_voltage = &anx7447_get_vbus_voltage,
+ /*
+ * b:214893572#comment33: ANX7447 dev_cap_1 reports VBUS_MEASURE
+ * unsupported, however, it actually does.
+ */
+ .get_vbus_voltage = &tcpci_get_vbus_voltage_no_check,
.select_rp_value = &tcpci_tcpm_select_rp_value,
.set_cc = &anx7447_set_cc,
.set_polarity = &anx7447_set_polarity,