linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] usb: typec: tcpm: set SRC_SEND_CAPABILITIES timeout to PD_T_SENDER_RESPONSE
@ 2025-01-05 13:52 joswang
  2025-01-07 10:11 ` Heikki Krogerus
  2025-01-16 11:21 ` Heikki Krogerus
  0 siblings, 2 replies; 4+ messages in thread
From: joswang @ 2025-01-05 13:52 UTC (permalink / raw)
  To: heikki.krogerus, dmitry.baryshkov
  Cc: gregkh, linux-usb, linux-kernel, Jos Wang, stable

From: Jos Wang <joswang@lenovo.com>

As PD2.0 spec ("8.3.3.2.3 PE_SRC_Send_Capabilities state"), after the
Source receives the GoodCRC Message from the Sink in response to the
Source_Capabilities message, it should start the SenderResponseTimer,
after the timer times out, the state machine transitions to the
HARD_RESET state.

Fixes: f0690a25a140 ("staging: typec: USB Type-C Port Manager (tcpm)")
Cc: stable@vger.kernel.org
Signed-off-by: Jos Wang <joswang@lenovo.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 460dbde9fe22..57fae1118ac9 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -4821,7 +4821,7 @@ static void run_state_machine(struct tcpm_port *port)
 			port->caps_count = 0;
 			port->pd_capable = true;
 			tcpm_set_state_cond(port, SRC_SEND_CAPABILITIES_TIMEOUT,
-					    PD_T_SEND_SOURCE_CAP);
+					    PD_T_SENDER_RESPONSE);
 		}
 		break;
 	case SRC_SEND_CAPABILITIES_TIMEOUT:
-- 
2.17.1


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

* Re: [PATCH 1/1] usb: typec: tcpm: set SRC_SEND_CAPABILITIES timeout to PD_T_SENDER_RESPONSE
  2025-01-05 13:52 [PATCH 1/1] usb: typec: tcpm: set SRC_SEND_CAPABILITIES timeout to PD_T_SENDER_RESPONSE joswang
@ 2025-01-07 10:11 ` Heikki Krogerus
  2025-01-10 15:38   ` Badhri Jagan Sridharan
  2025-01-16 11:21 ` Heikki Krogerus
  1 sibling, 1 reply; 4+ messages in thread
From: Heikki Krogerus @ 2025-01-07 10:11 UTC (permalink / raw)
  To: joswang, Badhri Jagan Sridharan
  Cc: dmitry.baryshkov, gregkh, linux-usb, linux-kernel, Jos Wang,
	stable

+Badhri

On Sun, Jan 05, 2025 at 09:52:45PM +0800, joswang wrote:
> From: Jos Wang <joswang@lenovo.com>
> 
> As PD2.0 spec ("8.3.3.2.3 PE_SRC_Send_Capabilities state"), after the
> Source receives the GoodCRC Message from the Sink in response to the
> Source_Capabilities message, it should start the SenderResponseTimer,
> after the timer times out, the state machine transitions to the
> HARD_RESET state.
> 
> Fixes: f0690a25a140 ("staging: typec: USB Type-C Port Manager (tcpm)")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jos Wang <joswang@lenovo.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 460dbde9fe22..57fae1118ac9 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -4821,7 +4821,7 @@ static void run_state_machine(struct tcpm_port *port)
>  			port->caps_count = 0;
>  			port->pd_capable = true;
>  			tcpm_set_state_cond(port, SRC_SEND_CAPABILITIES_TIMEOUT,
> -					    PD_T_SEND_SOURCE_CAP);
> +					    PD_T_SENDER_RESPONSE);
>  		}
>  		break;
>  	case SRC_SEND_CAPABILITIES_TIMEOUT:

This looks okay to me, but let's get comments from Badhri, just in
case.

thanks,

-- 
heikki

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

* Re: [PATCH 1/1] usb: typec: tcpm: set SRC_SEND_CAPABILITIES timeout to PD_T_SENDER_RESPONSE
  2025-01-07 10:11 ` Heikki Krogerus
