diff options
Diffstat (limited to 'drivers/gpu')
-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[] = { | |||
123 | */ | 123 | */ |
124 | static bool edid_is_valid(struct edid *edid) | 124 | static bool edid_is_valid(struct edid *edid) |
125 | { | 125 | { |
126 | int i; | 126 | int i, score = 0; |
127 | u8 csum = 0; | 127 | u8 csum = 0; |
128 | u8 *raw_edid = (u8 *)edid; | 128 | u8 *raw_edid = (u8 *)edid; |
129 | 129 | ||
130 | if (memcmp(edid->header, edid_header, sizeof(edid_header))) | 130 | for (i = 0; i < sizeof(edid_header); i++) |
131 | goto bad; | 131 | if (raw_edid[i] == edid_header[i]) |
132 | if (edid->version != 1) { | 132 | score++; |
133 | DRM_ERROR("EDID has major version %d, instead of 1\n", edid->version); | 133 | |
134 | if (score == 8) ; | ||
135 | else if (score >= 6) { | ||
136 | DRM_DEBUG("Fixing EDID header, your hardware may be failing\n"); | ||
137 | memcpy(raw_edid, edid_header, sizeof(edid_header)); | ||
138 | } else | ||
134 | goto bad; | 139 | goto bad; |
135 | } | 140 | |
136 | for (i = 0; i < EDID_LENGTH; i++) | 141 | for (i = 0; i < EDID_LENGTH; i++) |
137 | csum += raw_edid[i]; | 142 | csum += raw_edid[i]; |
138 | if (csum) { | 143 | if (csum) { |
@@ -140,6 +145,11 @@ static bool edid_is_valid(struct edid *edid) | |||
140 | goto bad; | 145 | goto bad; |
141 | } | 146 | } |
142 | 147 | ||
148 | if (edid->version != 1) { | ||
149 | DRM_ERROR("EDID has major version %d, instead of 1\n", edid->version); | ||
150 | goto bad; | ||
151 | } | ||
152 | |||
143 | if (edid->revision > 4) | 153 | if (edid->revision > 4) |
144 | DRM_DEBUG("EDID minor > 4, assuming backward compatibility\n"); | 154 | DRM_DEBUG("EDID minor > 4, assuming backward compatibility\n"); |
145 | 155 | ||