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, michael.jamet@intel.com,
	YehezkelShB@gmail.com
Subject: Re: Thunderbolt DP oddity on v5.2.9 on iMac 12,2
Date: Tue, 3 Sep 2019 13:13:25 +0300	[thread overview]
Message-ID: <20190903101325.GC2691@lahna.fi.intel.com> (raw)
In-Reply-To: <be32b369-b013-cca8-5475-9b56acaa3e18@fnarfbargle.com>

Hi Brad,

On Thu, Aug 29, 2019 at 12:27:08AM +0800, Brad Campbell wrote:
> It wouldn't surprise me if the firmware was doing something funky. It was
> one of the first Thunderbolt equipped models and the support docs explicitly
> say only one Thunderbolt display in Windows and two in later versions of
> OSX. It almost needs a quirk to say "firmware does something we don't like,
> reset the controller and re-discover from scratch".
> 
> Anyway, I'm not in any hurry. It doesn't get rebooted often and it's not in
> any way preventing me using the machine. In fact, upgrading the third head
> from an old 24" 1920x1200 to the second Thunderbolt display has been
> invaluable.

Can you apply the below patch and then boot with two monitors connected?
Then send me the dmesg. It does not fix anything but should log a bit
more.

diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index 1f7a9e1cc09c..28a72336558a 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -313,8 +313,10 @@ static struct tb_port *tb_find_unused_port(struct tb_switch *sw,
 			continue;
 		if (!sw->ports[i].cap_adap)
 			continue;
-		if (tb_port_is_enabled(&sw->ports[i]))
+		if (tb_port_is_enabled(&sw->ports[i])) {
+			tb_port_dbg(&sw->ports[i], "this already enabled\n");
 			continue;
+		}
 		return &sw->ports[i];
 	}
 	return NULL;
@@ -365,16 +367,25 @@ static int tb_tunnel_dp(struct tb *tb, struct tb_port *out)
 	struct tb_tunnel *tunnel;
 	struct tb_port *in;
 
-	if (tb_port_is_enabled(out))
+	tb_port_dbg(out, "trying to tunnel DP\n");
+
+	if (tb_port_is_enabled(out)) {
+		tb_port_dbg(out, "DP OUT port already enabled\n");
 		return 0;
+	}
+
+	tb_port_dbg(out, "finding free DP IN port\n");
 
 	do {
 		sw = tb_to_switch(sw->dev.parent);
 		if (!sw)
 			return 0;
+		tb_sw_dbg(sw, "finding available DP IN\n");
 		in = tb_find_unused_port(sw, TB_TYPE_DP_HDMI_IN);
 	} while (!in);
 
+	tb_port_dbg(in, "found DP IN\n");
+
 	tunnel = tb_tunnel_alloc_dp(tb, in, out);
 	if (!tunnel) {
 		tb_port_dbg(out, "DP tunnel allocation failed\n");
diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c
index 5a99234826e7..93c2c965bdde 100644
--- a/drivers/thunderbolt/tunnel.c
+++ b/drivers/thunderbolt/tunnel.c
@@ -351,9 +351,23 @@ struct tb_tunnel *tb_tunnel_discover_dp(struct tb *tb, struct tb_port *in)
 	struct tb_tunnel *tunnel;
 	struct tb_port *port;
 	struct tb_path *path;
+	u32 data[2];
+	int ret;
+
+	tb_port_dbg(in, "start DP discover\n");
 
-	if (!tb_dp_port_is_enabled(in))
+	if (!tb_dp_port_is_enabled(in)) {
+		tb_port_dbg(in, "DP port enabled\n");
 		return NULL;
+	}
+
+	ret = tb_port_read(in, data, TB_CFG_PORT, in->cap_adap,
+			   ARRAY_SIZE(data));
+	if (ret)
+		return NULL;
+
+	tb_port_dbg(in, "data[0]=0x%08x\n", data[0]);
+	tb_port_dbg(in, "data[1]=0x%08x\n", data[1]);
 
 	tunnel = tb_tunnel_alloc(tb, 3, TB_TUNNEL_DP);
 	if (!tunnel)

  reply	other threads:[~2019-09-03 10:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-28  7:09 Thunderbolt DP oddity on v5.2.9 on iMac 12,2 Brad Campbell
2019-08-28  7:33 ` Mika Westerberg
2019-08-28  9:12   ` Brad Campbell
2019-08-28  9:34     ` Brad Campbell
2019-08-28 10:23     ` Mika Westerberg
2019-08-28 10:43       ` Brad Campbell
2019-08-28 13:19         ` Mika Westerberg
2019-08-28 16:27           ` Brad Campbell
2019-09-03 10:13             ` Mika Westerberg [this message]
2019-09-03 10:36               ` Mika Westerberg
2019-09-03 11:11               ` Brad Campbell
2019-09-03 11:55                 ` Mika Westerberg
2019-09-03 12:54                   ` Brad Campbell
2019-09-03 13:33                     ` Mika Westerberg
2019-09-13  8:24                       ` 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=20190903101325.GC2691@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lists2009@fnarfbargle.com \
    --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