mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v1] usb: typec: tcpm: Set in_ams flag when Source caps have been received
@ 2021-02-02  3:38 Badhri Jagan Sridharan
  2021-02-02  3:50 ` Guenter Roeck
  2021-02-02  8:25 ` Heikki Krogerus
  0 siblings, 2 replies; 3+ messages in thread
From: Badhri Jagan Sridharan @ 2021-02-02  3:38 UTC (permalink / raw)
  To: Guenter Roeck, Heikki Krogerus, Greg Kroah-Hartman, Kyle Tso
  Cc: linux-usb, linux-kernel, Badhri Jagan Sridharan

Receiving the first packet in an AMS sequence signals the
beginning of AMS. Set in_ams flag to true when SRC_CAPS are
received during POWER_NEGOTIATION AMS.
This fixes the failure flagged while running TD.PD.SNK.E9
compliance test.

From Deterministic PD compliance MOI spec:
TD.PD.SNK.E9. GetSinkCap in Place of Accept
Description:
As Provider, the Tester intentionally sends a GetSinkCap message in place
of Accept message and verifies the UUT will send a SoftReset and recover
from the error.
Steps:
a) Run PROC.PD.E1 Bring-up according to the UUT role.
b) The Tester cycles VBus.
c) The Tester sends a Source Capabilities message to the UUT.
d) Upon receipt of a Request message from the UUT, the Tester replies with
   a GoodCRC message.
e) The Tester sends a GetSinkCap message to the UUT.
f) If a SoftReset is not received within 15 ms after the GetSinkCap EOP was
   sent, the test fails.
g) If a SoftReset is received timely, the Tester replies with an Accept
   message.
h) The Tester sends Source Capabilities message to the UUT repeatedly until
   nCapsCount reached or a GoodCRC is received. If nCapsCount reached, the
   test fails.
