The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: RD Babiera <rdbabiera@google.com>
Cc: heikki.krogerus@linux.intel.com, gregkh@linuxfoundation.org,
	 badhri@google.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org,  RD Babiera <rdbabiera@google.com>
Subject: [PATCH v2 2/2] usb: typec: altmodes/displayport: do not enter mode if port is the UFP
Date: Tue, 23 Sep 2025 18:16:08 +0000	[thread overview]
Message-ID: <20250923181606.1583584-6-rdbabiera@google.com> (raw)
In-Reply-To: <20250923181606.1583584-4-rdbabiera@google.com>

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>
---
 drivers/usb/typec/altmodes/displayport.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
index 1dcb77faf85d..8d111ad3b71b 100644
--- a/drivers/usb/typec/altmodes/displayport.c
+++ b/drivers/usb/typec/altmodes/displayport.c
@@ -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) &
-- 
2.51.0.534.gc79095c0ca-goog


  parent reply	other threads:[~2025-09-23 18:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-23 18:16 [PATCH v2 0/2] usb: typec: altmodes/displayport: add port data role handling support RD Babiera
2025-09-23 18:16 ` [PATCH v2 1/2] usb: typec: class: add typec_get_data_role symbol RD Babiera
2025-10-08 10:32   ` Heikki Krogerus
2025-09-23 18:16 ` RD Babiera [this message]
2025-10-08 10:33   ` [PATCH v2 2/2] usb: typec: altmodes/displayport: do not enter mode if port is the UFP Heikki Krogerus
2026-01-10  7:53   ` Andy Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250923181606.1583584-6-rdbabiera@google.com \
    --to=rdbabiera@google.com \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox