summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_displayid.c
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2023-02-16 22:45:00 +0200
committerDmitry Osipenko <dmitry.osipenko@collabora.com>2023-02-27 02:58:38 +0300
commitb568e6bb49d49ef05fa3aa4bb294ae960e1d778a (patch)
treeb1187fe00269f4ab0dee377412a01da1976f3874 /drivers/gpu/drm/drm_displayid.c
parent5631f6a0436ac30eecfb2e6fdcd0a517f90add8a (diff)
downloadlinux-stable-b568e6bb49d49ef05fa3aa4bb294ae960e1d778a.tar.gz
linux-stable-b568e6bb49d49ef05fa3aa4bb294ae960e1d778a.tar.bz2
linux-stable-b568e6bb49d49ef05fa3aa4bb294ae960e1d778a.zip
drm/displayid: provide access to DisplayID version and primary use case
The DisplayID structure version and primary use case are stored in the DisplayID Base Section. We should be checking them in a number of places when parsing the DisplayID blocks. Currently, we completely ignore the primary use case, and just look at the block tags without cross-checking against structure version. Store the version and primary use case in the DisplayID iterator, and provide accessors to them. In general, the information is needed when iterating the blocks, and this is a convenient place to both store and retrieve the information during parsing. Promote using accessors rather than users poking at the iterator directly. Cc: Iaroslav Boliukin <iam@lach.pw> Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Link: https://patchwork.freedesktop.org/patch/msgid/ad8a35c109f97ffe115e6b18e4a132b592f11089.1676580180.git.jani.nikula@intel.com
Diffstat (limited to 'drivers/gpu/drm/drm_displayid.c')
-rw-r--r--drivers/gpu/drm/drm_displayid.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_displayid.c b/drivers/gpu/drm/drm_displayid.c
index 0de9b5530393..9edc111be7ee 100644
--- a/drivers/gpu/drm/drm_displayid.c
+++ b/drivers/gpu/drm/drm_displayid.c
@@ -123,6 +123,9 @@ __displayid_iter_next(struct displayid_iter *iter)
}
for (;;) {
+ /* The first section we encounter is the base section */
+ bool base_section = !iter->section;
+
iter->section = drm_find_displayid_extension(iter->drm_edid,
&iter->length,
&iter->idx,
@@ -132,6 +135,18 @@ __displayid_iter_next(struct displayid_iter *iter)
return NULL;
}
+ /* Save the structure version and primary use case. */
+ if (base_section) {
+ const struct displayid_header *base;
+
+ base = displayid_get_header(iter->section, iter->length,
+ iter->idx);
+ if (!IS_ERR(base)) {
+ iter->version = base->rev;
+ iter->primary_use = base->prod_id;
+ }
+ }
+
iter->idx += sizeof(struct displayid_header);
block = displayid_iter_block(iter);
@@ -144,3 +159,18 @@ void displayid_iter_end(struct displayid_iter *iter)
{
memset(iter, 0, sizeof(*iter));
}
+
+/* DisplayID Structure Version/Revision from the Base Section. */
+u8 displayid_version(const struct displayid_iter *iter)
+{
+ return iter->version;
+}
+
+/*
+ * DisplayID Primary Use Case (2.0+) or Product Type Identifier (1.0-1.3) from
+ * the Base Section.
+ */
+u8 displayid_primary_use(const struct displayid_iter *iter)
+{
+ return iter->primary_use;
+}