Commit 3ddbd345 authored by Jani Nikula's avatar Jani Nikula

drm/edid: add drm_edid_get_product_id()

Add a struct drm_edid based function to get the vendor and product ID
from an EDID. Add a separate struct for defining this part of the EDID,
with defined byte order for manufacturer name, product code and serial
number.

v2: Define manufacturer_name as __be16 instead of u8[2] (Ville)

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: default avatarMelissa Wen <mwen@igalia.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/df0e7dedbf7f2c190039d6e6eae3e126eba113c9.1712655867.git.jani.nikula@intel.comSigned-off-by: default avatarJani Nikula <jani.nikula@intel.com>
parent a57e191e
......@@ -2756,6 +2756,21 @@ const struct drm_edid *drm_edid_read(struct drm_connector *connector)
}
EXPORT_SYMBOL(drm_edid_read);
/**
* drm_edid_get_product_id - Get the vendor and product identification
* @drm_edid: EDID
* @id: Where to place the product id
*/
void drm_edid_get_product_id(const struct drm_edid *drm_edid,
struct drm_edid_product_id *id)
{
if (drm_edid && drm_edid->edid && drm_edid->size >= EDID_LENGTH)
memcpy(id, &drm_edid->edid->product_id, sizeof(*id));
else
memset(id, 0, sizeof(*id));
}
EXPORT_SYMBOL(drm_edid_get_product_id);
/**
* drm_edid_get_panel_id - Get a panel's ID from EDID
* @drm_edid: EDID that contains panel ID.
......
......@@ -272,14 +272,27 @@ struct detailed_timing {
#define DRM_EDID_DSC_MAX_SLICES 0xf
#define DRM_EDID_DSC_TOTAL_CHUNK_KBYTES 0x3f
struct drm_edid_product_id {
__be16 manufacturer_name;
__le16 product_code;
__le32 serial_number;
u8 week_of_manufacture;
u8 year_of_manufacture;
} __packed;
struct edid {
u8 header[8];
/* Vendor & product info */
u8 mfg_id[2];
u8 prod_code[2];
u32 serial; /* FIXME: byte order */
u8 mfg_week;
u8 mfg_year;
union {
struct drm_edid_product_id product_id;
struct {
u8 mfg_id[2];
u8 prod_code[2];
u32 serial; /* FIXME: byte order */
u8 mfg_week;
u8 mfg_year;
} __packed;
} __packed;
/* EDID version */
u8 version;
u8 revision;
......@@ -466,6 +479,8 @@ int drm_edid_connector_update(struct drm_connector *connector,
const struct drm_edid *edid);
int drm_edid_connector_add_modes(struct drm_connector *connector);
bool drm_edid_is_digital(const struct drm_edid *drm_edid);
void drm_edid_get_product_id(const struct drm_edid *drm_edid,
struct drm_edid_product_id *id);
const u8 *drm_find_edid_extension(const struct drm_edid *drm_edid,
int ext_id, int *ext_index);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment