mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
usb: typec: tcpm: apply vbus before data bringup in tcpm_src_attach
commit bec15191d52300defa282e3fd83820f69e447116 upstream.
This patch fixes Type-C compliance test TD 4.7.6 - Try.SNK DRP Connect
SNKAS.
tVbusON has a limit of 275ms when entering SRC_ATTACHED. Compliance
testers can interpret the TryWait.Src to Attached.Src transition after
Try.Snk as being in Attached.Src the entire time, so ~170ms is lost
to the debounce timer.
Setting the data role can be a costly operation in host mode, and when
completed after 100ms can cause Type-C compliance test check TD 4.7.5.V.4
to fail.
Turn VBUS on before tcpm_set_roles to meet timing requirement.
Fixes: f0690a25a1 ("staging: typec: USB Type-C Port Manager (tcpm)")
Cc: stable <stable@kernel.org>
Signed-off-by: RD Babiera <rdbabiera@google.com>
Reviewed-by: Badhri Jagan Sridharan <badhri@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20250618230606.3272497-2-rdbabiera@google.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
457d02e71a
commit
f9377bdf86
@@ -3622,17 +3622,6 @@ static int tcpm_src_attach(struct tcpm_port *port)
|
||||
|
||||
tcpm_enable_auto_vbus_discharge(port, true);
|
||||
|
||||
ret = tcpm_set_roles(port, true, TYPEC_STATE_USB,
|
||||
TYPEC_SOURCE, tcpm_data_role_for_source(port));
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
if (port->pd_supported) {
|
||||
ret = port->tcpc->set_pd_rx(port->tcpc, true);
|
||||
if (ret < 0)
|
||||
goto out_disable_mux;
|
||||
}
|
||||
|
||||
/*
|
||||
* USB Type-C specification, version 1.2,
|
||||
* chapter 4.5.2.2.8.1 (Attached.SRC Requirements)
|
||||
@@ -3642,13 +3631,24 @@ static int tcpm_src_attach(struct tcpm_port *port)
|
||||
(polarity == TYPEC_POLARITY_CC2 && port->cc1 == TYPEC_CC_RA)) {
|
||||
ret = tcpm_set_vconn(port, true);
|
||||
if (ret < 0)
|
||||
goto out_disable_pd;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = tcpm_set_vbus(port, true);
|
||||
if (ret < 0)
|
||||
goto out_disable_vconn;
|
||||
|
||||
ret = tcpm_set_roles(port, true, TYPEC_STATE_USB, TYPEC_SOURCE,
|
||||
tcpm_data_role_for_source(port));
|
||||
if (ret < 0)
|
||||
goto out_disable_vbus;
|
||||
|
||||
if (port->pd_supported) {
|
||||
ret = port->tcpc->set_pd_rx(port->tcpc, true);
|
||||
if (ret < 0)
|
||||
goto out_disable_mux;
|
||||
}
|
||||
|
||||
port->pd_capable = false;
|
||||
|
||||
port->partner = NULL;
|
||||
@@ -3658,14 +3658,14 @@ static int tcpm_src_attach(struct tcpm_port *port)
|
||||
|
||||
return 0;
|
||||
|
||||
out_disable_vconn:
|
||||
tcpm_set_vconn(port, false);
|
||||
out_disable_pd:
|
||||
if (port->pd_supported)
|
||||
port->tcpc->set_pd_rx(port->tcpc, false);
|
||||
out_disable_mux:
|
||||
tcpm_mux_set(port, TYPEC_STATE_SAFE, USB_ROLE_NONE,
|
||||
TYPEC_ORIENTATION_NONE);
|
||||
out_disable_vbus:
|
||||
tcpm_set_vbus(port, false);
|
||||
out_disable_vconn:
|
||||
tcpm_set_vconn(port, false);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user