linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: linux-usb@vger.kernel.org
Cc: Yehezkel Bernat <YehezkelShB@gmail.com>,
	Michael Jamet <michael.jamet@intel.com>,
	Lukas Wunner <lukas@wunner.de>,
	Andreas Noever <andreas.noever@gmail.com>,
	Gil Fine <gil.fine@linux.intel.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: [PATCH 09/10] thunderbolt: Calculate DisplayPort tunnel bandwidth after DPRX capabilities read
Date: Fri,  9 Feb 2024 16:13:34 +0200	[thread overview]
Message-ID: <20240209141335.2286786-10-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <20240209141335.2286786-1-mika.westerberg@linux.intel.com>

From: Gil Fine <gil.fine@linux.intel.com>

According to USB4 Connection Manager guide, after DisplayPort tunnel was
setup, the DPRX capabilities read is performed by the DPTX. According to
VESA spec, this shall be completed within 5 seconds after the DisplayPort
tunnel was setup. Hence, if the bit: DPRX Capabilities Read Done, was
not set to '1' by this time, we timeout and fail calculating DisplayPort
tunnel consumed bandwidth.

Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/thunderbolt/tunnel.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c
index e02b34654d29..cb6609a56a03 100644
--- a/drivers/thunderbolt/tunnel.c
+++ b/drivers/thunderbolt/tunnel.c
@@ -1184,17 +1184,13 @@ static int tb_dp_consumed_bandwidth(struct tb_tunnel *tunnel, int *consumed_up,
 		/*
 		 * Then see if the DPRX negotiation is ready and if yes
 		 * return that bandwidth (it may be smaller than the
-		 * reduced one). Otherwise return the remote (possibly
-		 * reduced) caps.
+		 * reduced one). According to VESA spec, the DPRX
+		 * negotiation shall compete in 5 seconds after tunnel
+		 * established. We give it 100ms extra just in case.
 		 */
-		ret = tb_dp_wait_dprx(tunnel, 150);
-		if (ret) {
-			if (ret == -ETIMEDOUT)
-				ret = tb_dp_read_cap(tunnel, DP_REMOTE_CAP,
-						     &rate, &lanes);
-			if (ret)
-				return ret;
-		}
+		ret = tb_dp_wait_dprx(tunnel, 5100);
+		if (ret)
+			return ret;
 		ret = tb_dp_read_cap(tunnel, DP_COMMON_CAP, &rate, &lanes);
 		if (ret)
 			return ret;
-- 
2.43.0


  parent reply	other threads:[~2024-02-09 14:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-09 14:13 [PATCH 00/10] thunderbolt: DisplayPort and bandwidth allocation mode improvements Mika Westerberg
2024-02-09 14:13 ` [PATCH 01/10] thunderbolt: Use DP_LOCAL_CAP for maximum bandwidth calculation Mika Westerberg
2024-02-09 14:13 ` [PATCH 02/10] thunderbolt: Re-calculate estimated bandwidth when allocation mode is enabled Mika Westerberg
2024-02-09 14:13 ` [PATCH 03/10] thunderbolt: Handle bandwidth allocation mode disable request Mika Westerberg
2024-02-09 14:13 ` [PATCH 04/10] thunderbolt: Log an error if DPTX request is not cleared Mika Westerberg
2024-02-09 14:13 ` [PATCH 05/10] thunderbolt: Fail the failed bandwidth request properly Mika Westerberg
2024-02-09 14:13 ` [PATCH 06/10] thunderbolt: Re-order bandwidth group functions Mika Westerberg
2024-02-09 14:13 ` [PATCH 07/10] thunderbolt: Introduce tb_tunnel_direction_downstream() Mika Westerberg
2024-02-09 14:13 ` [PATCH 08/10] thunderbolt: Reserve released DisplayPort bandwidth for a group for 10 seconds Mika Westerberg
2024-02-09 14:13 ` Mika Westerberg [this message]
2024-02-09 14:13 ` [PATCH 10/10] thunderbolt: Improve DisplayPort tunnel setup process to be more robust Mika Westerberg
2024-02-16 10:39 ` [PATCH 00/10] thunderbolt: DisplayPort and bandwidth allocation mode improvements Mika Westerberg

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=20240209141335.2286786-10-mika.westerberg@linux.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=andreas.noever@gmail.com \
    --cc=gil.fine@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=michael.jamet@intel.com \
    /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).