summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--driver/tcpm/anx7447.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c
index 2bcfab4a92..8eaa478f1c 100644
--- a/driver/tcpm/anx7447.c
+++ b/driver/tcpm/anx7447.c
@@ -847,6 +847,34 @@ static void anx7447_dump_registers(int port)
}
#endif /* defined(CONFIG_CMD_TCPC_DUMP) */
+
+static int anx7447_get_chip_info(int port, int live,
+ struct ec_response_pd_chip_info_v1 *chip_info)
+{
+ int rv = tcpci_get_chip_info(port, live, chip_info);
+ int val;
+
+ if (rv)
+ return rv;
+
+ if (chip_info->fw_version_number == -1 || live) {
+ /*
+ * Before reading ANX7447 SPI slave address 0x7e for
+ * new added FW version, need to read ANX7447 I2c
+ * slave address 0x58 first to wake up ANX7447.
+ */
+ tcpc_read(port, ANX7447_REG_OCM_VERSION, &val);
+ rv = anx7447_reg_read(port, ANX7447_REG_OCM_VERSION, &val);
+
+ if (rv)
+ return rv;
+ if (val != 0)
+ chip_info->fw_version_number = val;
+ }
+
+ return rv;
+}
+
/*
* ANX7447 is a TCPCI compatible port controller, with some caveats.
* It seems to require both CC lines to be set always, instead of just
@@ -880,7 +908,7 @@ const struct tcpm_drv anx7447_tcpm_drv = {
#ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
.drp_toggle = anx7447_tcpc_drp_toggle,
#endif
- .get_chip_info = &tcpci_get_chip_info,
+ .get_chip_info = &anx7447_get_chip_info,
.set_snk_ctrl = &tcpci_tcpm_set_snk_ctrl,
.set_src_ctrl = &tcpci_tcpm_set_src_ctrl,
#ifdef CONFIG_USB_PD_TCPC_LOW_POWER