From: Guenter Roeck <linux@roeck-us.net>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Yueyao Zhu <yueyao.zhu@gmail.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 7/7] staging: typec: tcpm: Fix Port Power Role field in PS_RDY messages
Date: Tue, 9 May 2017 09:04:59 -0700 [thread overview]
Message-ID: <1494345899-14283-7-git-send-email-linux@roeck-us.net> (raw)
In-Reply-To: <1494345899-14283-1-git-send-email-linux@roeck-us.net>
PS_RDY messages sent during power swap sequences are expected to reflect
the new power role.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/staging/typec/tcpm.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index c749e980ddf9..20eb4ebcf8c3 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -2607,6 +2607,14 @@ static void run_state_machine(struct tcpm_port *port)
break;
case PR_SWAP_SRC_SNK_SOURCE_OFF:
tcpm_set_cc(port, TYPEC_CC_RD);
+ /*
+ * USB-PD standard, 6.2.1.4, Port Power Role:
+ * "During the Power Role Swap Sequence, for the initial Source
+ * Port, the Port Power Role field shall be set to Sink in the
+ * PS_RDY Message indicating that the initial Source’s power
+ * supply is turned off"
+ */
+ tcpm_set_pwr_role(port, TYPEC_SINK);
if (tcpm_pd_send_control(port, PD_CTRL_PS_RDY)) {
tcpm_set_state(port, ERROR_RECOVERY, 0);
break;
@@ -2614,7 +2622,6 @@ static void run_state_machine(struct tcpm_port *port)
tcpm_set_state_cond(port, SNK_UNATTACHED, PD_T_PS_SOURCE_ON);
break;
case PR_SWAP_SRC_SNK_SINK_ON:
- tcpm_set_pwr_role(port, TYPEC_SINK);
tcpm_swap_complete(port, 0);
tcpm_set_state(port, SNK_STARTUP, 0);
break;
@@ -2626,8 +2633,15 @@ static void run_state_machine(struct tcpm_port *port)
case PR_SWAP_SNK_SRC_SOURCE_ON:
tcpm_set_cc(port, tcpm_rp_cc(port));
tcpm_set_vbus(port, true);
- tcpm_pd_send_control(port, PD_CTRL_PS_RDY);
+ /*
+ * USB PD standard, 6.2.1.4:
+ * "Subsequent Messages initiated by the Policy Engine,
+ * such as the PS_RDY Message sent to indicate that Vbus
+ * is ready, will have the Port Power Role field set to
+ * Source."
+ */
tcpm_set_pwr_role(port, TYPEC_SOURCE);
+ tcpm_pd_send_control(port, PD_CTRL_PS_RDY);
tcpm_swap_complete(port, 0);
tcpm_set_state(port, SRC_STARTUP, 0);
break;
--
2.7.4
next prev parent reply other threads:[~2017-05-09 16:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-09 16:04 [PATCH 1/7] staging: typec: tcpci: declare private structure as static Guenter Roeck
2017-05-09 16:04 ` [PATCH 2/7] staging: typec: fusb302: Fix module autoload Guenter Roeck
2017-05-09 16:04 ` [PATCH 3/7] staging: typec: fusb302: Fix chip->vbus_present init value Guenter Roeck
2017-05-09 16:04 ` [PATCH 4/7] staging: typec: tcpm: Drop duplicate PD messages Guenter Roeck
2017-05-09 16:04 ` [PATCH 5/7] staging: typec: tcpm: Set correct flags in PD request messages Guenter Roeck
2017-05-09 16:04 ` [PATCH 6/7] staging: typec: tcpm: Respond to Discover Identity commands Guenter Roeck
2017-05-09 16:04 ` Guenter Roeck [this message]
2017-05-09 17:46 ` [PATCH 1/7] staging: typec: tcpci: declare private structure as static Greg Kroah-Hartman
2017-05-09 21:13 ` Guenter Roeck
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=1494345899-14283-7-git-send-email-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yueyao.zhu@gmail.com \
/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
all inboxes | Powered by JetHome®