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 08/11 v3] staging: typec: tcpm: add cc change handling in src states
Date: Mon, 28 Aug 2017 10:23:19 -0700 [thread overview]
Message-ID: <20170828172322.7166-8-Badhri@google.com> (raw)
In-Reply-To: <20170828172322.7166-1-Badhri@google.com>
In the case that the lower layer driver reports a cc change directly
from SINK state to SOURCE state, TCPM doesn't handle these cc change
in SRC_SEND_CAPABILITIES, SRC_READY states. And with SRC_ATTACHED
state, the change is not handled as the port is still considered
connected.
[49606.131672] state change DRP_TOGGLING -> SRC_ATTACH_WAIT
[49606.131701] pending state change SRC_ATTACH_WAIT -> SRC_ATTACHED @
200 ms
[49606.329952] state change SRC_ATTACH_WAIT -> SRC_ATTACHED [delayed 200
ms]
[49606.329978] polarity 0
[49606.329989] Requesting mux mode 1, config 0, polarity 0
[49606.349416] vbus:=1 charge=0
[49606.372274] pending state change SRC_ATTACHED -> SRC_UNATTACHED @ 480
ms
[49606.372431] VBUS on
[49606.372488] state change SRC_ATTACHED -> SRC_STARTUP
...
(the lower layer driver reports a direct change from source to sink)
[49606.536927] pending state change SRC_SEND_CAPABILITIES ->
SRC_SEND_CAPABILITIES @ 150 ms
[49606.547244] CC1: 2 -> 5, CC2: 0 -> 0 [state SRC_SEND_CAPABILITIES,
polarity 0, connected]
This can happen when the lower layer driver and/or the hardware
handles a portion of the Type-C state machine work, and quietly goes
through the unattached state.
Originally-from: Yueyao Zhu <yueyao@google.com>
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
Changelog since previous version:
- Only one previous version of the patch was sent.
Numbering this V3 instead of V2 to keep the sequence
number in sync with the rest of the patches in the
patch list.
- 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 645f43ee83df..1f6827f32b29 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -2874,10 +2874,12 @@ static void _tcpm_cc_change(struct tcpm_port *port, enum typec_cc_status cc1,
tcpm_set_state(port, SRC_ATTACH_WAIT, 0);
break;
case SRC_ATTACHED:
- if (tcpm_port_is_disconnected(port))
+ case SRC_SEND_CAPABILITIES:
+ case SRC_READY:
+ if (tcpm_port_is_disconnected(port) ||
+ !tcpm_port_is_source(port))
tcpm_set_state(port, SRC_UNATTACHED, 0);
break;
-
case SNK_UNATTACHED:
if (tcpm_port_is_sink(port))
tcpm_set_state(port, SNK_ATTACH_WAIT, 0);
--
2.14.1.342.g6490525c54-goog
next prev parent reply other threads:[~2017-08-28 17:24 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 ` [PATCH 02/11 v3] staging: typec: tcpm: Check for port type for Try.SRC/Try.SNK Badhri Jagan Sridharan
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 ` Badhri Jagan Sridharan [this message]
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-8-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