FAILED: patch "[PATCH] usb: typec: tcpm: apply vbus before data bringup in" failed to apply to 6.15-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 6.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.15.y
git checkout FETCH_HEAD
git cherry-pick -x bec15191d52300defa282e3fd83820f69e447116
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025070813-antidote-uncoated-dabd@gregkh' --subject-prefix 'PATCH 6.15.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From bec15191d52300defa282e3fd83820f69e447116 Mon Sep 17 00:00:00 2001
From: RD Babiera <[email protected]>
Date: Wed, 18 Jun 2025 23:06:04 +0000
Subject: [PATCH] usb: typec: tcpm: apply vbus before data bringup in
tcpm_src_attach
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.
drivers/usb/typec/tcpm/tcpm.c +17 -17
@@ -4410,17 +4410,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)
@@ -4430,13 +4419,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 ;
@@ -4447,14 +4447,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; }
Sasha Levin
maintainerPATCH 1/3 usb: typec: tcpm: allow to use sink in accessory mode
From: Michael Grzeschik <[email protected]>
[ Upstream commit 64843d0ba96d3eae297025562111d57585273366 ]
Since the function tcpm_acc_attach is not setting the data and role for for the sink case we extend it to check for it first.
Stable-dep-of: bec15191d523 ("usb: typec: tcpm: apply vbus before data bringup in tcpm_src_attach")
--- drivers/usb/typec/tcpm/tcpm.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +7 -2
@@ -4602,12 +4602,17 @@ static void tcpm_snk_detach(struct tcpm_port *port)static int tcpm_acc_attach (struct tcpm_port *port) {int ret; +enum typec_role role; +enum typec_data_role data;if (port->attached)return 0 ; - ret =tcpm_set_roles (port, true,TYPEC_SOURCE , -tcpm_data_role_for_source (port)); + role =tcpm_port_is_sink (port) ?TYPEC_SINK :TYPEC_SOURCE ; + data =tcpm_port_is_sink (port) ?tcpm_data_role_for_sink (port) + :tcpm_data_role_for_source (port); + + ret =tcpm_set_roles (port, true, role, data);if (ret <0 )return ret;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 2/3 usb: typec: tcpm: allow switching to mode accessory to mux properly
From: Michael Grzeschik <[email protected]>
[ Upstream commit 8a50da849151e7e12b43c1d8fe7ad302223aef6b ]
The funciton tcpm_acc_attach is not setting the proper state when calling tcpm_set_role. The function tcpm_set_role is currently only handling TYPEC_STATE_USB. For the tcpm_acc_attach to switch into other modal states tcpm_set_role needs to be extended by an extra state parameter. This patch is handling the proper state change when calling tcpm_acc_attach.
Stable-dep-of: bec15191d523 ("usb: typec: tcpm: apply vbus before data bringup in tcpm_src_attach")
--- drivers/usb/typec/tcpm/tcpm.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +18 -9
@@ -1160,7 +1160,7 @@ static int tcpm_set_attached_state(struct tcpm_port *port, bool attached) port->data_role); } -static int tcpm_set_roles (struct tcpm_port *port,bool attached, +static int tcpm_set_roles (struct tcpm_port *port,bool attached,int state,enum typec_role role,enum typec_data_role data) {enum typec_orientation orientation;
@@ -1197,7 +1197,7 @@ static int tcpm_set_roles(struct tcpm_port *port, bool attached, } } - ret =tcpm_mux_set (port,TYPEC_STATE_USB , usb_role, orientation); + ret =tcpm_mux_set (port, state, usb_role, orientation);if (ret <0 )return ret;
@@ -4404,7 +4404,8 @@ static int tcpm_src_attach(struct tcpm_port *port)tcpm_enable_auto_vbus_discharge (port, true); - ret =tcpm_set_roles (port, true,TYPEC_SOURCE ,tcpm_data_role_for_source (port)); + ret =tcpm_set_roles (port, true,TYPEC_STATE_USB , +TYPEC_SOURCE ,tcpm_data_role_for_source (port));if (ret <0 )return ret;
@@ -4579,7 +4580,8 @@ static int tcpm_snk_attach(struct tcpm_port *port)tcpm_enable_auto_vbus_discharge (port, true); - ret =tcpm_set_roles (port, true,TYPEC_SINK ,tcpm_data_role_for_sink (port)); + ret =tcpm_set_roles (port, true,TYPEC_STATE_USB , +TYPEC_SINK ,tcpm_data_role_for_sink (port));if (ret <0 )return ret;
@@ -4604,6 +4606,7 @@ static int tcpm_acc_attach(struct tcpm_port *port)int ret;enum typec_role role;enum typec_data_role data; +int state =TYPEC_STATE_USB ;if (port->attached)return 0 ;
@@ -4612,7 +4615,13 @@ static int tcpm_acc_attach(struct tcpm_port *port) data =tcpm_port_is_sink (port) ?tcpm_data_role_for_sink (port) :tcpm_data_role_for_source (port); - ret =tcpm_set_roles (port, true, role, data); +if (tcpm_port_is_audio (port)) + state =TYPEC_MODE_AUDIO ; + +if (tcpm_port_is_debug (port)) + state =TYPEC_MODE_DEBUG ; + + ret =tcpm_set_roles (port, true, state, role, data);if (ret <0 )return ret;
@@ -5382,7 +5391,7 @@ static void run_state_machine(struct tcpm_port *port)*/ tcpm_set_vconn (port, false);tcpm_set_vbus (port, false); -tcpm_set_roles (port, port->self_powered,TYPEC_SOURCE , +tcpm_set_roles (port, port->self_powered,TYPEC_STATE_USB ,TYPEC_SOURCE ,tcpm_data_role_for_source (port));/* * If tcpc fails to notify vbus off, TCPM will wait for PD_T_SAFE_0V +
@@ -5414,7 +5423,7 @@ static void run_state_machine(struct tcpm_port *port)tcpm_set_vconn (port, false);if (port->pd_capable)tcpm_set_charge (port, false); -tcpm_set_roles (port, port->self_powered,TYPEC_SINK , +tcpm_set_roles (port, port->self_powered,TYPEC_STATE_USB ,TYPEC_SINK ,tcpm_data_role_for_sink (port));/* * VBUS may or may not toggle, depending on the adapter.
@@ -5538,10 +5547,10 @@ static void run_state_machine(struct tcpm_port *port)case DR_SWAP_CHANGE_DR :tcpm_unregister_altmodes (port);if (port->data_role ==TYPEC_HOST ) -tcpm_set_roles (port, true, port->pwr_role, +tcpm_set_roles (port, true,TYPEC_STATE_USB , port->pwr_role,TYPEC_DEVICE );else -tcpm_set_roles (port, true, port->pwr_role, +tcpm_set_roles (port, true,TYPEC_STATE_USB , port->pwr_role,TYPEC_HOST );tcpm_ams_finish (port);tcpm_set_state (port,ready_state (port),0 );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 3/3 usb: typec: tcpm: apply vbus before data bringup in tcpm_src_attach
In reply to Sasha LevinFrom: RD Babiera <[email protected]>
[ Upstream commit bec15191d52300defa282e3fd83820f69e447116 ]
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.
--- drivers/usb/typec/tcpm/tcpm.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/usb/typec/tcpm/tcpm.c +17 -17
@@ -4404,17 +4404,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)
@@ -4424,13 +4413,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 ;
@@ -4441,14 +4441,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; }
Signature · 1 line
2.39.5