mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
Revert "ANDROID: usb: typec: tcpm: Add chip level callback to check for contaminant"
This reverts commit 1f16d824a8.
This commit was not submitted upstream and is now causing large merge
conflicts. If it is still needed, it needs to be sent upstream for
review and acceptance there.
Bug: 168544734
Cc: Badhri Jagan Sridharan <badhri@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Icbbc5f13adb1c10d864f8be641b6741bae31b9ea
This commit is contained in:
@@ -474,10 +474,6 @@ struct tcpm_port {
|
||||
* SNK_READY for non-pd link.
|
||||
*/
|
||||
bool slow_charger_loop;
|
||||
|
||||
/* Port is still in tCCDebounce */
|
||||
bool debouncing;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct dentry *dentry;
|
||||
struct mutex logbuffer_lock; /* log buffer access lock */
|
||||
@@ -980,21 +976,6 @@ static int tcpm_set_vconn(struct tcpm_port *port, bool enable)
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool tcpm_is_debouncing(struct tcpm_port *port)
|
||||
{
|
||||
bool debounce;
|
||||
|
||||
if (!port)
|
||||
return false;
|
||||
|
||||
mutex_lock(&port->lock);
|
||||
debounce = port->debouncing;
|
||||
mutex_unlock(&port->lock);
|
||||
|
||||
return debounce;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tcpm_is_debouncing);
|
||||
|
||||
static u32 tcpm_get_current_limit(struct tcpm_port *port)
|
||||
{
|
||||
enum typec_cc_status cc;
|
||||
@@ -3622,7 +3603,6 @@ static int tcpm_src_attach(struct tcpm_port *port)
|
||||
port->partner = NULL;
|
||||
|
||||
port->attached = true;
|
||||
port->debouncing = false;
|
||||
port->send_discover = true;
|
||||
|
||||
return 0;
|
||||
@@ -3749,7 +3729,6 @@ static int tcpm_snk_attach(struct tcpm_port *port)
|
||||
port->partner = NULL;
|
||||
|
||||
port->attached = true;
|
||||
port->debouncing = false;
|
||||
port->send_discover = true;
|
||||
|
||||
return 0;
|
||||
@@ -3777,7 +3756,6 @@ static int tcpm_acc_attach(struct tcpm_port *port)
|
||||
tcpm_typec_connect(port);
|
||||
|
||||
port->attached = true;
|
||||
port->debouncing = false;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -3867,15 +3845,6 @@ static void run_state_machine(struct tcpm_port *port)
|
||||
if (!port->non_pd_role_swap)
|
||||
tcpm_swap_complete(port, -ENOTCONN);
|
||||
tcpm_src_detach(port);
|
||||
if (port->debouncing) {
|
||||
port->debouncing = false;
|
||||
if (port->tcpc->check_contaminant &&
|
||||
port->tcpc->check_contaminant(port->tcpc)) {
|
||||
/* Contaminant detection would handle toggling */
|
||||
tcpm_set_state(port, TOGGLING, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tcpm_start_toggling(port, tcpm_rp_cc(port))) {
|
||||
tcpm_set_state(port, TOGGLING, 0);
|
||||
break;
|
||||
@@ -3885,7 +3854,6 @@ static void run_state_machine(struct tcpm_port *port)
|
||||
tcpm_set_state(port, SNK_UNATTACHED, PD_T_DRP_SNK);
|
||||
break;
|
||||
case SRC_ATTACH_WAIT:
|
||||
port->debouncing = true;
|
||||
if (tcpm_port_is_debug(port))
|
||||
tcpm_set_state(port, DEBUG_ACC_ATTACHED,
|
||||
PD_T_CC_DEBOUNCE);
|
||||
@@ -3900,7 +3868,6 @@ static void run_state_machine(struct tcpm_port *port)
|
||||
break;
|
||||
|
||||
case SNK_TRY:
|
||||
port->debouncing = false;
|
||||
port->try_snk_count++;
|
||||
/*
|
||||
* Requirements:
|
||||
@@ -4115,15 +4082,6 @@ static void run_state_machine(struct tcpm_port *port)
|
||||
tcpm_swap_complete(port, -ENOTCONN);
|
||||
tcpm_pps_complete(port, -ENOTCONN);
|
||||
tcpm_snk_detach(port);
|
||||
if (port->debouncing) {
|
||||
port->debouncing = false;
|
||||
if (port->tcpc->check_contaminant &&
|
||||
port->tcpc->check_contaminant(port->tcpc)) {
|
||||
/* Contaminant detection would handle toggling */
|
||||
tcpm_set_state(port, TOGGLING, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tcpm_start_toggling(port, TYPEC_CC_RD)) {
|
||||
tcpm_set_state(port, TOGGLING, 0);
|
||||
break;
|
||||
@@ -4133,7 +4091,6 @@ static void run_state_machine(struct tcpm_port *port)
|
||||
tcpm_set_state(port, SRC_UNATTACHED, PD_T_DRP_SRC);
|
||||
break;
|
||||
case SNK_ATTACH_WAIT:
|
||||
port->debouncing = true;
|
||||
if ((port->cc1 == TYPEC_CC_OPEN &&
|
||||
port->cc2 != TYPEC_CC_OPEN) ||
|
||||
(port->cc1 != TYPEC_CC_OPEN &&
|
||||
@@ -4145,20 +4102,17 @@ static void run_state_machine(struct tcpm_port *port)
|
||||
PD_T_PD_DEBOUNCE);
|
||||
break;
|
||||
case SNK_DEBOUNCED:
|
||||
if (tcpm_port_is_disconnected(port)) {
|
||||
if (tcpm_port_is_disconnected(port))
|
||||
tcpm_set_state(port, SNK_UNATTACHED,
|
||||
PD_T_PD_DEBOUNCE);
|
||||
} else if (port->vbus_present) {
|
||||
else if (port->vbus_present)
|
||||
tcpm_set_state(port,
|
||||
tcpm_try_src(port) ? SRC_TRY
|
||||
: SNK_ATTACHED,
|
||||
0);
|
||||
port->debouncing = false;
|
||||
} else {
|
||||
else
|
||||
/* Wait for VBUS, but not forever */
|
||||
tcpm_set_state(port, PORT_RESET, PD_T_PS_SOURCE_ON);
|
||||
port->debouncing = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case SRC_TRY:
|
||||
@@ -5205,7 +5159,6 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port)
|
||||
case SNK_TRYWAIT_DEBOUNCE:
|
||||
break;
|
||||
case SNK_ATTACH_WAIT:
|
||||
port->debouncing = false;
|
||||
tcpm_set_state(port, SNK_UNATTACHED, 0);
|
||||
break;
|
||||
|
||||
@@ -6113,49 +6066,6 @@ sink:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tcpm_copy_pdos(u32 *dest_pdo, const u32 *src_pdo, unsigned int nr_pdo)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (nr_pdo > PDO_MAX_OBJECTS)
|
||||
nr_pdo = PDO_MAX_OBJECTS;
|
||||
|
||||
for (i = 0; i < nr_pdo; i++)
|
||||
dest_pdo[i] = src_pdo[i];
|
||||
|
||||
return nr_pdo;
|
||||
}
|
||||
|
||||
int tcpm_update_sink_capabilities(struct tcpm_port *port, const u32 *pdo, unsigned int nr_pdo,
|
||||
unsigned int operating_snk_mw)
|
||||
{
|
||||
if (tcpm_validate_caps(port, pdo, nr_pdo))
|
||||
return -EINVAL;
|
||||
|
||||
mutex_lock(&port->lock);
|
||||
port->nr_snk_pdo = tcpm_copy_pdos(port->snk_pdo, pdo, nr_pdo);
|
||||
port->operating_snk_mw = operating_snk_mw;
|
||||
port->update_sink_caps = true;
|
||||
|
||||
switch (port->state) {
|
||||
case SNK_NEGOTIATE_CAPABILITIES:
|
||||
case SNK_NEGOTIATE_PPS_CAPABILITIES:
|
||||
case SNK_READY:
|
||||
case SNK_TRANSITION_SINK:
|
||||
case SNK_TRANSITION_SINK_VBUS:
|
||||
if (port->pps_data.active)
|
||||
tcpm_set_state(port, SNK_NEGOTIATE_PPS_CAPABILITIES, 0);
|
||||
else
|
||||
tcpm_set_state(port, SNK_NEGOTIATE_CAPABILITIES, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
mutex_unlock(&port->lock);
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(tcpm_update_sink_capabilities);
|
||||
|
||||
/* Power Supply access to expose source power information */
|
||||
enum tcpm_psy_online_states {
|
||||
TCPM_PSY_OFFLINE = 0,
|
||||
|
||||
@@ -114,14 +114,6 @@ enum tcpm_transmit_type {
|
||||
* Optional; The USB Communications Capable bit indicates if port
|
||||
* partner is capable of communication over the USB data lines
|
||||
* (e.g. D+/- or SS Tx/Rx). Called to notify the status of the bit.
|
||||
* @check_contaminant:
|
||||
* Optional; The callback is called when CC pins report open status
|
||||
* at the end of the toggling period. Chip level drivers are
|
||||
* expected to check for contaminant and re-enable toggling if
|
||||
* needed. When 0 is not returned, check_contaminant is expected to
|
||||
* restart toggling after checking the connector for contaminant.
|
||||
* This forces the TCPM state machine to tranistion to TOGGLING state
|
||||
* without calling start_toggling callback.
|
||||
*/
|
||||
struct tcpc_dev {
|
||||
struct fwnode_handle *fwnode;
|
||||
@@ -156,7 +148,6 @@ struct tcpc_dev {
|
||||
bool pps_active, u32 requested_vbus_voltage);
|
||||
bool (*is_vbus_vsafe0v)(struct tcpc_dev *dev);
|
||||
void (*set_partner_usb_comm_capable)(struct tcpc_dev *dev, bool enable);
|
||||
int (*check_contaminant)(struct tcpc_dev *dev);
|
||||
};
|
||||
|
||||
struct tcpm_port;
|
||||
@@ -164,10 +155,6 @@ struct tcpm_port;
|
||||
struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc);
|
||||
void tcpm_unregister_port(struct tcpm_port *port);
|
||||
|
||||
int tcpm_update_sink_capabilities(struct tcpm_port *port, const u32 *pdo,
|
||||
unsigned int nr_pdo,
|
||||
unsigned int operating_snk_mw);
|
||||
|
||||
void tcpm_vbus_change(struct tcpm_port *port);
|
||||
void tcpm_cc_change(struct tcpm_port *port);
|
||||
void tcpm_sink_frs(struct tcpm_port *port);
|
||||
@@ -178,6 +165,5 @@ void tcpm_pd_transmit_complete(struct tcpm_port *port,
|
||||
enum tcpm_transmit_status status);
|
||||
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);
|
||||
|
||||
#endif /* __LINUX_USB_TCPM_H */
|
||||
|
||||
Reference in New Issue
Block a user