drm: Add support for EDID injection.

Submitted by marius vlad on March 23, 2016, 5:06 p.m.

Details

Message ID 1458752797-18746-1-git-send-email-marius.c.vlad@intel.com
State New
Headers show
Series "drm: Add support for EDID injection." ( rev: 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

marius vlad March 23, 2016, 5:06 p.m.
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@intel.com>
---
 drivers/gpu/drm/drm_edid.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

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;