mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Badhri Jagan Sridharan <badhri@google.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Guenter Roeck <linux@roeck-us.net>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Badhri Jagan Sridharan <Badhri@google.com>
Subject: [PATCH 02/11 v3] staging: typec: tcpm: Check for port type for Try.SRC/Try.SNK
Date: Mon, 28 Aug 2017 10:23:13 -0700	[thread overview]
Message-ID: <20170828172322.7166-2-Badhri@google.com> (raw)
In-Reply-To: <20170828172322.7166-1-Badhri@google.com>

Enable Try.SRC or Try.SNK only when port_type is
DRP. Try.SRC or Try.SNK state machines are not
valid for SRC only or SNK only ports.

Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
Changelog since v1:
- Corrected  tag

Changelog since v2:
- added Reviewed-by: Guenter Roeck <linux@roeck-us.net>
- fixed version/sequence numbers

 drivers/staging/typec/tcpm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index 6c045ac9c42a..1219e3bc13ef 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -328,10 +328,12 @@ struct pd_rx_event {
 	 (tcpm_cc_is_audio((port)->cc2) && tcpm_cc_is_open((port)->cc1)))
 
 #define tcpm_try_snk(port) \
-	((port)->try_snk_count == 0 && (port)->try_role == TYPEC_SINK)
+	((port)->try_snk_count == 0 && (port)->try_role == TYPEC_SINK && \
+	(port)->port_type == TYPEC_PORT_DRP)
 
 #define tcpm_try_src(port) \
-	((port)->try_src_count == 0 && (port)->try_role == TYPEC_SOURCE)
+	((port)->try_src_count == 0 && (port)->try_role == TYPEC_SOURCE && \
+	(port)->port_type == TYPEC_PORT_DRP)
 
 static enum tcpm_state tcpm_default_state(struct tcpm_port *port)
 {
-- 
2.14.1.342.g6490525c54-goog

  reply	other threads:[~2017-08-28 17:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-28 17:23 [PATCH 01/11 v3] staging: typec: tcpm: set port type callback Badhri Jagan Sridharan
2017-08-28 17:23 ` Badhri Jagan Sridharan [this message]
2017-08-28 17:23 ` [PATCH 03/11 v3] staging: typec: tcpm: Prevent TCPM from looping in SRC_TRYWAIT Badhri Jagan Sridharan
2017-08-28 17:23 ` [PATCH 04/11 v3] staging: usb: tcpm: usb: type-c: tcpm: Check for Rp for tPDDebounce Badhri Jagan Sridharan
2017-08-28 17:23 ` [PATCH 05/11 v3] staging: typec: tcpm: Follow Try.SRC exit requirements Badhri Jagan Sridharan
2017-08-28 17:23 ` [PATCH 06/11 v3] staging: typec: tcpm: Comply with TryWait.SNK State Badhri Jagan Sridharan
2017-08-28 17:23 ` [PATCH 07/11 v3] staging: typec: tcpm: Consider port_type while determining unattached_state Badhri Jagan Sridharan
2017-08-28 17:23 ` [PATCH 08/11 v3] staging: typec: tcpm: add cc change handling in src states Badhri Jagan Sridharan
2017-08-28 17:23 ` [PATCH 09/11 v3] staging: typec: tcpm: typec: tcpm: Wait for CC debounce before PD excg Badhri Jagan Sridharan
2017-08-28 17:23 ` [PATCH 10/11 v3] staging: typec: tcpm: Do not send PING msgs in TCPM Badhri Jagan Sridharan
2017-08-28 17:23 ` [PATCH 11/11 v3] staging: typec: tcpm: Switch to PORT_RESET instead of SNK_UNATTACHED Badhri Jagan Sridharan

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=20170828172322.7166-2-Badhri@google.com \
    --to=badhri@google.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome