Skip to content

Commit c1737e6

Browse files
westeriGoogle Cont Uprev
authored andcommitted
CHROMIUM: thunderbolt: Tear down DP tunnels when suspending
DP tunnels do not need the same kind of treatment as others because they are created based on hot-plug events on DP adapter ports, and the display stack does not need the tunnels to be enabled when resuming from suspend. Also Tiger Lake Thunderbolt/USB4 controller sends unplug event on D3 exit so this avoid that as well. Signed-off-by: Mika Westerberg <[email protected]> BUG=b:160191015 TEST=Observed no regressions with S0iX without an attached device. TOREVERT=Once the upstream version of this patch lands in maintainer tree, this patch should be reverted. Signed-off-by: Casey Bowman <[email protected]> Change-Id: I764fe5780e77e18750a89350928fc817ddcc49e6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2275609 Tested-by: Dana Alkattan <[email protected]> Reviewed-by: Prashant Malani <[email protected]> Commit-Queue: Prashant Malani <[email protected]>
1 parent 0ef3d74 commit c1737e6

File tree

1 file changed

+24
-0
lines changed
  • drivers/thunderbolt

1 file changed

+24
-0
lines changed

drivers/thunderbolt/tb.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,29 @@ static void tb_dp_resource_available(struct tb *tb, struct tb_port *port)
910910
tb_tunnel_dp(tb);
911911
}
912912

913+
static void tb_disconnect_and_release_dp(struct tb *tb)
914+
{
915+
struct tb_cm *tcm = tb_priv(tb);
916+
struct tb_tunnel *tunnel, *n;
917+
918+
/*
919+
* Tear down all DP tunnels and release their resources. They
920+
* will be re-established after resume based on plug events.
921+
*/
922+
list_for_each_entry_safe_reverse(tunnel, n, &tcm->tunnel_list, list) {
923+
if (tb_tunnel_is_dp(tunnel))
924+
tb_deactivate_and_free_tunnel(tunnel);
925+
}
926+
927+
while (!list_empty(&tcm->dp_resources)) {
928+
struct tb_port *port;
929+
930+
port = list_first_entry(&tcm->dp_resources,
931+
struct tb_port, list);
932+
list_del_init(&port->list);
933+
}
934+
}
935+
913936
static int tb_tunnel_pci(struct tb *tb, struct tb_switch *sw)
914937
{
915938
struct tb_port *up, *down, *port;
@@ -1226,6 +1249,7 @@ static int tb_suspend_noirq(struct tb *tb)
12261249
struct tb_cm *tcm = tb_priv(tb);
12271250

12281251
tb_dbg(tb, "suspending...\n");
1252+
tb_disconnect_and_release_dp(tb);
12291253
tb_switch_suspend(tb->root_switch);
12301254
tcm->hotplug_active = false; /* signal tb_handle_hotplug to quit */
12311255
tb_dbg(tb, "suspend finished\n");

0 commit comments

Comments
 (0)