The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Badhri Jagan Sridharan <Badhri@google.com>,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 7/7] staging: typec: tcpm: Check cc status before entering SRC_TRY_DEBOUCE
Date: Thu, 10 Aug 2017 21:15:45 -0700	[thread overview]
Message-ID: <1502424945-19969-7-git-send-email-linux@roeck-us.net> (raw)
In-Reply-To: <1502424945-19969-1-git-send-email-linux@roeck-us.net>

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

      parent reply	other threads:[~2017-08-11  4:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-11  4:15 [PATCH 1/7] staging: typec: tcpm: Constify alternate modes Guenter Roeck
2017-08-11  4:15 ` [PATCH 2/7] staging: typec: tcpm: Report role swap complete after entering READY state Guenter Roeck
2017-08-11  4:15 ` [PATCH 3/7] staging: typec: tcpm: Set default state after error recovery based on port type Guenter Roeck
2017-08-11  4:15 ` [PATCH 4/7] staging: typec: tcpm: Select default state " Guenter Roeck
2017-08-11  4:15 ` [PATCH 5/7] staging: typec: tcpm: Add timeout when waiting for role swap completion Guenter Roeck
2017-08-11  4:15 ` [PATCH 6/7] staging: typec: tcpm: Improve role swap with non PD capable partners Guenter Roeck
2017-08-11  4:15 ` Guenter Roeck [this message]

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=1502424945-19969-7-git-send-email-linux@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=Badhri@google.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /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