Skip to content

Commit

Permalink
CHROMIUM: thunderbolt: Tear down DP tunnels when suspending
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
westeri authored and Google Cont Uprev committed Sep 29, 2020
1 parent 0ef3d74 commit c1737e6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions drivers/thunderbolt/tb.c
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,29 @@ static void tb_dp_resource_available(struct tb *tb, struct tb_port *port)
tb_tunnel_dp(tb);
}

static void tb_disconnect_and_release_dp(struct tb *tb)
{
struct tb_cm *tcm = tb_priv(tb);
struct tb_tunnel *tunnel, *n;

/*
* Tear down all DP tunnels and release their resources. They
* will be re-established after resume based on plug events.
*/
list_for_each_entry_safe_reverse(tunnel, n, &tcm->tunnel_list, list) {
if (tb_tunnel_is_dp(tunnel))
tb_deactivate_and_free_tunnel(tunnel);
}

while (!list_empty(&tcm->dp_resources)) {
struct tb_port *port;

port = list_first_entry(&tcm->dp_resources,
struct tb_port, list);
list_del_init(&port->list);
}
}

static int tb_tunnel_pci(struct tb *tb, struct tb_switch *sw)
{
struct tb_port *up, *down, *port;
Expand Down Expand Up @@ -1226,6 +1249,7 @@ static int tb_suspend_noirq(struct tb *tb)
struct tb_cm *tcm = tb_priv(tb);

tb_dbg(tb, "suspending...\n");
tb_disconnect_and_release_dp(tb);
tb_switch_suspend(tb->root_switch);
tcm->hotplug_active = false; /* signal tb_handle_hotplug to quit */
tb_dbg(tb, "suspend finished\n");
Expand Down

0 comments on commit c1737e6

Please sign in to comment.