On Wed, 2026-07-01 at 18:31 +0300, Imre Deak wrote:
> Add a debugfs entry showing the currently allowed link configurations
> in the connector's iteration order.
> 
> Signed-off-by: Imre Deak <[email protected]>
> ---
>  .../gpu/drm/i915/display/intel_dp_link_caps.c | 40 +++++++++++++++++++
>  1 file changed, 40 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_caps.c 
> b/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
> index 3ef678d47c71b..4482e1f9d6cd8 100644
> --- a/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
> +++ b/drivers/gpu/drm/i915/display/intel_dp_link_caps.c
> @@ -1123,6 +1123,43 @@ static int i915_dp_max_lane_count_show(void *data, u64 
> *val)
>  }
>  DEFINE_DEBUGFS_ATTRIBUTE(i915_dp_max_lane_count_fops, 
> i915_dp_max_lane_count_show, NULL, "%llu\n");
>  
> +static int intel_dp_allowed_link_configs_show(struct seq_file *m, void *data)
> +{
> +     struct intel_connector *connector = to_intel_connector(m->private);
> +     struct intel_display *display = to_intel_display(connector);
> +     struct intel_dp *intel_dp = intel_attached_dp(connector);
> +     struct intel_dp_link_caps *link_caps = intel_dp->link.caps;
> +     struct intel_dp_link_config link_config;
> +     struct intel_dp_link_caps_iter iter;
> +     int err;
> +     int i;
> +
> +     err = 
> drm_modeset_lock_single_interruptible(&display->drm->mode_config.connection_mutex);
> +     if (err)
> +             return err;
> +
> +     intel_dp_flush_connector_commits(connector);
> +
> +     i = 0;
> +     intel_dp_link_caps_iter_start(&iter,
> +                                   link_caps,
> +                                   
> intel_dp_link_caps_connector_compute_order(connector),
> +                                   INTEL_DP_LINK_CAPS_FILTER_ALL);
> +     for_each_dp_link_config(&iter, &link_config) {
> +             seq_printf(m, "%s%dx%d",
> +                        i ? " " : "",
> +                        link_config.lane_count, link_config.rate);
> +             i++;
> +     }
> +     intel_dp_link_caps_iter_end(&iter);
> +
> +     drm_modeset_unlock(&display->drm->mode_config.connection_mutex);
> +
> +     seq_putc(m, '\n');
> +
> +     return 0;
> +}
> +DEFINE_SHOW_ATTRIBUTE(intel_dp_allowed_link_configs);
>  
>  /**
>   * intel_dp_link_caps_debugfs_add - add link caps debugfs files for a 
> connector
> @@ -1149,6 +1186,9 @@ void intel_dp_link_caps_debugfs_add(struct 
> intel_connector *connector)
>  
>       debugfs_create_file("i915_dp_max_lane_count", 0444, root,
>                           connector, &i915_dp_max_lane_count_fops);
> +
> +     debugfs_create_file("intel_dp_allowed_link_configs", 0444, root,
> +                         connector, &intel_dp_allowed_link_configs_fops);
>  }
>  
>  struct intel_dp_link_caps *intel_dp_link_caps_init(struct intel_dp *intel_dp)

Reviewed-by: Luca Coelho <[email protected]>

--
Cheers,
Luca.

Reply via email to