summaryrefslogtreecommitdiff
path: root/drivers/usb/typec/ucsi
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 15:40:10 +0300
commitceeb162500c3480b660a47d509db7955a7913271 (patch)
treef532363ff66a205bd47aa6be9e28d9604db7159e /drivers/usb/typec/ucsi
parentfde0aa6c175a4d8aa19e82b86ae0f9278bc8563b (diff)
downloadlinux-ceeb162500c3480b660a47d509db7955a7913271.tar.xz
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/ucsi')
-rw-r--r--drivers/usb/typec/ucsi/ucsi.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index 69d544cfcd45..bf0977fbd100 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -592,11 +592,18 @@ static int ucsi_register_port(struct ucsi *ucsi, int index)
return ret;
if (con->cap.op_mode & UCSI_CONCAP_OPMODE_DRP)
- cap->type = TYPEC_PORT_DRP;
+ cap->data = TYPEC_PORT_DRD;
else if (con->cap.op_mode & UCSI_CONCAP_OPMODE_DFP)
- cap->type = TYPEC_PORT_DFP;
+ cap->data = TYPEC_PORT_DFP;
else if (con->cap.op_mode & UCSI_CONCAP_OPMODE_UFP)
- cap->type = TYPEC_PORT_UFP;
+ cap->data = TYPEC_PORT_UFP;
+
+ if (con->cap.provider && con->cap.consumer)
+ cap->type = TYPEC_PORT_DRP;
+ else if (con->cap.provider)
+ cap->type = TYPEC_PORT_SRC;
+ else if (con->cap.consumer)
+ cap->type = TYPEC_PORT_SNK;
cap->revision = ucsi->cap.typec_version;
cap->pd_revision = ucsi->cap.pd_version;