summaryrefslogtreecommitdiff
path: root/include/drm
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2022-05-10 13:42:41 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2022-05-27 21:21:12 +0300
commitade1fc91eb99614c7155fec762ad5761bb470e06 (patch)
tree8316d2c8acb23c94a152c25119942eb35a7aac06 /include/drm
parent952cd974509251d6b5074bc3677b8297826a6ef1 (diff)
downloadlinux-ade1fc91eb99614c7155fec762ad5761bb470e06.tar.xz
drm/edid: Extract drm_edid_decode_mfg_id()
Make the PNPID decoding available for other users. Cc: dri-devel@lists.freedesktop.org Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220510104242.6099-15-ville.syrjala@linux.intel.com
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drm_edid.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index c61e75ab8f63..1d5950b5b407 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -498,6 +498,22 @@ static inline u8 drm_eld_get_conn_type(const uint8_t *eld)
}
/**
+ * drm_edid_decode_mfg_id - Decode the manufacturer ID
+ * @mfg_id: The manufacturer ID
+ * @vend: A 4-byte buffer to store the 3-letter vendor string plus a '\0'
+ * termination
+ */
+static inline const char *drm_edid_decode_mfg_id(u16 mfg_id, char vend[4])
+{
+ vend[0] = '@' + ((mfg_id >> 10) & 0x1f);
+ vend[1] = '@' + ((mfg_id >> 5) & 0x1f);
+ vend[2] = '@' + ((mfg_id >> 0) & 0x1f);
+ vend[3] = '\0';
+
+ return vend;
+}
+
+/**
* drm_edid_encode_panel_id - Encode an ID for matching against drm_edid_get_panel_id()
* @vend_chr_0: First character of the vendor string.
* @vend_chr_1: Second character of the vendor string.
@@ -537,10 +553,7 @@ static inline u8 drm_eld_get_conn_type(const uint8_t *eld)
static inline void drm_edid_decode_panel_id(u32 panel_id, char vend[4], u16 *product_id)
{
*product_id = (u16)(panel_id & 0xffff);
- vend[0] = '@' + ((panel_id >> 26) & 0x1f);
- vend[1] = '@' + ((panel_id >> 21) & 0x1f);
- vend[2] = '@' + ((panel_id >> 16) & 0x1f);
- vend[3] = '\0';
+ drm_edid_decode_mfg_id(panel_id >> 16, vend);
}
bool drm_probe_ddc(struct i2c_adapter *adapter);