summaryrefslogtreecommitdiff
path: root/drivers/usb/typec/tcpm.c
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2018-03-20 15:57:05 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-22 13:40:10 +0100
commitceeb162500c3480b660a47d509db7955a7913271 (patch)
treef532363ff66a205bd47aa6be9e28d9604db7159e /drivers/usb/typec/tcpm.c
parentfde0aa6c175a4d8aa19e82b86ae0f9278bc8563b (diff)
usb: typec: Separate the definitions for data and power roles
USB Type-C specification v1.2 separated the power and data roles more clearly. Dual-Role-Data term was introduced, and the meaning of DRP was changed from "Dual-Role-Port" to "Dual-Role-Power". In order to allow the port drivers to describe the capabilities of the ports more clearly according to the newest specifications, introducing separate definitions for the data roles. Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec/tcpm.c')
-rw-r--r--drivers/usb/typec/tcpm.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
index 4c0fc5493d58..62e710bb6367 100644
--- a/drivers/usb/typec/tcpm.c
+++ b/drivers/usb/typec/tcpm.c
@@ -345,7 +345,7 @@ static enum tcpm_state tcpm_default_state(struct tcpm_port *port)
else if (port->tcpc->config->default_role == TYPEC_SINK)
return SNK_UNATTACHED;
/* Fall through to return SRC_UNATTACHED */
- } else if (port->port_type == TYPEC_PORT_UFP) {
+ } else if (port->port_type == TYPEC_PORT_SNK) {
return SNK_UNATTACHED;
}
return SRC_UNATTACHED;
@@ -2179,7 +2179,7 @@ static inline enum tcpm_state unattached_state(struct tcpm_port *port)
return SRC_UNATTACHED;
else
return SNK_UNATTACHED;
- } else if (port->port_type == TYPEC_PORT_DFP) {
+ } else if (port->port_type == TYPEC_PORT_SRC) {
return SRC_UNATTACHED;
}
@@ -3469,11 +3469,11 @@ static int tcpm_port_type_set(const struct typec_capability *cap,
if (!port->connected) {
tcpm_set_state(port, PORT_RESET, 0);
- } else if (type == TYPEC_PORT_UFP) {
+ } else if (type == TYPEC_PORT_SNK) {
if (!(port->pwr_role == TYPEC_SINK &&
port->data_role == TYPEC_DEVICE))
tcpm_set_state(port, PORT_RESET, 0);
- } else if (type == TYPEC_PORT_DFP) {
+ } else if (type == TYPEC_PORT_SRC) {
if (!(port->pwr_role == TYPEC_SOURCE &&
port->data_role == TYPEC_HOST))
tcpm_set_state(port, PORT_RESET, 0);
@@ -3641,6 +3641,7 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc)
port->typec_caps.prefer_role = tcpc->config->default_role;
port->typec_caps.type = tcpc->config->type;
+ port->typec_caps.data = tcpc->config->data;
port->typec_caps.revision = 0x0120; /* Type-C spec release 1.2 */
port->typec_caps.pd_revision = 0x0200; /* USB-PD spec release 2.0 */
port->typec_caps.dr_set = tcpm_dr_set;