The DRM-core tunnel debugfs helpers need a driver-side call site.
Wire them into detect_new_tunnel() so the dp_tunnel/ subdir is
created once the tunnel's BWA state has settled, giving IGT and
developers access to the tunnel info/knobs through debugfs.

The helper is invoked on all three retained-tunnel branches in
detect_new_tunnel() (BWA unsupported, BWA enable failure, and
successful state update). Error paths that destroy the tunnel
do not register debugfs.

Cc: Imre Deak <[email protected]>
Assisted-by: Copilot:claude-sonnet-4-6
Signed-off-by: Kunal Joshi <[email protected]>
---
 .../gpu/drm/i915/display/intel_dp_tunnel.c    | 23 ++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/display/intel_dp_tunnel.c 
b/drivers/gpu/drm/i915/display/intel_dp_tunnel.c
index 11712a151f729..cc36d5651f6a9 100644
--- a/drivers/gpu/drm/i915/display/intel_dp_tunnel.c
+++ b/drivers/gpu/drm/i915/display/intel_dp_tunnel.c
@@ -16,6 +16,17 @@
 #include "intel_dp_tunnel.h"
 #include "intel_link_bw.h"
 
+static void intel_dp_tunnel_debugfs_add(struct intel_dp *intel_dp)
+{
+       struct intel_connector *connector = intel_dp->attached_connector;
+
+       if (!connector || !intel_dp->tunnel)
+               return;
+
+       drm_dp_tunnel_debugfs_add(intel_dp->tunnel,
+                                 connector->base.debugfs_entry);
+}
+
 struct intel_dp_tunnel_inherited_state {
        struct drm_dp_tunnel_ref ref[I915_MAX_PIPES];
 };
@@ -214,8 +225,10 @@ static int detect_new_tunnel(struct intel_dp *intel_dp, 
struct drm_modeset_acqui
 
        ret = drm_dp_tunnel_enable_bw_alloc(intel_dp->tunnel);
        if (ret) {
-               if (ret == -EOPNOTSUPP)
+               if (ret == -EOPNOTSUPP) {
+                       intel_dp_tunnel_debugfs_add(intel_dp);
                        return 0;
+               }
 
                drm_dbg_kms(display->drm,
                            "[DPTUN %s][ENCODER:%d:%s] Failed to enable BW 
allocation mode (ret %pe)\n",
@@ -224,6 +237,7 @@ static int detect_new_tunnel(struct intel_dp *intel_dp, 
struct drm_modeset_acqui
                            ERR_PTR(ret));
 
                /* Keep the tunnel with BWA disabled */
+               intel_dp_tunnel_debugfs_add(intel_dp);
                return 0;
        }
 
@@ -238,6 +252,13 @@ static int detect_new_tunnel(struct intel_dp *intel_dp, 
struct drm_modeset_acqui
        if (ret)
                return ret;
 
+       /*
+        * Register debugfs only after BWA negotiation has fully
+        * settled so the first read of 'info' shows steady-state
+        * values rather than transient ones.
+        */
+       intel_dp_tunnel_debugfs_add(intel_dp);
+
        return has_tunnel_bw_changed(intel_dp, old_bw) ? 1 : 0;
 }
 
-- 
2.25.1

Reply via email to