i) If a Request is not received timely within 30 ms after the GoodCRC EOP
   corresponding to Source Capabilities message was received, the test
   fails.

Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
---
 drivers/usb/typec/tcpm/tcpm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 0afd8ef692e8..b3e07d9b7597 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -2243,6 +2243,7 @@ static void tcpm_pd_data_request(struct tcpm_port *port,
 		 * handled.
 		 */
 			port->ams = POWER_NEGOTIATION;
+			port->in_ams = true;
 			tcpm_set_state(port, SNK_NEGOTIATE_CAPABILITIES, 0);
 		} else {
 			if (port->ams == GET_SOURCE_CAPABILITIES)
-- 
2.30.0.365.g02bc693789-goog


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

* Re: [PATCH v1] usb: typec: tcpm: Set in_ams flag when Source caps have been received
  2021-02-02  3:38 [PATCH v1] usb: typec: tcpm: Set in_ams flag when Source caps have been received Badhri Jagan Sridharan
@ 2021-02-02  3:50 ` Guenter Roeck
  2021-02-02  8:25 ` Heikki Krogerus
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2021-02-02  3:50 UTC (permalink / raw)
  To: Badhri Jagan Sridharan, Heikki Krogerus, Greg Kroah-Hartman, Kyle Tso
  Cc: linux-usb, linux-kernel

On 2/1/21 7:38 PM, Badhri Jagan Sridharan wrote:
> Receiving the first packet in an AMS sequence signals the
> beginning of AMS. Set in_ams flag to true when SRC_CAPS are
> received during POWER_NEGOTIATION AMS.
> This fixes the failure flagged while running TD.PD.SNK.E9
> compliance test.
> 
>>From Deterministic PD compliance MOI spec:
> TD.PD.SNK.E9. GetSinkCap in Place of Accept
> Description:
> As Provider, the Tester intentionally sends a GetSinkCap message in place
> of Accept message and verifies the UUT will send a SoftReset and recover
> from the error.
> Steps:
> a) Run PROC.PD.E1 Bring-up according to the UUT role.
> b) The Tester cycles VBus.
> c) The Tester sends a Source Capabilities message to the UUT.
> d) Upon receipt of a Request message from the UUT, the Tester replies with
>    a GoodCRC message.
> e) The Tester sends a GetSinkCap message to the UUT.
> f) If a SoftReset is not received within 15 ms after the GetSinkCap EOP was
>    sent, the test fails.
> g) If a SoftReset is received timely, the Tester replies with an Accept
>    message.
> h) The Tester sends Source Capabilities message to the UUT repeatedly until
>    nCapsCount reached or a GoodCRC is received. If nCapsCount reached, the
>    test fails.
> i) If a Request is not received timely within 30 ms after the GoodCRC EOP
>    corresponding to Source Capabilities message was received, the test
>    fails.
> 
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/usb/typec/tcpm/tcpm.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 0afd8ef692e8..b3e07d9b7597 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -2243,6 +2243,7 @@ static void tcpm_pd_data_request(struct tcpm_port *port,
>  		 * handled.
>  		 */
>  			port->ams = POWER_NEGOTIATION;
> +			port->in_ams = true;
>  			tcpm_set_state(port, SNK_NEGOTIATE_CAPABILITIES, 0);
>  		} else {
>  			if (port->ams == GET_SOURCE_CAPABILITIES)
> 


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

* Re: [PATCH v1] usb: typec: tcpm: Set in_ams flag when Source caps have been received
  2021-02-02  3:38 [PATCH v1] usb: typec: tcpm: Set in_ams flag when Source caps have been received Badhri Jagan Sridharan
  2021-02-02  3:50 ` Guenter Roeck
@ 2021-02-02  8:25 ` Heikki Krogerus
  1 sibling, 0 replies; 3+ messages in thread
From: Heikki Krogerus @ 2021-02-02  8:25 UTC (permalink / raw)
  To: Badhri Jagan Sridharan
  Cc: Guenter Roeck, Greg Kroah-Hartman, Kyle Tso, linux-usb, linux-kernel

On Mon, Feb 01, 2021 at 07:38:59PM -0800, Badhri Jagan Sridharan wrote:
> Receiving the first packet in an AMS sequence signals the
> beginning of AMS. Set in_ams flag to true when SRC_CAPS are
> received during POWER_NEGOTIATION AMS.
> This fixes the failure flagged while running TD.PD.SNK.E9
> compliance test.
> 
> >From Deterministic PD compliance MOI spec:
> TD.PD.SNK.E9. GetSinkCap in Place of Accept
> Description:
> As Provider, the Tester intentionally sends a GetSinkCap message in place
> of Accept message and verifies the UUT will send a SoftReset and recover
> from the error.
> Steps:
> a) Run PROC.PD.E1 Bring-up according to the UUT role.
> b) The Tester cycles VBus.
> c) The Tester sends a Source Capabilities message to the UUT.
> d) Upon receipt of a Request message from the UUT, the Tester replies with
>    a GoodCRC message.
> e) The Tester sends a GetSinkCap message to the UUT.
> f) If a SoftReset is not received within 15 ms after the GetSinkCap EOP was
>    sent, the test fails.
> g) If a SoftReset is received timely, the Tester replies with an Accept
>    message.
> h) The Tester sends Source Capabilities message to the UUT repeatedly until
>    nCapsCount reached or a GoodCRC is received. If nCapsCount reached, the
>    test fails.
> i) If a Request is not received timely within 30 ms after the GoodCRC EOP
>    corresponding to Source Capabilities message was received, the test
>    fails.
> 
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>

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

> ---
>  drivers/usb/typec/tcpm/tcpm.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 0afd8ef692e8..b3e07d9b7597 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -2243,6 +2243,7 @@ static void tcpm_pd_data_request(struct tcpm_port *port,
>  		 * handled.
>  		 */
>  			port->ams = POWER_NEGOTIATION;
> +			port->in_ams = true;
>  			tcpm_set_state(port, SNK_NEGOTIATE_CAPABILITIES, 0);
>  		} else {
>  			if (port->ams == GET_SOURCE_CAPABILITIES)
> -- 
> 2.30.0.365.g02bc693789-goog

thanks,

-- 
heikki

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

end of thread, other threads:[~2021-02-02  8:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02  3:38 [PATCH v1] usb: typec: tcpm: Set in_ams flag when Source caps have been received Badhri Jagan Sridharan
2021-02-02  3:50 ` Guenter Roeck
2021-02-02  8:25 ` Heikki Krogerus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®