linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: joswang <joswang1221@gmail.com>, Benson Leung <bleung@chromium.org>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, Jos Wang <joswang@lenovo.com>
Subject: Re: [PATCH 1/1] usb: typec: displayport: Receive DP Status Update NAK request exit dp altmode
Date: Thu, 13 Feb 2025 15:52:04 +0200	[thread overview]
Message-ID: <Z635BJNnFAiIFXxM@kuha.fi.intel.com> (raw)
In-Reply-To: <20250209071926.69625-1-joswang1221@gmail.com>

On Sun, Feb 09, 2025 at 03:19:26PM +0800, joswang wrote:
> From: Jos Wang <joswang@lenovo.com>
> 
> Although some Type-C DRD devices that do not support the DP Sink
> function (such as Huawei Mate 40Pro), the Source Port initiates
> Enter Mode CMD, but the device responds to Enter Mode ACK, the
> Source port then initiates DP Status Update CMD, and the device
> responds to DP Status Update NAK.
> 
> As PD2.0 spec ("6.4.4.3.4 Enter Mode Command"),A DR_Swap Message
> Shall Not be sent during Modal Operation between the Port Partners.
> At this time, the source port initiates DR_Swap message through the
> "echo device > /sys/class/typec/port0/data_role" command to switch
> the data role from host to device. The device will initiate a Hard
> Reset for recovery, resulting in the failure of data role swap.
> 
> Therefore, when DP Status Update NAK is received, Exit Mode CMD is
> initiated to exit the currently entered DP altmode.
> 
> Signed-off-by: Jos Wang <joswang@lenovo.com>

This looks okay to me, but Benson, can you take a look at this?

> ---
>  drivers/usb/typec/altmodes/displayport.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
> index ac84a6d64c2f..b09b58d7311d 100644
> --- a/drivers/usb/typec/altmodes/displayport.c
> +++ b/drivers/usb/typec/altmodes/displayport.c
> @@ -393,6 +393,10 @@ static int dp_altmode_vdm(struct typec_altmode *alt,
>  		break;
>  	case CMDT_RSP_NAK:
>  		switch (cmd) {
> +		case DP_CMD_STATUS_UPDATE:
> +			if (typec_altmode_exit(alt))
> +				dev_err(&dp->alt->dev, "Exit Mode Failed!\n");
> +			break;
>  		case DP_CMD_CONFIGURE:
>  			dp->data.conf = 0;
>  			ret = dp_altmode_configured(dp);
> -- 
> 2.17.1

-- 
heikki

  reply	other threads:[~2025-02-13 13:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-09  7:19 [PATCH 1/1] usb: typec: displayport: Receive DP Status Update NAK request exit dp altmode joswang
2025-02-13 13:52 ` Heikki Krogerus [this message]
2025-04-10  7:10   ` Greg KH
2025-04-10  8:25     ` Heikki Krogerus

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=Z635BJNnFAiIFXxM@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=bleung@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joswang1221@gmail.com \
    --cc=joswang@lenovo.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;
as well as URLs for NNTP newsgroup(s).