diff options
author | Adam Jackson <ajax@redhat.com> | 2009-11-23 20:23:06 +0100 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-11-24 02:24:23 +0100 |
commit | 862b89c069cafded4e31029be511f2e0b58d9c5f (patch) | |
tree | 0e69e3bb26749b8d4cd1a81ffc01c15d52269436 /drivers/gpu/drm/drm_edid.c | |
parent | drm/edid: Retry EDID fetch up to four times (diff) | |
download | linux-862b89c069cafded4e31029be511f2e0b58d9c5f.tar.xz linux-862b89c069cafded4e31029be511f2e0b58d9c5f.zip |
drm/edid: Fix up partially corrupted headers
We'll still fail the block if it fails the EDID checksum though.
See also: http://bugzilla.redhat.com/534120
Signed-off-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_edid.c')
-rw-r--r-- | drivers/gpu/drm/drm_edid.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 282008229f06..bdea31308236 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -123,16 +123,21 @@ static const u8 edid_header[] = { */ static bool edid_is_valid(struct edid *edid) { - int i; + int i, score = 0; u8 csum = 0; u8 *raw_edid = (u8 *)edid; - if (memcmp(edid->header, edid_header, sizeof(edid_header))) - goto bad; - if (edid->version != 1) { - DRM_ERROR("EDID has major version %d, instead of 1\n", edid->version); + for (i = 0; i < sizeof(edid_header); i++) + if (raw_edid[i] == edid_header[i]) + score++; + + if (score == 8) ; + else if (score >= 6) { + DRM_DEBUG("Fixing EDID header, your hardware may be failing\n"); + memcpy(raw_edid, edid_header, sizeof(edid_header)); + } else goto bad; - } + for (i = 0; i < EDID_LENGTH; i++) csum += raw_edid[i]; if (csum) { @@ -140,6 +145,11 @@ static bool edid_is_valid(struct edid *edid) goto bad; } + if (edid->version != 1) { + DRM_ERROR("EDID has major version %d, instead of 1\n", edid->version); + goto bad; + } + if (edid->revision > 4) DRM_DEBUG("EDID minor > 4, assuming backward compatibility\n"); |