thunderbolt: Handle bandwidth allocation mode disable request
authorMika Westerberg <mika.westerberg@linux.intel.com>
Thu, 28 Dec 2023 14:47:39 +0000 (16:47 +0200)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Fri, 16 Feb 2024 10:29:22 +0000 (12:29 +0200)
Graphics can disable DisplayPort bandwidth allocation mode as well so if
this make sure to reset the tunnel state accordingly.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/tb.c

index 5b0434c140f93f61ebb7bb5c128bf63f2aeafc2a..abd86fd8d71fe7d59a72375d35142358395dd8f7 100644 (file)
@@ -2406,8 +2406,23 @@ static void tb_handle_dp_bandwidth_request(struct work_struct *work)
 
        tb_port_dbg(in, "handling bandwidth allocation request\n");
 
+       tunnel = tb_find_tunnel(tb, TB_TUNNEL_DP, in, NULL);
+       if (!tunnel) {
+               tb_port_warn(in, "failed to find tunnel\n");
+               goto put_sw;
+       }
+
        if (!usb4_dp_port_bandwidth_mode_enabled(in)) {
-               tb_port_warn(in, "bandwidth allocation mode not enabled\n");
+               if (tunnel->bw_mode) {
+                       /*
+                        * Reset the tunnel back to use the legacy
+                        * allocation.
+                        */
+                       tunnel->bw_mode = false;
+                       tb_port_dbg(in, "DPTX disabled bandwidth allocation mode\n");
+               } else {
+                       tb_port_warn(in, "bandwidth allocation mode not enabled\n");
+               }
                goto put_sw;
        }
 
@@ -2432,11 +2447,6 @@ static void tb_handle_dp_bandwidth_request(struct work_struct *work)
 
        tb_port_dbg(in, "requested bandwidth %d Mb/s\n", requested_bw);
 
-       tunnel = tb_find_tunnel(tb, TB_TUNNEL_DP, in, NULL);
-       if (!tunnel) {
-               tb_port_warn(in, "failed to find tunnel\n");
-               goto put_sw;
-       }
 
        out = tunnel->dst_port;