From: Badhri Jagan Sridharan <badhri@google.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Badhri Jagan Sridharan <badhri@google.com>,
Badhri Jagan Sridharan <Badhri@google.com>
Subject: [2/2] typec: tcpm: Add option to maintain current limit at Vsafe5V
Date: Wed, 12 Sep 2018 19:11:13 -0700 [thread overview]
Message-ID: <20180913021113.18150-2-badhri@google.com> (raw)
During hard reset, TCPM turns off the charging path.
The spec provides an option for Sink to either drop to vSafe5V or vSafe0V.
From USB_PD_R3_0
2.6.2 Sink Operation
..
Serious errors are handled by Hard Reset Signaling issued by either Port
Partner. A Hard Reset:
resets protocol as for a Soft Reset but also returns the power supply to
USB Default Operation (vSafe0V or vSafe5V output) in order to protect the
Sink.
Add a config option to tcpc_dev and let the device specific driver decide
what needs to be done.
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
---
drivers/usb/typec/tcpm.c | 7 ++++++-
include/linux/usb/tcpm.h | 1 +
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index a4e0c027a2a9..350d1a7c4543 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -3269,7 +3269,12 @@ static void run_state_machine(struct tcpm_port *port)
case SNK_HARD_RESET_SINK_OFF:
memset(&port->pps_data, 0, sizeof(port->pps_data));
tcpm_set_vconn(port, false);
- tcpm_set_charge(port, false);
+ if (port->tcpc->config->vsafe_5v_hard_reset)
+ tcpm_set_current_limit(port,
+ tcpm_get_current_limit(port),
+ 5000);
+ else
+ tcpm_set_charge(port, false);
if (port->tcpc->config->self_powered)
tcpm_set_roles(port, true, TYPEC_SINK, TYPEC_DEVICE);
diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h
index 50c74a77db55..c6e3ccecba70 100644
--- a/include/linux/usb/tcpm.h
+++ b/include/linux/usb/tcpm.h
@@ -90,6 +90,7 @@ struct tcpc_config {
enum typec_role default_role;
bool try_role_hw; /* try.{src,snk} implemented in hardware */
bool self_powered; /* port belongs to a self powered device */
+ bool vsafe_5v_hard_reset; /* Maintain VSAFE5V during hard reset */
const struct typec_altmode_desc *alt_modes;
};
next reply other threads:[~2018-09-13 2:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 2:11 Badhri Jagan Sridharan [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-09-13 6:39 [2/2] typec: tcpm: Add option to maintain current limit at Vsafe5V Jack Pham
2018-09-13 13:43 Badhri Jagan Sridharan
2018-09-13 13:45 Badhri Jagan Sridharan
2018-09-13 17:07 Jack Pham
2018-09-13 23:38 Badhri Jagan Sridharan
2018-09-14 18:42 Jack Pham
2018-09-28 22:44 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=20180913021113.18150-2-badhri@google.com \
--to=badhri@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@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;
as well as URLs for NNTP newsgroup(s).