From: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Bhanuprakash Modem <bhanuprakash.modem@intel.com>,
Kunal Joshi <kunal1.joshi@intel.com>
Subject: [PATCH i-g-t 1/2] lib/igt_kms: New helper to check force joiner status
Date: Wed, 17 Apr 2024 18:03:18 +0530 [thread overview]
Message-ID: <20240417123319.610839-2-bhanuprakash.modem@intel.com> (raw)
In-Reply-To: <20240417123319.610839-1-bhanuprakash.modem@intel.com>
Add a new static function to check the force joiner status
on selected connecter, so that it would be helpful to check
the force joiner status from other places too.
Cc: Kunal Joshi <kunal1.joshi@intel.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
---
lib/igt_kms.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index 3216fe7e4..9ff80378d 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -6255,6 +6255,22 @@ bool igt_has_force_joiner_debugfs(int drmfd, igt_output_t *output)
return ret >= 0;
}
+static bool check_force_bigjoiner_status(int drmfd, char *connector_name, bool enable)
+{
+ int debugfs_fd, ret;
+ char buf[512];
+
+ debugfs_fd = igt_debugfs_connector_dir(drmfd, connector_name, O_DIRECTORY);
+ igt_assert_f(debugfs_fd >= 0, "Could not open debugfs for connector %s\n", connector_name);
+
+ ret = igt_debugfs_simple_read(debugfs_fd, "i915_bigjoiner_force_enable", buf, sizeof(buf));
+ close(debugfs_fd);
+ igt_assert_f(ret > 0, "Could not read i915_bigjoiner_force_enable for connector %s\n", connector_name);
+
+ return enable ? strstr(buf, "Y") :
+ strstr(buf, "N");
+}
+
/**
* Forces the enable/disable state of big joiner for a specific connector.
*
@@ -6268,19 +6284,15 @@ bool igt_has_force_joiner_debugfs(int drmfd, igt_output_t *output)
bool igt_force_and_check_bigjoiner_status(int drmfd, char *connector_name, bool enable)
{
int debugfs_fd, ret;
- char buf[512];
igt_assert_f(connector_name, "Connector name cannot be NULL\n");
debugfs_fd = igt_debugfs_connector_dir(drmfd, connector_name, O_DIRECTORY);
igt_assert_f(debugfs_fd >= 0, "Could not open debugfs for connector %s\n", connector_name);
ret = igt_sysfs_write(debugfs_fd, "i915_bigjoiner_force_enable", enable ? "1" : "0", 1);
igt_assert_f(ret > 0, "Could not write i915_bigjoiner_force_enable for connector %s\n", connector_name);
- ret = igt_debugfs_simple_read(debugfs_fd, "i915_bigjoiner_force_enable", buf, sizeof(buf));
close(debugfs_fd);
- igt_assert_f(ret > 0, "Could not read i915_bigjoiner_force_enable for connector %s\n", connector_name);
- return enable ? strstr(buf, "Y") :
- strstr(buf, "N");
+ return check_force_bigjoiner_status(drmfd, connector_name, enable);
}
/**
--
2.43.2
next prev parent reply other threads:[~2024-04-17 12:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 12:33 [PATCH i-g-t 0/2] Force joiner support in bigjoiner checks Bhanuprakash Modem
2024-04-17 12:33 ` Bhanuprakash Modem [this message]
2024-04-17 12:33 ` [PATCH i-g-t 2/2] lib/igt_kms: " Bhanuprakash Modem
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=20240417123319.610839-2-bhanuprakash.modem@intel.com \
--to=bhanuprakash.modem@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=kunal1.joshi@intel.com \
/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