summaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt/retimer.c
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2023-05-26 14:55:20 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2023-06-12 08:38:01 +0300
commit87200371817ec6e48e42ef2f03756268661a8815 (patch)
tree23d64c1a7e8bf47f789e958536587331e75517af /drivers/thunderbolt/retimer.c
parentb7b83911f7906a72f50806279ef22c86be728b69 (diff)
downloadlinux-stable-87200371817ec6e48e42ef2f03756268661a8815.tar.gz
linux-stable-87200371817ec6e48e42ef2f03756268661a8815.tar.bz2
linux-stable-87200371817ec6e48e42ef2f03756268661a8815.zip
thunderbolt: Enable/disable sideband depending on USB4 port offline mode
When USB4 port is in offline mode (this mean there is no device attached) we want to keep the sideband up to make it possible to communicate with the retimers. In the same way there is no need to enable sideband transactions when the USB4 port is not offline as they are already up. For this reason make the enabling/disabling depend on the USB4 port offline status. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/retimer.c')
-rw-r--r--drivers/thunderbolt/retimer.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/thunderbolt/retimer.c b/drivers/thunderbolt/retimer.c
index a273fb02a02c..47becb363ada 100644
--- a/drivers/thunderbolt/retimer.c
+++ b/drivers/thunderbolt/retimer.c
@@ -206,6 +206,15 @@ static void tb_retimer_set_inbound_sbtx(struct tb_port *port)
{
int i;
+ /*
+ * When USB4 port is online sideband communications are
+ * already up.
+ */
+ if (!usb4_port_device_is_offline(port->usb4))
+ return;
+
+ tb_port_dbg(port, "enabling sideband transactions\n");
+
for (i = 1; i <= TB_MAX_RETIMER_INDEX; i++)
usb4_port_retimer_set_inbound_sbtx(port, i);
}
@@ -214,6 +223,16 @@ static void tb_retimer_unset_inbound_sbtx(struct tb_port *port)
{
int i;
+ /*
+ * When USB4 port is offline we need to keep the sideband
+ * communications up to make it possible to communicate with
+ * the connected retimers.
+ */
+ if (usb4_port_device_is_offline(port->usb4))
+ return;
+
+ tb_port_dbg(port, "disabling sideband transactions\n");
+
for (i = TB_MAX_RETIMER_INDEX; i >= 1; i--)
usb4_port_retimer_unset_inbound_sbtx(port, i);
}