diff options
| author | Thomas Reim <reimth@gmail.com> | 2011-07-29 10:28:57 -0400 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2011-08-04 09:39:35 -0400 |
| commit | 051963d4832ed61e5ae74f5330b0a94489e101b9 (patch) | |
| tree | 4ade8f3af4f6ec99d8f76048707072708f5877e7 | |
| parent | 5037f8acf448dd0de9868dc7410f45879d3d1a1b (diff) | |
drm: Separate EDID Header Check from EDID Block Check
Provides function drm_edid_header_is_valid() for EDID header check
and replaces EDID header check part of function drm_edid_block_valid()
by a call of drm_edid_header_is_valid().
This is a prerequisite to extend DDC probing, e. g. in function
radeon_ddc_probe() for Radeon devices, by a central EDID header check.
Tested for kernel 2.6.35, 2.6.38 and 3.0
Cc: <stable@kernel.org>
Signed-off-by: Thomas Reim <reimth@gmail.com>
Reviewed-by: Alex Deucher <alexdeucher@gmail.com>
Acked-by: Stephen Michaels <Stephen.Micheals@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
| -rw-r--r-- | drivers/gpu/drm/drm_edid.c | 24 | ||||
| -rw-r--r-- | include/drm/drm_crtc.h | 1 |
2 files changed, 19 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 7496d245f28c..7425e5c9bd75 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
| @@ -127,6 +127,23 @@ static const u8 edid_header[] = { | |||
| 127 | 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 | 127 | 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 |
| 128 | }; | 128 | }; |
| 129 | 129 | ||
| 130 | /* | ||
| 131 | * Sanity check the header of the base EDID block. Return 8 if the header | ||
| 132 | * is perfect, down to 0 if it's totally wrong. | ||
| 133 | */ | ||
| 134 | int drm_edid_header_is_valid(const u8 *raw_edid) | ||
| 135 | { | ||
| 136 | int i, score = 0; | ||
| 137 | |||
| 138 | for (i = 0; i < sizeof(edid_header); i++) | ||
| 139 | if (raw_edid[i] == edid_header[i]) | ||
| 140 | score++; | ||
| 141 | |||
| 142 | return score; | ||
| 143 | } | ||
| 144 | EXPORT_SYMBOL(drm_edid_header_is_valid); | ||
| 145 | |||
| 146 | |||
| 130 | /* | 147 | /* |
| 131 | * Sanity check the EDID block (base or extension). Return 0 if the block | 148 | * Sanity check the EDID block (base or extension). Return 0 if the block |
| 132 | * doesn't check out, or 1 if it's valid. | 149 | * doesn't check out, or 1 if it's valid. |
| @@ -139,12 +156,7 @@ drm_edid_block_valid(u8 *raw_edid) | |||
| 139 | struct edid *edid = (struct edid *)raw_edid; | 156 | struct edid *edid = (struct edid *)raw_edid; |
| 140 | 157 | ||
| 141 | if (raw_edid[0] == 0x00) { | 158 | if (raw_edid[0] == 0x00) { |
| 142 | int score = 0; | 159 | int score = drm_edid_header_is_valid(raw_edid); |
| 143 | |||
| 144 | for (i = 0; i < sizeof(edid_header); i++) | ||
| 145 | if (raw_edid[i] == edid_header[i]) | ||
| 146 | score++; | ||
| 147 | |||
| 148 | if (score == 8) ; | 160 | if (score == 8) ; |
| 149 | else if (score >= 6) { | 161 | else if (score >= 6) { |
| 150 | DRM_DEBUG("Fixing EDID header, your hardware may be failing\n"); | 162 | DRM_DEBUG("Fixing EDID header, your hardware may be failing\n"); |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index d515bc8f4ba7..44335e57eaaa 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
| @@ -804,6 +804,7 @@ extern struct drm_display_mode *drm_gtf_mode_complex(struct drm_device *dev, | |||
| 804 | extern int drm_add_modes_noedid(struct drm_connector *connector, | 804 | extern int drm_add_modes_noedid(struct drm_connector *connector, |
| 805 | int hdisplay, int vdisplay); | 805 | int hdisplay, int vdisplay); |
| 806 | 806 | ||
| 807 | extern int drm_edid_header_is_valid(const u8 *raw_edid); | ||
| 807 | extern bool drm_edid_is_valid(struct edid *edid); | 808 | extern bool drm_edid_is_valid(struct edid *edid); |
| 808 | struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, | 809 | struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, |
| 809 | int hsize, int vsize, int fresh); | 810 | int hsize, int vsize, int fresh); |
