Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jignesh Patel" <jignesh1.patel@intel.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v2] usb: typec: displayport: correct DP sink plug/receptacle pin parsing
Date: Tue, 24 Nov 2026 12:15:07 +0000	[thread overview]
Message-ID: <sashiko-outbox-231112@kernel.org> (raw)
In-Reply-To: <20261124115241.2956206-1-jignesh1.patel@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] usb: typec: displayport: wrong DP role pin macro in
  dp_altmode_configure()
--

commit dce41c371c3e05eb264489df01883dfe3fa7a213
Author: Jignesh Patel <jignesh1.patel@intel.com>

usb: typec: displayport: correct DP sink plug/receptacle pin parsing

This commit updates the pin assignment macro used for the partner VDO in
the DP_STATUS_CON_DFP_D case of dp_altmode_configure() from
DP_CAP_UFP_D_PIN_ASSIGN() to DP_CAP_PIN_ASSIGN_UFP_D().

> diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
> index 4a566388bd6a5..35918eb023c1e 100644
> --- a/drivers/usb/typec/altmodes/displayport.c
> +++ b/drivers/usb/typec/altmodes/displayport.c
> @@ -114,7 +114,7 @@ static int dp_altmode_configure(struct dp_altmode *dp, u8 con)
>  		return 0;
>  	case DP_STATUS_CON_DFP_D:
>  		conf |= DP_CONF_UFP_U_AS_DFP_D;
> -		pin_assign = DP_CAP_UFP_D_PIN_ASSIGN(dp->alt->vdo) &
> +		pin_assign = DP_CAP_PIN_ASSIGN_UFP_D(dp->alt->vdo) &
>  			     DP_CAP_DFP_D_PIN_ASSIGN(dp->port->vdo);
>  		/* Account for active cable capabilities */
>  		if (dp->plug_prime)

[Severity: High]
Does DP_STATUS_CON_DFP_D configure the partner (dp->alt) as a DFP_D (DP
Source) rather than a UFP_D (DP Sink)?

This case sets DP_CONF_UFP_U_AS_DFP_D, which configures the UFP_U partner
as a DFP_D, whereas a UFP_D (DP Sink) partner is configured by the
DP_STATUS_CON_UFP_D case right below:

drivers/usb/typec/altmodes/displayport.c:dp_altmode_configure() {
	...
	case DP_STATUS_CON_UFP_D:
	case DP_STATUS_CON_BOTH: /* NOTE: First acting as DP source */
		conf |= DP_CONF_UFP_U_AS_UFP_D;
		pin_assign = DP_CAP_PIN_ASSIGN_UFP_D(dp->alt->vdo) &
				 DP_CAP_PIN_ASSIGN_DFP_D(dp->port->vdo);
	...
}

Using DP_CAP_PIN_ASSIGN_UFP_D(dp->alt->vdo) in DP_STATUS_CON_DFP_D reads
the UFP_D pin field on an actual DFP_D partner (which is 0 on both plug and
receptacle DFP_D devices), causing dp_altmode_configure() to fail with
-EINVAL.

When a UFP_D plug partner (such as 0x00001c05) reaches DP_STATUS_CON_DFP_D
(for example via ucsi_displayport_status_update(), which checks
DP_CAP_UFP_D on the local port VDO and reports DP_STATUS_CON_DFP_D), this
branch sets DP_CONF_UFP_U_AS_DFP_D in dp->data.conf.  That configures the
sink partner as a DP source and causes get_current_pin_assignments() to
check DP_CAP_PIN_ASSIGN_DFP_D(dp->alt->vdo), returning 0 and breaking the
pin_assignment and configuration sysfs attributes.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124115241.2956206-1-jignesh1.patel@intel.com?part=1

      reply	other threads:[~2026-11-24 12:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 11:52 [PATCH v2] usb: typec: displayport: correct DP sink plug/receptacle pin parsing Jignesh Patel
2026-11-24 12:15 ` sashiko-bot [this message]

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=sashiko-outbox-231112@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=jignesh1.patel@intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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