stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] usb: typec: tcpm: Skip sink_cap query only when VDM sm is busy
@ 2021-03-18  6:48 Badhri Jagan Sridharan
  2021-03-18  7:46 ` Heikki Krogerus
  2021-03-18 14:54 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Badhri Jagan Sridharan @ 2021-03-18  6:48 UTC (permalink / raw)
  To: Guenter Roeck, Heikki Krogerus, Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, stable, Badhri Jagan Sridharan

When port partner responds "Not supported" to the DiscIdentity command,
VDM state machine can remain in NVDM_STATE_ERR_TMOUT and this causes
querying sink cap to be skipped indefinitely. Hence check for
vdm_sm_running instead of checking for VDM_STATE_DONE.

Fixes: 8dc4bd073663f ("usb: typec: tcpm: Add support for Sink Fast Role SWAP(FRS)")
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
---
 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 11d0c40bc47d..39e068d60755 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -5219,7 +5219,7 @@ static void tcpm_enable_frs_work(struct kthread_work *work)
 		goto unlock;
 
 	/* Send when the state machine is idle */
-	if (port->state != SNK_READY || port->vdm_state != VDM_STATE_DONE || port->send_discover)
+	if (port->state != SNK_READY || port->vdm_sm_running || port->send_discover)
 		goto resched;
 
 	port->upcoming_state = GET_SINK_CAP;
-- 
2.31.0.rc2.261.g7f71774620-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] usb: typec: tcpm: Skip sink_cap query only when VDM sm is busy
  2021-03-18  6:48 [PATCH v1] usb: typec: tcpm: Skip sink_cap query only when VDM sm is busy Badhri Jagan Sridharan
@ 2021-03-18  7:46 ` Heikki Krogerus
  2021-03-18 14:54 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2021-03-18  7:46 UTC (permalink / raw)
  To: Badhri Jagan Sridharan
  Cc: Guenter Roeck, Greg Kroah-Hartman, linux-usb, linux-kernel, stable

On Wed, Mar 17, 2021 at 11:48:05PM -0700, Badhri Jagan Sridharan wrote:
> When port partner responds "Not supported" to the DiscIdentity command,
> VDM state machine can remain in NVDM_STATE_ERR_TMOUT and this causes
> querying sink cap to be skipped indefinitely. Hence check for
> vdm_sm_running instead of checking for VDM_STATE_DONE.
> 
> Fixes: 8dc4bd073663f ("usb: typec: tcpm: Add support for Sink Fast Role SWAP(FRS)")
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>

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

> ---
>  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 11d0c40bc47d..39e068d60755 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -5219,7 +5219,7 @@ static void tcpm_enable_frs_work(struct kthread_work *work)
>  		goto unlock;
>  
>  	/* Send when the state machine is idle */
> -	if (port->state != SNK_READY || port->vdm_state != VDM_STATE_DONE || port->send_discover)
> +	if (port->state != SNK_READY || port->vdm_sm_running || port->send_discover)
>  		goto resched;
>  
>  	port->upcoming_state = GET_SINK_CAP;
> -- 
> 2.31.0.rc2.261.g7f71774620-goog

thanks,

-- 
heikki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] usb: typec: tcpm: Skip sink_cap query only when VDM sm is busy
  2021-03-18  6:48 [PATCH v1] usb: typec: tcpm: Skip sink_cap query only when VDM sm is busy Badhri Jagan Sridharan
  2021-03-18  7:46 ` Heikki Krogerus
@ 2021-03-18 14:54 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2021-03-18 14:54 UTC (permalink / raw)
  To: Badhri Jagan Sridharan, Heikki Krogerus, Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, stable

On 3/17/21 11:48 PM, Badhri Jagan Sridharan wrote:
> When port partner responds "Not supported" to the DiscIdentity command,
> VDM state machine can remain in NVDM_STATE_ERR_TMOUT and this causes
> querying sink cap to be skipped indefinitely. Hence check for
> vdm_sm_running instead of checking for VDM_STATE_DONE.
> 
> Fixes: 8dc4bd073663f ("usb: typec: tcpm: Add support for Sink Fast Role SWAP(FRS)")
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>

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 11d0c40bc47d..39e068d60755 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -5219,7 +5219,7 @@ static void tcpm_enable_frs_work(struct kthread_work *work)
>  		goto unlock;
>  
>  	/* Send when the state machine is idle */
> -	if (port->state != SNK_READY || port->vdm_state != VDM_STATE_DONE || port->send_discover)
> +	if (port->state != SNK_READY || port->vdm_sm_running || port->send_discover)
>  		goto resched;
>  
>  	port->upcoming_state = GET_SINK_CAP;
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-18 14:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18  6:48 [PATCH v1] usb: typec: tcpm: Skip sink_cap query only when VDM sm is busy Badhri Jagan Sridharan
2021-03-18  7:46 ` Heikki Krogerus
2021-03-18 14:54 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).