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 2/2] staging: typec: tcpm: explicit_contract is always established
Date: Tue, 15 Aug 2017 16:23:39 -0700 [thread overview]
Message-ID: <20170815232339.26701-1-Badhri@google.com> (raw)
While in SNK_READY state, the explicit_contract seems to be
set to true irrespective of whether an explicit contract
was established for the current connection. TCPM also seems
to report the pwr_opmode as TYPEC_PWR_MODE_PD always once
the port gets into SNK_READY state. This isn't completely
true as port gets into the SNK_READY state for non-pd
type-c ports as well.
This patch sets the explicit_contract flag only when
the PS_READY message is received and the vbus has been
detected by the port controller.
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
---
drivers/staging/typec/tcpm.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index a24e6bbb909c..3e12cf101311 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -1367,6 +1367,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
tcpm_set_current_limit(port,
port->current_limit,
port->supply_voltage);
+ port->explicit_contract = true;
tcpm_set_state(port, SNK_READY, 0);
} else {
/*
@@ -2458,10 +2459,11 @@ static void run_state_machine(struct tcpm_port *port)
break;
case SNK_READY:
port->try_snk_count = 0;
- port->explicit_contract = true;
- typec_set_pwr_opmode(port->typec_port, TYPEC_PWR_MODE_PD);
- port->pwr_opmode = TYPEC_PWR_MODE_PD;
-
+ if (port->explicit_contract) {
+ typec_set_pwr_opmode(port->typec_port,
+ TYPEC_PWR_MODE_PD);
+ port->pwr_opmode = TYPEC_PWR_MODE_PD;
+ }
tcpm_typec_connect(port);
tcpm_check_send_discover(port);
@@ -2951,6 +2953,7 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port)
port->vbus_present = true;
switch (port->state) {
case SNK_TRANSITION_SINK_VBUS:
+ port->explicit_contract = true;
tcpm_set_state(port, SNK_READY, 0);
break;
case SNK_DISCOVERY:
--
2.14.1.480.gb18f417b89-goog
next reply other threads:[~2017-08-15 23:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-15 23:23 Badhri Jagan Sridharan [this message]
2017-08-16 3:30 ` [PATCH 2/2] staging: typec: tcpm: explicit_contract is always established Guenter Roeck
2017-08-17 17:54 ` Greg Kroah-Hartman
2017-08-17 19:06 ` 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=20170815232339.26701-1-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