Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1709238

[PATCH 7/7] staging: typec: tcpm: Check cc status before entering SRC_TRY_DEBOUCE

From Guenter Roeck <linux@roeck-us.net>
Newsgroups linux.kernel
Subject [PATCH 7/7] staging: typec: tcpm: Check cc status before entering SRC_TRY_DEBOUCE
Date 2017-08-11 06:20 +0200
Message-ID <ud9At-782-15@gated-at.bofh.it> (permalink)
References <ud9At-782-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Badhri Jagan Sridharan <Badhri@google.com>

[  130.893355] state change SNK_DEBOUNCED -> SRC_TRY
[  130.893363] cc:=3
[  130.893490] pending state change SRC_TRY -> SNK_TRYWAIT @ 100 ms
[  130.895602] CC1: 3 -> 0, CC2: 0 -> 0 [state SRC_TRY, polarity 0, disconnected]
[  130.895613] state change SRC_TRY -> SRC_TRY_DEBOUNCE
[  130.895621] pending state change SRC_TRY_DEBOUNCE -> SRC_ATTACHED @ 20 ms
[  130.916843] state change SRC_TRY_DEBOUNCE -> SRC_ATTACHED [delayed 20 ms]

Although the CC state was changing to TYPEC_CC_OPEN, the port entered
SRC_TRY_DEBOUNCE from SRC_TRY. The port must enter SRC_TRY_DEBOUNCE only
if the CC state is TYPEC_CC_RD.

Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
[groeck: Wording]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/staging/typec/tcpm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index e0f71aeb4ed3..e72286464164 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -2898,7 +2898,8 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1,
 		break;
 
 	case SRC_TRY:
-		tcpm_set_state(port, SRC_TRY_DEBOUNCE, 0);
+		if (tcpm_port_is_source(port))
+			tcpm_set_state(port, SRC_TRY_DEBOUNCE, 0);
 		break;
 	case SRC_TRY_DEBOUNCE:
 		tcpm_set_state(port, SRC_TRY, 0);
-- 
2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/7] staging: typec: tcpm: Constify alternate modes Guenter Roeck <linux@roeck-us.net> - 2017-08-11 06:20 +0200
  [PATCH 5/7] staging: typec: tcpm: Add timeout when waiting for role swap completion Guenter Roeck <linux@roeck-us.net> - 2017-08-11 06:20 +0200
  [PATCH 7/7] staging: typec: tcpm: Check cc status before entering SRC_TRY_DEBOUCE Guenter Roeck <linux@roeck-us.net> - 2017-08-11 06:20 +0200
  [PATCH 3/7] staging: typec: tcpm: Set default state after error recovery based on port type Guenter Roeck <linux@roeck-us.net> - 2017-08-11 06:20 +0200
  [PATCH 4/7] staging: typec: tcpm: Select default state based on port type Guenter Roeck <linux@roeck-us.net> - 2017-08-11 06:20 +0200

csiph-web