public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 02/11 v2] staging: typec: tcpm: Check for port type for Try.SRC/Try.SNK
@ 2017-08-27  6:41 Badhri Jagan Sridharan
  0 siblings, 0 replies; only message in thread
From: Badhri Jagan Sridharan @ 2017-08-27  6:41 UTC (permalink / raw)
  To: Guenter Roeck, Greg Kroah-Hartman
  Cc: devel, linux-kernel, Badhri Jagan Sridharan

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>
---
Changelog since v1:
- Corrected  tag

 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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-08-27  6:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-27  6:41 [PATCH 02/11 v2] staging: typec: tcpm: Check for port type for Try.SRC/Try.SNK Badhri Jagan Sridharan

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