[Intel-gfx] [PATCH] drm: Add support for EDID injection.

Marius Vlad marius.c.vlad at intel.com
Wed Mar 23 17:06:37 UTC 2016


Allow the possibility to return an copy of the injected EDID when the connector
has been forced and an EDID has been specified over the debugfs interface.

Signed-off-by: Marius Vlad <marius.c.vlad at intel.com>
---
 drivers/gpu/drm/drm_edid.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 414d7f6..239f9b1 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1075,6 +1075,19 @@ static bool drm_edid_is_zero(const u8 *in_edid, int length)
 	return true;
 }
 
+static struct edid *
+drm_do_get_override_edid(struct drm_connector *connector)
+{
+	struct edid *edid = NULL;
+
+	if (connector->override_edid && connector->edid_blob_ptr->data) {
+		edid = kmemdup(connector->edid_blob_ptr->data,
+			       connector->edid_blob_ptr->length, GFP_KERNEL);
+	}
+
+	return edid;
+}
+
 /**
  * drm_edid_block_valid - Sanity check the EDID block (base or extension)
  * @raw_edid: pointer to raw EDID block
@@ -1385,10 +1398,14 @@ struct edid *drm_get_edid(struct drm_connector *connector,
 {
 	struct edid *edid;
 
-	if (!drm_probe_ddc(adapter))
-		return NULL;
+	if (!connector->override_edid) {
+		if (!drm_probe_ddc(adapter))
+			return NULL;
+		edid = drm_do_get_edid(connector, drm_do_probe_ddc_edid, adapter);
+	} else {
+		edid = drm_do_get_override_edid(connector);
+	}
 
-	edid = drm_do_get_edid(connector, drm_do_probe_ddc_edid, adapter);
 	if (edid)
 		drm_get_displayid(connector, edid);
 	return edid;
-- 
2.5.0



More information about the Intel-gfx mailing list