From: Kunal Joshi <kunal1.joshi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Kunal Joshi <kunal1.joshi@intel.com>,
Arun R Murthy <arun.r.murthy@intel.com>
Subject: [PATCH i-g-t 3/4] lib/igt_kms: add function to set link params
Date: Mon, 17 Feb 2025 12:12:38 +0530 [thread overview]
Message-ID: <20250217064239.2019316-4-kunal1.joshi@intel.com> (raw)
In-Reply-To: <20250217064239.2019316-1-kunal1.joshi@intel.com>
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@intel.com>
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>
---
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 0ba1afb08..bc46487c5 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -7269,6 +7269,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 7227f0b0e..31b9820cb 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -1271,6 +1271,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);
--
2.25.1
next prev parent reply other threads:[~2025-02-17 6:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-17 6:42 [PATCH i-g-t 0/4] add test to validate uhbr/non-uhbr over sst/mst Kunal Joshi
2025-02-17 6:42 ` [PATCH i-g-t 1/4] tests/intel/kms_joiner: refactor set_all_master_pipes_for_platform Kunal Joshi
2025-02-18 7:51 ` B, Jeevan
2025-02-17 6:42 ` [PATCH i-g-t 2/4] tests/intel/kms_joiner_helper: add helper for joiner-related functions Kunal Joshi
2025-02-17 6:42 ` Kunal Joshi [this message]
2025-02-17 6:42 ` [PATCH i-g-t 4/4] tests/intel/kms_dp_link_training: add tests for UHBR/NON-UHBR over SST/MST Kunal Joshi
2025-02-17 10:08 ` ✓ i915.CI.BAT: success for add test to validate uhbr/non-uhbr over sst/mst (rev4) Patchwork
2025-02-17 10:42 ` ✓ Xe.CI.BAT: " Patchwork
2025-02-17 12:47 ` ✗ i915.CI.Full: failure " Patchwork
2025-02-17 16:02 ` ✗ Xe.CI.Full: " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2025-02-18 15:01 [PATCH i-g-t 0/4] add test to validate uhbr/non-uhbr over sst/mst Kunal Joshi
2025-02-18 15:01 ` [PATCH i-g-t 3/4] lib/igt_kms: add function to set link params Kunal Joshi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250217064239.2019316-4-kunal1.joshi@intel.com \
--to=kunal1.joshi@intel.com \
--cc=arun.r.murthy@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox