[3/5] USB: typec: tcpm: Fix PR_SWAP error handling

Message ID 20201210160521.3417426-4-gregkh@linuxfoundation.org
State New
Headers show
Series
  • USB: typec: various patches
Related show

Commit Message

Greg KH Dec. 10, 2020, 4:05 p.m.
From: Kyle Tso <kyletso@google.com>

PD rev3.0 8.3.3.16.3.6 PE_PRS_SRC_SNK_Wait_Source_on State
The Policy Enging Shall transition to the ErrorRecovery state when the
PSSourceOnTimer times out ...

Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Badhri Jagan Sridharan <badhri@google.com>
Signed-off-by: Kyle Tso <kyletso@google.com>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/usb/typec/tcpm/tcpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Guenter Roeck Dec. 10, 2020, 5:43 p.m. | #1
On Thu, Dec 10, 2020 at 05:05:19PM +0100, Greg Kroah-Hartman wrote:
> From: Kyle Tso <kyletso@google.com>
> 
> PD rev3.0 8.3.3.16.3.6 PE_PRS_SRC_SNK_Wait_Source_on State
> The Policy Enging Shall transition to the ErrorRecovery state when the
> PSSourceOnTimer times out ...
> 
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Cc: Badhri Jagan Sridharan <badhri@google.com>
> Signed-off-by: Kyle Tso <kyletso@google.com>
> Signed-off-by: Will McVicker <willmcvicker@google.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/usb/typec/tcpm/tcpm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 0efda59bb104..d51c45961893 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -3728,7 +3728,7 @@ static void run_state_machine(struct tcpm_port *port)
>  			tcpm_set_state(port, ERROR_RECOVERY, 0);
>  			break;
>  		}
> -		tcpm_set_state_cond(port, SNK_UNATTACHED, PD_T_PS_SOURCE_ON);
> +		tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON);
>  		break;
>  	case PR_SWAP_SRC_SNK_SINK_ON:
>  		/* Set the vbus disconnect threshold for implicit contract */
> -- 
> 2.29.2
>

Patch

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 0efda59bb104..d51c45961893 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -3728,7 +3728,7 @@  static void run_state_machine(struct tcpm_port *port)
 			tcpm_set_state(port, ERROR_RECOVERY, 0);
 			break;
 		}
-		tcpm_set_state_cond(port, SNK_UNATTACHED, PD_T_PS_SOURCE_ON);
+		tcpm_set_state(port, ERROR_RECOVERY, PD_T_PS_SOURCE_ON);
 		break;
 	case PR_SWAP_SRC_SNK_SINK_ON:
 		/* Set the vbus disconnect threshold for implicit contract */