[i-g-t,3/5] lib/igt_kms: add function to set link params
Murthy, Arun R
arun.r.murthy at intel.com
Tue Feb 11 09:53:48 UTC 2025
On 03-02-2025 13:42, Kunal Joshi wrote:
> add function to force link rate and lane count
> for given output, install exit handle to set auto
> at exit
>
> Signed-off-by: Kunal Joshi <kunal1.joshi at intel.com>
> ---
Reviewed-by: Arun R Murthy <arun.r.murthy at intel.com>
Thanks and Regards,
Arun R Murthy
-------------------
> lib/igt_kms.c | 33 +++++++++++++++++++++++++++++++++
> lib/igt_kms.h | 2 ++
> 2 files changed, 35 insertions(+)
>
> diff --git a/lib/igt_kms.c b/lib/igt_kms.c
> index 90f44b4d3..424056252 100644
> --- a/lib/igt_kms.c
> +++ b/lib/igt_kms.c
> @@ -7190,6 +7190,39 @@ void igt_reset_link_params(int drm_fd, igt_output_t *output)
> drmModeFreeConnector(temp);
> }
>
> +/**
> + * igt_set_link_params:
> + * @drm_fd: A drm file descriptor
> + * @output: Target output
> + *
> + * set link rate and lane count to given value, also installs exit handler
> + * to set link rate and lane count to auto on exit
> + */
> +void igt_set_link_params(int drm_fd, igt_output_t *output,
> + char *link_rate, char *lane_count)
> +{
> + bool valid;
> + drmModeConnector *temp;
> +
> + valid = true;
> + valid = valid && connector_attr_set_debugfs(drm_fd, output->config.connector,
> + "i915_dp_force_link_rate",
> + link_rate, "auto", true);
> + valid = valid && connector_attr_set_debugfs(drm_fd, output->config.connector,
> + "i915_dp_force_lane_count",
> + lane_count, "auto", true);
> + igt_assert_f(valid, "Unable to set attr or install exit handler\n");
> + dump_connector_attrs();
> + igt_install_exit_handler(reset_connectors_at_exit);
> +
> + /*
> + * To allow callers to always use GetConnectorCurrent we need to force a
> + * redetection here.
> + */
> + temp = drmModeGetConnector(drm_fd, output->config.connector->connector_id);
> + drmModeFreeConnector(temp);
> +}
> +
> /**
> * igt_backlight_read:
> * @result: Pointer to store the result
> diff --git a/lib/igt_kms.h b/lib/igt_kms.h
> index 8810123fb..f696847a4 100644
> --- a/lib/igt_kms.h
> +++ b/lib/igt_kms.h
> @@ -1268,6 +1268,8 @@ bool igt_has_force_link_training_failure_debugfs(int drmfd, igt_output_t *output
> int igt_get_dp_pending_lt_failures(int drm_fd, igt_output_t *output);
> int igt_get_dp_pending_retrain(int drm_fd, igt_output_t *output);
> void igt_reset_link_params(int drm_fd, igt_output_t *output);
> +void igt_set_link_params(int drm_fd, igt_output_t *output,
> + char *link_rate, char *lane_count);
> int igt_backlight_read(int *result, const char *fname, igt_backlight_context_t *context);
> int igt_backlight_write(int value, const char *fname, igt_backlight_context_t *context);
>
More information about the igt-dev
mailing list