All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: heikki.krogerus@linux.intel.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, pumahsu <pumahsu@google.com>,
	Badhri Jagan Sridharan <badhri@google.com>,
	Kyle Tso <kyletso@google.com>,
	Will McVicker <willmcvicker@google.com>
Subject: Re: [PATCH 2/5] USB: typec: tcpm: Hard Reset after not receiving a Request
Date: Thu, 10 Dec 2020 09:43:26 -0800	[thread overview]
Message-ID: <20201210174326.GC107395@roeck-us.net> (raw)
In-Reply-To: <20201210160521.3417426-3-gregkh@linuxfoundation.org>

On Thu, Dec 10, 2020 at 05:05:18PM +0100, Greg Kroah-Hartman wrote:
> From: pumahsu <pumahsu@google.com>
> 
> PD 3.0 spec 8.3.3.2.3, A Get_Source_Cap message is sent
> to a UUT that is in the PE_SRC_Ready state. After sending
> a Source_Capabilities message, the UUT should then expect
> a Request message in response. When one is not received,
> the UUT should timeout to PE_SRC_Hard_Reset.
> 
> 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: pumahsu <pumahsu@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 | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 0ceeab50ed64..0efda59bb104 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -2218,6 +2218,7 @@ static int tcpm_pd_send_control(struct tcpm_port *port,
>  static bool tcpm_send_queued_message(struct tcpm_port *port)
>  {
>  	enum pd_msg_request queued_message;
> +	int ret;
>  
>  	do {
>  		queued_message = port->queued_message;
> @@ -2237,7 +2238,16 @@ static bool tcpm_send_queued_message(struct tcpm_port *port)
>  			tcpm_pd_send_sink_caps(port);
>  			break;
>  		case PD_MSG_DATA_SOURCE_CAP:
> -			tcpm_pd_send_source_caps(port);
> +			ret = tcpm_pd_send_source_caps(port);
> +			if (ret < 0) {
> +				tcpm_log(port,
> +					 "Unable to send src caps, ret=%d",
> +					 ret);
> +				tcpm_set_state(port, SOFT_RESET_SEND, 0);
> +			} else if (port->pwr_role == TYPEC_SOURCE) {
> +				tcpm_set_state(port, HARD_RESET_SEND,
> +					       PD_T_SENDER_RESPONSE);
> +			}
>  			break;
>  		default:
>  			break;
> -- 
> 2.29.2
> 

  reply	other threads:[~2020-12-10 17:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10 16:05 [PATCH 0/5] USB: typec: various patches Greg Kroah-Hartman
2020-12-10 16:05 ` [PATCH 1/5] USB: typec: tcpm: Prevent log overflow by removing old entries Greg Kroah-Hartman
2020-12-10 17:42   ` Guenter Roeck
2020-12-10 19:10     ` Badhri Jagan Sridharan
2020-12-11  0:01       ` Guenter Roeck
2020-12-10 16:05 ` [PATCH 2/5] USB: typec: tcpm: Hard Reset after not receiving a Request Greg Kroah-Hartman
2020-12-10 17:43   ` Guenter Roeck [this message]
2020-12-10 16:05 ` [PATCH 3/5] USB: typec: tcpm: Fix PR_SWAP error handling Greg Kroah-Hartman
2020-12-10 17:43   ` Guenter Roeck
2020-12-10 16:05 ` [PATCH 4/5] USB: typec: tcpm: Add a 30ms room for tPSSourceOn in PR_SWAP Greg Kroah-Hartman
2020-12-10 17:44   ` Guenter Roeck
2020-12-10 16:05 ` [PATCH 5/5] USB: typec: tcpci: Add Bleed discharge to POWER_CONTROL definition Greg Kroah-Hartman
2020-12-10 17:45   ` Guenter Roeck
2020-12-10 18:56     ` Badhri Jagan Sridharan
2020-12-11  4:47       ` Badhri Jagan Sridharan
2020-12-11  6:38         ` Greg Kroah-Hartman
2020-12-11  8:30 ` [PATCH 0/5] USB: typec: various patches Heikki Krogerus
2020-12-11  9:51   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201210174326.GC107395@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=kyletso@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pumahsu@google.com \
    --cc=willmcvicker@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.