Revert "usb: typec: tcpm: reset counter when enter into unattached state after try role"

Message ID 20240217162023.1719738-1-megi@xff.cz
State New
Headers
Series Revert "usb: typec: tcpm: reset counter when enter into unattached state after try role" |

Commit Message

Ondřej Jirman Feb. 17, 2024, 4:20 p.m. UTC
  From: Ondrej Jirman <megi@xff.cz>

The reverted commit makes the state machine only ever go from SRC_ATTACH_WAIT
to SNK_TRY in endless loop when toggling. After revert it goes to SRC_ATTACHED
after initially trying SNK_TRY earlier, as it should for toggling to ever detect
the power source mode and the port is again able to provide power to attached
power sinks.

This reverts commit 2d6d80127006ae3da26b1f21a65eccf957f2d1e5.

Cc: stable@vger.kernel.org
Fixes: 2d6d80127006 ("usb: typec: tcpm: reset counter when enter into unattached state after try role")
Signed-of-by: Ondrej Jirman <megi@xff.cz>
---
 drivers/usb/typec/tcpm/tcpm.c | 3 ---
 1 file changed, 3 deletions(-)

See https://lore.kernel.org/all/odggrbbgjpardze76qiv57mw6tllisyu5sbrta37iadjzwamcv@qr3ubwnlzqqt/
for more.
  

Comments

Heikki Krogerus Feb. 26, 2024, 7:48 a.m. UTC | #1
On Sat, Feb 17, 2024 at 05:20:21PM +0100, Ondřej Jirman wrote:
> From: Ondrej Jirman <megi@xff.cz>
> 
> The reverted commit makes the state machine only ever go from SRC_ATTACH_WAIT
> to SNK_TRY in endless loop when toggling. After revert it goes to SRC_ATTACHED
> after initially trying SNK_TRY earlier, as it should for toggling to ever detect
> the power source mode and the port is again able to provide power to attached
> power sinks.
> 
> This reverts commit 2d6d80127006ae3da26b1f21a65eccf957f2d1e5.
> 
> Cc: stable@vger.kernel.org
> Fixes: 2d6d80127006 ("usb: typec: tcpm: reset counter when enter into unattached state after try role")
> Signed-of-by: Ondrej Jirman <megi@xff.cz>

Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/tcpm/tcpm.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> See https://lore.kernel.org/all/odggrbbgjpardze76qiv57mw6tllisyu5sbrta37iadjzwamcv@qr3ubwnlzqqt/
> for more.
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index f7d7daa60c8d..295ae7eb912c 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -3743,9 +3743,6 @@ static void tcpm_detach(struct tcpm_port *port)
>  	if (tcpm_port_is_disconnected(port))
>  		port->hard_reset_count = 0;
>  
> -	port->try_src_count = 0;
> -	port->try_snk_count = 0;
> -
>  	if (!port->attached)
>  		return;
>  
> -- 
> 2.43.0
  

Patch

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index f7d7daa60c8d..295ae7eb912c 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -3743,9 +3743,6 @@  static void tcpm_detach(struct tcpm_port *port)
 	if (tcpm_port_is_disconnected(port))
 		port->hard_reset_count = 0;
 
-	port->try_src_count = 0;
-	port->try_snk_count = 0;
-
 	if (!port->attached)
 		return;