mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-13 03:15:06 +00:00
tcpc: verify that i2c_read for vbus succeeds
If we cannot contact the TCPC, then we need to assume the safer value of VBus level (i.e. off) BRANCH=none BUG=b:77458917 TEST=yorp C1 still works Change-Id: I1fc1898a7dc554d050cd3612616531cb74de7261 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/995959 Reviewed-by: Divya S Sasidharan <divya.s.sasidharan@intel.com> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
@@ -206,9 +206,11 @@ int tcpci_tcpm_get_vbus_level(int port)
|
||||
int reg;
|
||||
|
||||
/* Read Power Status register */
|
||||
tcpci_tcpm_get_power_status(port, ®);
|
||||
/* Update VBUS status */
|
||||
return reg & TCPC_REG_POWER_STATUS_VBUS_PRES ? 1 : 0;
|
||||
if (tcpci_tcpm_get_power_status(port, ®) == EC_SUCCESS)
|
||||
return reg & TCPC_REG_POWER_STATUS_VBUS_PRES ? 1 : 0;
|
||||
|
||||
/* If read failed, report that Vbus is off */
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user