summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
Diffstat (limited to 'driver')
-rw-r--r--driver/tcpm/anx74xx.c16
-rw-r--r--driver/tcpm/ps8xxx.c16
2 files changed, 14 insertions, 18 deletions
diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c
index 22f1f51e77..4ad5eb67c0 100644
--- a/driver/tcpm/anx74xx.c
+++ b/driver/tcpm/anx74xx.c
@@ -746,11 +746,6 @@ static int anx74xx_tcpm_set_polarity(int port, int polarity)
return rv;
}
-static int anx74xx_tcpc_get_fw_version(int port, int *version)
-{
- return tcpc_read(port, ANX74XX_REG_FW_VERSION, version);
-}
-
static int anx74xx_tcpm_set_vconn(int port, int enable)
{
int reg, rv = EC_SUCCESS;
@@ -1053,12 +1048,15 @@ static int anx74xx_get_chip_info(int port, int renew,
if (rv)
return rv;
- rv = anx74xx_tcpc_get_fw_version(port, &val);
+ if ((*chip_info)->fw_version_number == 0 ||
+ (*chip_info)->fw_version_number == -1 || renew) {
+ rv = tcpc_read(port, ANX74XX_REG_FW_VERSION, &val);
- if (rv)
- return rv;
+ if (rv)
+ return rv;
- (*chip_info)->fw_version_number = val;
+ (*chip_info)->fw_version_number = val;
+ }
#ifdef CONFIG_USB_PD_TCPM_ANX3429
/*
diff --git a/driver/tcpm/ps8xxx.c b/driver/tcpm/ps8xxx.c
index e6649a61c1..3bf2ab5b12 100644
--- a/driver/tcpm/ps8xxx.c
+++ b/driver/tcpm/ps8xxx.c
@@ -87,11 +87,6 @@ void ps8xxx_tcpc_update_hpd_status(int port, int hpd_lvl, int hpd_irq)
hpd_deadline[port] = get_time().val + HPD_USTREAM_DEBOUNCE_LVL;
}
-static int ps8xxx_tcpc_get_fw_version(int port, int *version)
-{
- return tcpc_read(port, FW_VER_REG, version);
-}
-
static int ps8xxx_tcpc_bist_mode_2(int port)
{
int rv;
@@ -145,12 +140,15 @@ static int ps8xxx_get_chip_info(int port, int renew,
if (rv)
return rv;
- rv = ps8xxx_tcpc_get_fw_version(port, &val);
+ if ((*chip_info)->fw_version_number == 0 ||
+ (*chip_info)->fw_version_number == -1 || renew) {
+ rv = tcpc_read(port, FW_VER_REG, &val);
- if (rv)
- return rv;
+ if (rv)
+ return rv;
- (*chip_info)->fw_version_number = val;
+ (*chip_info)->fw_version_number = val;
+ }
#if defined(CONFIG_USB_PD_TCPM_PS8751) && \
defined(CONFIG_USB_PD_VBUS_DETECT_TCPC)