[igt-dev] [PATCH i-g-t 2/3] lib/igt_eld: add eld_get_igt
Simon Ser
simon.ser at intel.com
Thu Jun 6 11:48:51 UTC 2019
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 at 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
More information about the igt-dev
mailing list