Skip to contentSkip to conversation

patch "usb: typec: ucsi: Fix for incorrect status data issue" added to usb-linus

PATCH [email protected] 1 participant 1 message Jun 25, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

usb: typec: ucsi: Fix for incorrect status data issue

to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.

If you have any questions about this process, please let me know.

Quoted 1 line

From 68816e16b4789f2d05e77b6dcb77564cf5d6a8d8 Mon Sep 17 00:00:00 2001

From: Heikki Krogerus <[email protected]>
Date: Thu, 21 Jun 2018 16:43:19 +0300
Subject: usb: typec: ucsi: Fix for incorrect status data issue

According to UCSI Specification, Connector Change Event only means a change in the Connector Status and Operation Mode fields of the STATUS data structure. So any other change should create another event.

Unfortunately on some platforms the firmware acting as PPM (platform policy manager - usually embedded controller firmware) still does not report any other status changes if there is a connector change event. So if the connector power or data role was changed when a device was plugged to the connector, the driver does not get any indication about that. The port will show wrong roles if that happens.

To fix the issue, always checking the data and power role together with a connector change event.

Fixes c1b0bc2dabfa ("usb: typec: Add support for UCSI interface")
Cc stable <[email protected]>
---
 drivers/usb/typec/ucsi/ucsi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/usb/typec/ucsi/ucsi.c +13 -0
index bd5cca5632b3..8d0a6fe748bd 100644
@@ -350,6 +350,19 @@ static void ucsi_connector_change(struct work_struct *work)
 	}
 
 	if (con->status.change & UCSI_CONSTAT_CONNECT_CHANGE) {
+		typec_set_pwr_role(con->port, con->status.pwr_dir);
+
+		switch (con->status.partner_type) {
+		case UCSI_CONSTAT_PARTNER_TYPE_UFP:
+			typec_set_data_role(con->port, TYPEC_HOST);
+			break;
+		case UCSI_CONSTAT_PARTNER_TYPE_DFP:
+			typec_set_data_role(con->port, TYPEC_DEVICE);
+			break;
+		default:
+			break;
+		}
+
 		if (con->status.connected)
 			ucsi_register_partner(con);
 		else
Signature · 1 line
2.18.0