public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Simon Ser <simon.ser@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: martin.peres@intel.com
Subject: [igt-dev] [PATCH i-g-t 2/3] lib/igt_eld: add eld_get_igt
Date: Thu,  6 Jun 2019 14:48:51 +0300	[thread overview]
Message-ID: <20190606114852.24053-3-simon.ser@intel.com> (raw)
In-Reply-To: <20190606114852.24053-1-simon.ser@intel.com>

The existing eld_has_igt function doesn't allow the caller to retrieve the
parsed ELD and check audio parameters.

Signed-off-by: Simon Ser <simon.ser@intel.com>
---
 lib/igt_eld.c | 20 +++++++++++++-------
 lib/igt_eld.h |  1 +
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/lib/igt_eld.c b/lib/igt_eld.c
index 1bb294e3fb2a..7217962ee5ca 100644
--- a/lib/igt_eld.c
+++ b/lib/igt_eld.c
@@ -200,16 +200,14 @@ static bool eld_parse_entry(const char *path, struct eld_entry *eld)
 	return monitor_present;
 }
 
-/** eld_has_igt: check whether ALSA has detected the audio-capable IGT EDID by
- * parsing ELD entries */
-bool eld_has_igt(void)
+/** eld_get_igt: retrieve the ALSA ELD entry matching the IGT EDID */
+bool eld_get_igt(struct eld_entry *eld)
 {
 	DIR *dir;
 	struct dirent *dirent;
 	int i;
 	char card[64];
 	char path[PATH_MAX];
-	struct eld_entry eld;
 
 	for (i = 0; i < 8; i++) {
 		snprintf(card, sizeof(card), "/proc/asound/card%d", i);
@@ -224,16 +222,16 @@ bool eld_has_igt(void)
 
 			snprintf(path, sizeof(path), "%s/%s", card,
 				 dirent->d_name);
-			if (!eld_parse_entry(path, &eld)) {
+			if (!eld_parse_entry(path, eld)) {
 				continue;
 			}
 
-			if (!eld.valid) {
+			if (!eld->valid) {
 				igt_debug("Skipping invalid ELD: %s\n", path);
 				continue;
 			}
 
-			if (strcmp(eld.monitor_name, "IGT") == 0) {
+			if (strcmp(eld->monitor_name, "IGT") == 0) {
 				closedir(dir);
 				return true;
 			}
@@ -243,3 +241,11 @@ bool eld_has_igt(void)
 
 	return false;
 }
+
+/** eld_has_igt: check whether ALSA has detected the audio-capable IGT EDID by
+ * parsing ELD entries */
+bool eld_has_igt(void)
+{
+	struct eld_entry eld;
+	return eld_get_igt(&eld);
+}
diff --git a/lib/igt_eld.h b/lib/igt_eld.h
index e16187884d4b..7c4489f054f1 100644
--- a/lib/igt_eld.h
+++ b/lib/igt_eld.h
@@ -49,6 +49,7 @@ struct eld_entry {
 	struct eld_sad sads[ELD_SADS_CAP];
 };
 
+bool eld_get_igt(struct eld_entry *eld);
 bool eld_has_igt(void);
 
 #endif
-- 
2.21.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-06-06 11:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06 11:48 [igt-dev] [PATCH i-g-t v2 0/3] Add audio EDID tests to Chamelium Simon Ser
2019-06-06 11:48 ` [igt-dev] [PATCH i-g-t 1/3] lib/igt_kms: generate an EDID suitable for DP audio Simon Ser
2019-06-12 10:31   ` Martin Peres
2019-06-12 10:54     ` Ser, Simon
2019-06-06 11:48 ` Simon Ser [this message]
2019-06-12 10:37   ` [igt-dev] [PATCH i-g-t 2/3] lib/igt_eld: add eld_get_igt Martin Peres
2019-06-06 11:48 ` [igt-dev] [PATCH i-g-t 3/3] tests/kms_chamelium: add an audio EDID test Simon Ser
2019-06-12 10:47   ` Martin Peres
2019-06-12 11:35     ` Ser, Simon
2019-06-12 12:24       ` Martin Peres
2019-06-12 12:52         ` Ser, Simon
2019-06-12 13:09           ` Martin Peres
2019-06-06 13:47 ` [igt-dev] ✓ Fi.CI.BAT: success for Add audio EDID tests to Chamelium (rev3) Patchwork
2019-06-08 16:11 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

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=20190606114852.24053-3-simon.ser@intel.com \
    --to=simon.ser@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=martin.peres@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