mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-28 02:35:28 +00:00
tcpm: anx74xx: Remove auto-toggle support
Auto-role toggle on the anx74xx does not function correctly with e-marked cables and cannot be used. Also check for TCPC support for auto-toggle at runtime, to allow auto-toggle supported TCPC to be used alongside an unsupported part. (from CL:420405) BUG=chrome-os-partner:60890 BRANCH=reef TEST=Manual on reef, boot to S0: `pd 0 state`: Toggling between SRC_DISCONNECTED / SNK_DISCONNECTED `pd 1 state`: DRP_AUTO_TOGGLE Also verify port 0 can become sink + source correctly in S0. Change-Id: Iafdedf31773feef23923cefe1f4fb02fcffda120 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/420866 Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
9cc53cb892
commit
d00a15a78d
@@ -1575,6 +1575,9 @@ void pd_task(void)
|
||||
#ifndef CONFIG_USB_PD_VBUS_DETECT_NONE
|
||||
int snk_hard_reset_vbus_off = 0;
|
||||
#endif
|
||||
#ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
|
||||
const int auto_toggle_supported = tcpm_auto_toggle_supported(port);
|
||||
#endif
|
||||
#ifdef CONFIG_CHARGE_MANAGER
|
||||
int typec_curr = 0, typec_curr_change = 0;
|
||||
#endif /* CONFIG_CHARGE_MANAGER */
|
||||
@@ -1729,7 +1732,8 @@ void pd_task(void)
|
||||
* Attempt TCPC auto DRP toggle if it is
|
||||
* not already auto toggling and not try.src
|
||||
*/
|
||||
if (!(pd[port].flags & PD_FLAGS_TCPC_DRP_TOGGLE) &&
|
||||
if (auto_toggle_supported &&
|
||||
!(pd[port].flags & PD_FLAGS_TCPC_DRP_TOGGLE) &&
|
||||
!(pd[port].flags & PD_FLAGS_TRY_SRC) &&
|
||||
(cc1 == TYPEC_CC_VOLT_OPEN &&
|
||||
cc2 == TYPEC_CC_VOLT_OPEN)) {
|
||||
@@ -2208,7 +2212,8 @@ void pd_task(void)
|
||||
* Attempt TCPC auto DRP toggle if it is
|
||||
* not already auto toggling and not try.src
|
||||
*/
|
||||
if (!(pd[port].flags & PD_FLAGS_TCPC_DRP_TOGGLE) &&
|
||||
if (auto_toggle_supported &&
|
||||
!(pd[port].flags & PD_FLAGS_TCPC_DRP_TOGGLE) &&
|
||||
!(pd[port].flags & PD_FLAGS_TRY_SRC) &&
|
||||
(cc1 == TYPEC_CC_VOLT_OPEN &&
|
||||
cc2 == TYPEC_CC_VOLT_OPEN)) {
|
||||
@@ -2817,6 +2822,8 @@ defined(CONFIG_CASE_CLOSED_DEBUG_EXTERNAL)
|
||||
{
|
||||
enum pd_states next_state;
|
||||
|
||||
assert(auto_toggle_supported);
|
||||
|
||||
/* Check for connection */
|
||||
tcpm_get_cc(port, &cc1, &cc2);
|
||||
|
||||
|
||||
@@ -548,21 +548,6 @@ static int anx74xx_tcpm_set_cc(int port, int pull)
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
|
||||
static int anx74xx_tcpc_drp_toggle(int port)
|
||||
{
|
||||
int rv;
|
||||
|
||||
/* Disable CC software Control */
|
||||
rv = anx74xx_cc_software_ctrl(port, 0);
|
||||
|
||||
#ifdef CONFIG_USB_PD_TCPC_LOW_POWER
|
||||
anx74xx_set_power_mode(port, ANX74XX_STANDBY_MODE);
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int anx74xx_tcpm_set_polarity(int port, int polarity)
|
||||
{
|
||||
int reg, mux_state, rv = EC_SUCCESS;
|
||||
@@ -924,9 +909,6 @@ const struct tcpm_drv anx74xx_tcpm_drv = {
|
||||
#ifdef CONFIG_USB_PD_DISCHARGE_TCPC
|
||||
.tcpc_discharge_vbus = &anx74xx_tcpc_discharge_vbus,
|
||||
#endif
|
||||
#ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
|
||||
.drp_toggle = &anx74xx_tcpc_drp_toggle,
|
||||
#endif
|
||||
};
|
||||
|
||||
#ifdef CONFIG_CMD_I2C_STRESS_TEST_TCPC
|
||||
|
||||
@@ -137,6 +137,11 @@ static inline void tcpc_discharge_vbus(int port, int enable)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
|
||||
static inline int tcpm_auto_toggle_supported(int port)
|
||||
{
|
||||
return !!tcpc_config[port].drv->drp_toggle;
|
||||
}
|
||||
|
||||
static inline int tcpm_set_drp_toggle(int port)
|
||||
{
|
||||
return tcpc_config[port].drv->drp_toggle(port);
|
||||
|
||||
Reference in New Issue
Block a user