diff mbox

[v3] DRM/KMS/EDID: Test EDDC if EDID announces more than one Extension Block (v3)

Message ID 1353595146-22737-1-git-send-email-eich@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Egbert Eich Nov. 22, 2012, 2:39 p.m. UTC
There are displays which announce EDID extension blocks in the
Extension Flag of the EDID base block although they are not EDDC
capable (ie. take a segment address at I2C slave address 0x30).
We test this by looking for an EDID header which is only possible
in the base block.
If the segment address is not taken into account, this block will
be identical to the base block in which case we stop reading further
EEDID blocks, correct the extension flag and just return the base
block.

v2: Split up EDID fixup code into separate commit.
v3: Worked in changes suggested by Ville Syrjälä <ville.syrjala@linux.intel.com>:
    Reworded comment,
    Used memcmp(),
    Compared entire base block instead of signature only.

Signed-off-by: Egbert Eich <eich@suse.com>
---
 drivers/gpu/drm/drm_edid.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index a952cfe..b42fbc0 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -364,6 +364,16 @@  drm_do_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter)
 			}
 			if (drm_edid_block_valid(block + (valid_extensions + 1) * EDID_LENGTH, j, print_bad_edid)) {
 				valid_extensions++;
+				/* If extension block 2 is identical to the base block the display is probably
+				 * not EDDC cabable - despite of what the extension flag says - as it doesn't
+				 * select the correct segment address: detect this condition and bail early.
+				 */
+				if (j == 2) {
+					if (memcmp(block + EDID_LENGTH * 2, block, EDID_LENGTH) == 0) {
+						valid_extensions = 0;
+						goto done_fix_extension_count;
+					}
+				}
 				break;
 			}
 		}