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: [1/2] typec: tcpm: Do not disconnect link for self powered devices
Date: Wed, 12 Sep 2018 19:11:12 -0700 [thread overview]
Message-ID: <20180913021113.18150-1-badhri@google.com> (raw)
During HARD_RESET the data link is disconnected.
For self powered device, the spec is advising against doing that.
From USB_PD_R3_0
7.1.5 Response to Hard Resets
Device operation during and after a Hard Reset is defined as follows:
Self-powered devices Should Not disconnect from USB during a Hard Reset
(see Section 9.1.2).
Bus powered devices will disconnect from USB during a Hard Reset due to the
loss of their power source.
Tackle this by letting TCPM know whether the device is self or bus powered.
This overcomes unnecessary port disconnections from hard reset.
Also, speeds up the enumeration time when connected to Type-A ports.
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
---
drivers/usb/typec/tcpm.c | 6 +++++-
include/linux/usb/tcpm.h | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index 4f1f4215f3d6..a4e0c027a2a9 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -3270,7 +3270,11 @@ static void run_state_machine(struct tcpm_port *port)
memset(&port->pps_data, 0, sizeof(port->pps_data));
tcpm_set_vconn(port, false);
tcpm_set_charge(port, false);
- tcpm_set_roles(port, false, TYPEC_SINK, TYPEC_DEVICE);
+
+ if (port->tcpc->config->self_powered)
+ tcpm_set_roles(port, true, TYPEC_SINK, TYPEC_DEVICE);
+ else
+ tcpm_set_roles(port, false, TYPEC_SINK, TYPEC_DEVICE);
/*
* VBUS may or may not toggle, depending on the adapter.
* If it doesn't toggle, transition to SNK_HARD_RESET_SINK_ON
diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h
index 7e7fbfb84e8e..50c74a77db55 100644
--- a/include/linux/usb/tcpm.h
+++ b/include/linux/usb/tcpm.h
@@ -89,6 +89,7 @@ struct tcpc_config {
enum typec_port_data data;
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 */
const struct typec_altmode_desc *alt_modes;
};
WARNING: multiple messages have this Message-ID (diff)
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: [PATCH 1/2] typec: tcpm: Do not disconnect link for self powered devices
Date: Wed, 12 Sep 2018 19:11:12 -0700 [thread overview]
Message-ID: <20180913021113.18150-1-badhri@google.com> (raw)
During HARD_RESET the data link is disconnected.
For self powered device, the spec is advising against doing that.
From USB_PD_R3_0
7.1.5 Response to Hard Resets
Device operation during and after a Hard Reset is defined as follows:
Self-powered devices Should Not disconnect from USB during a Hard Reset
(see Section 9.1.2).
Bus powered devices will disconnect from USB during a Hard Reset due to the
loss of their power source.
Tackle this by letting TCPM know whether the device is self or bus powered.
This overcomes unnecessary port disconnections from hard reset.
Also, speeds up the enumeration time when connected to Type-A ports.
Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
---
drivers/usb/typec/tcpm.c | 6 +++++-
include/linux/usb/tcpm.h | 1 +
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index 4f1f4215f3d6..a4e0c027a2a9 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -3270,7 +3270,11 @@ static void run_state_machine(struct tcpm_port *port)
memset(&port->pps_data, 0, sizeof(port->pps_data));
tcpm_set_vconn(port, false);
tcpm_set_charge(port, false);
- tcpm_set_roles(port, false, TYPEC_SINK, TYPEC_DEVICE);
+
+ if (port->tcpc->config->self_powered)
+ tcpm_set_roles(port, true, TYPEC_SINK, TYPEC_DEVICE);
+ else
+ tcpm_set_roles(port, false, TYPEC_SINK, TYPEC_DEVICE);
/*
* VBUS may or may not toggle, depending on the adapter.
* If it doesn't toggle, transition to SNK_HARD_RESET_SINK_ON
diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h
index 7e7fbfb84e8e..50c74a77db55 100644
--- a/include/linux/usb/tcpm.h
+++ b/include/linux/usb/tcpm.h
@@ -89,6 +89,7 @@ struct tcpc_config {
enum typec_port_data data;
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 */
const struct typec_altmode_desc *alt_modes;
};
--
2.19.0.397.gdd90340f6a-goog
next reply other threads:[~2018-09-13 2:11 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-13 2:11 Badhri Jagan Sridharan [this message]
2018-09-13 2:11 ` [PATCH 1/2] typec: tcpm: Do not disconnect link for self powered devices Badhri Jagan Sridharan
-- strict thread matches above, loose matches on Subject: below --
2018-09-13 2:11 [2/2] typec: tcpm: Add option to maintain current limit at Vsafe5V Badhri Jagan Sridharan
2018-09-13 2:11 ` [PATCH 2/2] " Badhri Jagan Sridharan
2018-09-13 6:39 [2/2] " Jack Pham
2018-09-13 6:39 ` [PATCH 2/2] " Jack Pham
2018-09-13 13:24 [1/2] typec: tcpm: Do not disconnect link for self powered devices Heikki Krogerus
2018-09-13 13:24 ` [PATCH 1/2] " Heikki Krogerus
2018-09-13 13:43 [2/2] typec: tcpm: Add option to maintain current limit at Vsafe5V Badhri Jagan Sridharan
2018-09-13 13:43 ` [PATCH 2/2] " Badhri Jagan Sridharan
2018-09-13 13:45 [2/2] " Badhri Jagan Sridharan
2018-09-13 13:45 ` [PATCH 2/2] " Badhri Jagan Sridharan
2018-09-13 17:07 [2/2] " Jack Pham
2018-09-13 17:07 ` [PATCH 2/2] " Jack Pham
2018-09-13 17:51 [1/2] typec: tcpm: Do not disconnect link for self powered devices Guenter Roeck
2018-09-13 17:51 ` [PATCH 1/2] " Guenter Roeck
2018-09-13 23:16 [1/2] " Badhri Jagan Sridharan
2018-09-13 23:16 ` [PATCH 1/2] " Badhri Jagan Sridharan
2018-09-13 23:38 [2/2] typec: tcpm: Add option to maintain current limit at Vsafe5V Badhri Jagan Sridharan
2018-09-13 23:38 ` [PATCH 2/2] " Badhri Jagan Sridharan
2018-09-14 9:54 [1/2] typec: tcpm: Do not disconnect link for self powered devices Heikki Krogerus
2018-09-14 9:54 ` [PATCH 1/2] " Heikki Krogerus
2018-09-14 18:42 [2/2] typec: tcpm: Add option to maintain current limit at Vsafe5V Jack Pham
2018-09-14 18:42 ` [PATCH 2/2] " Jack Pham
2018-09-28 22:44 [2/2] " Badhri Jagan Sridharan
2018-09-28 22:44 ` [PATCH 2/2] " 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-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.