]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/usb/typec/ucsi/ucsi.c
usb: typec: ucsi: Fix for incorrect status data issue
[mirror_ubuntu-bionic-kernel.git] / drivers / usb / typec / ucsi / ucsi.c
index 8d95b3a168d2adeb5e51ad309bdff89ebb6a6666..970afdf5e452f80d886414128326bdbf3e63ec8d 100644 (file)
@@ -343,6 +343,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