ANDROID: usb: typec: tcpm: Add a helper function to port is toggling

Helper function needed for fixing TD.4.7.4 and TEST.PD.PROT.SRC.10
PR_Swap while having contamiant detection enabled.

tcpm_is_toggling returns true when a DRP port is in one of the toggling
states.

Bug: 169213252
Bug: 174094095
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Change-Id: Ie3837c3067fd91f3e9ea4afdfc1d5c7bf44659de
This commit is contained in:
Badhri Jagan Sridharan 2020-11-23 17:52:27 -08:00 committed by Greg Kroah-Hartman
parent da5e68a82d
commit 912795eaa2
2 changed files with 11 additions and 0 deletions

View File

@ -3075,6 +3075,16 @@ static inline enum tcpm_state unattached_state(struct tcpm_port *port)
return SNK_UNATTACHED;
}
bool tcpm_is_toggling(struct tcpm_port *port)
{
if (port->port_type == TYPEC_PORT_DRP)
return port->state == SRC_UNATTACHED || port->state == SNK_UNATTACHED ||
port->state == TOGGLING;
return false;
}
EXPORT_SYMBOL_GPL(tcpm_is_toggling);
static void tcpm_check_send_discover(struct tcpm_port *port)
{
if (port->data_role == TYPEC_HOST && port->send_discover &&

View File

@ -166,5 +166,6 @@ void tcpm_pd_transmit_complete(struct tcpm_port *port,
void tcpm_pd_hard_reset(struct tcpm_port *port);
void tcpm_tcpc_reset(struct tcpm_port *port);
bool tcpm_is_debouncing(struct tcpm_port *tcpm);
bool tcpm_is_toggling(struct tcpm_port *port);
#endif /* __LINUX_USB_TCPM_H */