public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Brad Campbell <lists2009@fnarfbargle.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Apple Thunderbolt Display chaining
Date: Wed, 30 Mar 2022 13:18:59 +0300	[thread overview]
Message-ID: <YkQuk7E8AbSEiw59@lahna> (raw)
In-Reply-To: <b8894440-41b1-edef-dd2d-5bafabc6fb62@fnarfbargle.com>

Hi,

On Tue, Mar 29, 2022 at 10:06:35PM +0800, Brad Campbell wrote:
> > Indeed, I did not add this to the "discovery" path yet.
> > 
> > I wonder what happens if you change this:
> > 
> > +       tunnel = tb_tunnel_alloc_dp(tb, in, out, available_up, available_down,
> > +                                   first ? 0 : 1);
> > 
> > to this in your tree:
> > 
> > +       tunnel = tb_tunnel_alloc_dp(tb, in, out, available_up, available_down,
> > +                                   first ? 1 : 0);
> > 
> 
> Here's where it gets all "Apple..y". On the iMac this does the job no matter which
> port the chain is plugged into. Boots and displays correctly first time, every time.
> 
> It turns out on the laptop, one port works and the other doesn't. Changing the order
> simply changes which port works. So I assume the EFI sets up the first display using
> the first lane if it's in the first port, and the second if it's in the second.
> 
> That means had I managed to perform the first test in the "other port" consistently,
> it would have worked there also.

Can you try the below patch too? I hard-code the lane based on the
DP adapter number in TBT gen1.

Let's first figure out proper solution to this issue and then look at
the other one.

diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c
index a473cc7d9a8d..97d36a7bb527 100644
--- a/drivers/thunderbolt/tunnel.c
+++ b/drivers/thunderbolt/tunnel.c
@@ -865,6 +865,7 @@ struct tb_tunnel *tb_tunnel_alloc_dp(struct tb *tb, struct tb_port *in,
 	struct tb_tunnel *tunnel;
 	struct tb_path **paths;
 	struct tb_path *path;
+	int link_nr;
 
 	if (WARN_ON(!in->cap_adap || !out->cap_adap))
 		return NULL;
@@ -883,22 +884,32 @@ struct tb_tunnel *tb_tunnel_alloc_dp(struct tb *tb, struct tb_port *in,
 
 	paths = tunnel->paths;
 
+	/*
+	 * Hard code the lane for both DP IN adapters in first
+	 * generation hardware. This should follow what the Apple boot
+	 * firmware does.
+	 */
+	if (in->sw->generation == 1)
+		link_nr = in->port == 11 ? 1 : 0;
+	else
+		link_nr = 0;
+
 	path = tb_path_alloc(tb, in, TB_DP_VIDEO_HOPID, out, TB_DP_VIDEO_HOPID,
-			     1, "Video");
+			     link_nr, "Video");
 	if (!path)
 		goto err_free;
 	tb_dp_init_video_path(path);
 	paths[TB_DP_VIDEO_PATH_OUT] = path;
 
 	path = tb_path_alloc(tb, in, TB_DP_AUX_TX_HOPID, out,
-			     TB_DP_AUX_TX_HOPID, 1, "AUX TX");
+			     TB_DP_AUX_TX_HOPID, link_nr, "AUX TX");
 	if (!path)
 		goto err_free;
 	tb_dp_init_aux_path(path);
 	paths[TB_DP_AUX_PATH_OUT] = path;
 
 	path = tb_path_alloc(tb, out, TB_DP_AUX_RX_HOPID, in,
-			     TB_DP_AUX_RX_HOPID, 1, "AUX RX");
+			     TB_DP_AUX_RX_HOPID, link_nr, "AUX RX");
 	if (!path)
 		goto err_free;
 	tb_dp_init_aux_path(path);

  reply	other threads:[~2022-03-30 10:19 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <acbb3a86-ea15-47ec-90fa-72fbd94921b1@fnarfbargle.com>
2022-03-29 11:31 ` Apple Thunderbolt Display chaining Mika Westerberg
2022-03-29 12:35   ` Brad Campbell
2022-03-29 13:00     ` Mika Westerberg
2022-03-29 14:06       ` Brad Campbell
2022-03-30 10:18         ` Mika Westerberg [this message]
2022-03-30 13:19           ` Brad Campbell
2022-03-30 13:43             ` Mika Westerberg
2022-03-30 14:24               ` Brad Campbell
2022-03-30 14:47                 ` Mika Westerberg
2022-03-31  9:02                   ` Brad Campbell
2022-03-31 16:36                     ` Mika Westerberg
2022-04-01  5:48                       ` Brad Campbell
2022-04-01 14:30                         ` Mika Westerberg
2022-04-01 15:05                           ` Brad Campbell
2022-04-04 10:10                             ` Mika Westerberg
2022-04-04 11:38                               ` Brad Campbell
2022-04-04 12:53                                 ` Mika Westerberg
2022-04-06  2:51                                   ` Brad Campbell
2022-04-06 14:56                                     ` Mika Westerberg
2022-08-05  7:41                                       ` Brad Campbell
2022-08-05 11:30                                         ` Mika Westerberg
2022-08-05 12:43                                           ` Brad Campbell
2022-08-05 13:01                                             ` Mika Westerberg
2022-08-05 14:13                                               ` Brad Campbell
2022-08-05 14:21                                                 ` Mika Westerberg
2022-08-05 14:43                                                   ` Brad Campbell
2022-08-06  6:13                                                     ` Mika Westerberg
2022-08-06  9:41                                                       ` Brad Campbell
2022-08-08  9:51                                                         ` Mika Westerberg
2022-08-08 11:55                                                           ` Brad Campbell
2022-08-08 12:25                                                             ` Brad Campbell
2022-08-08 12:46                                                               ` Mika Westerberg
2022-08-08 13:27                                                                 ` Brad Campbell
2022-08-09 10:23                                                                   ` Mika Westerberg
2022-08-09 10:40                                                                     ` Brad Campbell
2022-08-09 10:55                                                                       ` Mika Westerberg
2022-08-09 11:03                                                                         ` Brad Campbell
2022-08-09 11:08                                                                         ` Brad Campbell
2022-08-09 14:42                                                                           ` Mika Westerberg
2022-08-09 15:16                                                                             ` Brad Campbell
2022-08-09 15:50                                                                               ` Mika Westerberg
2022-08-10  7:40                                                                                 ` Brad Campbell
2022-08-11  9:50                                                                                   ` Mika Westerberg
2022-08-11 14:17                                                                                     ` Brad Campbell
2022-08-12  9:35                                                                                       ` Mika Westerberg
2022-08-12 10:16                                                                                         ` Brad Campbell
2022-08-08 12:42                                                             ` 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=YkQuk7E8AbSEiw59@lahna \
    --to=mika.westerberg@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lists2009@fnarfbargle.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