@ 2025-01-10 15:38   ` Badhri Jagan Sridharan
  0 siblings, 0 replies; 4+ messages in thread
From: Badhri Jagan Sridharan @ 2025-01-10 15:38 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: joswang, dmitry.baryshkov, gregkh, linux-usb, linux-kernel,
	Jos Wang, stable

On Tue, Jan 7, 2025 at 2:11 AM Heikki Krogerus
<heikki.krogerus@linux.intel.com> wrote:
>
> +Badhri
>
> On Sun, Jan 05, 2025 at 09:52:45PM +0800, joswang wrote:
> > From: Jos Wang <joswang@lenovo.com>
> >
> > As PD2.0 spec ("8.3.3.2.3 PE_SRC_Send_Capabilities state"), after the
> > Source receives the GoodCRC Message from the Sink in response to the
> > Source_Capabilities message, it should start the SenderResponseTimer,
> > after the timer times out, the state machine transitions to the
> > HARD_RESET state.
> >
> > Fixes: f0690a25a140 ("staging: typec: USB Type-C Port Manager (tcpm)")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Jos Wang <joswang@lenovo.com>
Reviewed-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 460dbde9fe22..57fae1118ac9 100644
> > --- a/drivers/usb/typec/tcpm/tcpm.c
> > +++ b/drivers/usb/typec/tcpm/tcpm.c
> > @@ -4821,7 +4821,7 @@ static void run_state_machine(struct tcpm_port *port)
> >                       port->caps_count = 0;
> >                       port->pd_capable = true;
> >                       tcpm_set_state_cond(port, SRC_SEND_CAPABILITIES_TIMEOUT,
> > -                                         PD_T_SEND_SOURCE_CAP);
> > +                                         PD_T_SENDER_RESPONSE);

This aligns with what the spec says as Jos Wang has already mentioned.
However, itdoes reduce the time within which the sink has to reply back with the
request message. So if there are non-compliant sinks, which we don't
know of yet, we would know now and we can later see how we can handle
the interoperability.

Regards,
Badhri



> >               }
> >               break;
> >       case SRC_SEND_CAPABILITIES_TIMEOUT:
>
> This looks okay to me, but let's get comments from Badhri, just in
> case.
>
> thanks,
>
> --
> heikki

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

* Re: [PATCH 1/1] usb: typec: tcpm: set SRC_SEND_CAPABILITIES timeout to PD_T_SENDER_RESPONSE
  2025-01-05 13:52 [PATCH 1/1] usb: typec: tcpm: set SRC_SEND_CAPABILITIES timeout to PD_T_SENDER_RESPONSE joswang
  2025-01-07 10:11 ` Heikki Krogerus
@ 2025-01-16 11:21 ` Heikki Krogerus
  1 sibling, 0 replies; 4+ messages in thread
From: Heikki Krogerus @ 2025-01-16 11:21 UTC (permalink / raw)
  To: joswang; +Cc: dmitry.baryshkov, gregkh, linux-usb, linux-kernel, Jos Wang,
	stable

On Sun, Jan 05, 2025 at 09:52:45PM +0800, joswang wrote:
> From: Jos Wang <joswang@lenovo.com>
> 
> As PD2.0 spec ("8.3.3.2.3 PE_SRC_Send_Capabilities state"), after the
> Source receives the GoodCRC Message from the Sink in response to the
> Source_Capabilities message, it should start the SenderResponseTimer,
> after the timer times out, the state machine transitions to the
> HARD_RESET state.
> 
> Fixes: f0690a25a140 ("staging: typec: USB Type-C Port Manager (tcpm)")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jos Wang <joswang@lenovo.com>

Reviewed-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 460dbde9fe22..57fae1118ac9 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -4821,7 +4821,7 @@ static void run_state_machine(struct tcpm_port *port)
>  			port->caps_count = 0;
>  			port->pd_capable = true;
>  			tcpm_set_state_cond(port, SRC_SEND_CAPABILITIES_TIMEOUT,
> -					    PD_T_SEND_SOURCE_CAP);
> +					    PD_T_SENDER_RESPONSE);
>  		}
>  		break;
>  	case SRC_SEND_CAPABILITIES_TIMEOUT:
> -- 
> 2.17.1

-- 
heikki

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

end of thread, other threads:[~2025-01-16 11:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-05 13:52 [PATCH 1/1] usb: typec: tcpm: set SRC_SEND_CAPABILITIES timeout to PD_T_SENDER_RESPONSE joswang
2025-01-07 10:11 ` Heikki Krogerus
2025-01-10 15:38   ` Badhri Jagan Sridharan
2025-01-16 11:21 ` Heikki Krogerus

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).