]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: typec: altmodes/displayport: do not enter mode if port is the UFP
authorRD Babiera <rdbabiera@google.com>
Tue, 23 Sep 2025 18:16:08 +0000 (18:16 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 Oct 2025 07:11:50 +0000 (09:11 +0200)
Nothing currently stops the DisplayPort Alt Mode driver from sending
Enter Mode if the port is the Data Device. Utilize
typec_altmode_get_data_role to prevent mode entry.

Signed-off-by: RD Babiera <rdbabiera@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20250923181606.1583584-6-rdbabiera@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/altmodes/displayport.c

index 1dcb77faf85d450e347260372f0b8fcad40b5bdc..8d111ad3b71b8066d07c35a3bf24b481c888d633 100644 (file)
@@ -758,7 +758,9 @@ int dp_altmode_probe(struct typec_altmode *alt)
        struct fwnode_handle *fwnode;
        struct dp_altmode *dp;
 
-       /* FIXME: Port can only be DFP_U. */
+       /* Port can only be DFP_U. */
+       if (typec_altmode_get_data_role(alt) != TYPEC_HOST)
+               return -EPROTO;
 
        /* Make sure we have compatible pin configurations */
        if (!(DP_CAP_PIN_ASSIGN_DFP_D(port->vdo) &