mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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: <[email protected]>
Signed-off-by: Thomas Reim <[email protected]>
Reviewed-by: Alex Deucher <[email protected]>
Acked-by: Stephen Michaels <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
This commit is contained in:
parent
5037f8acf4
commit
051963d483
2 changed files with 19 additions and 6 deletions
|
|
@ -127,6 +127,23 @@ static const u8 edid_header[] = {
|
|||
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
|
||||
};
|
||||
|
||||
/*
|
||||
* Sanity check the header of the base EDID block. Return 8 if the header
|
||||
* is perfect, down to 0 if it's totally wrong.
|
||||
*/
|
||||
int drm_edid_header_is_valid(const u8 *raw_edid)
|
||||
{
|
||||
int i, score = 0;
|
||||
|
||||
for (i = 0; i < sizeof(edid_header); i++)
|
||||
if (raw_edid[i] == edid_header[i])
|
||||
score++;
|
||||
|
||||
return score;
|
||||
}
|
||||
EXPORT_SYMBOL(drm_edid_header_is_valid);
|
||||
|
||||
|
||||
/*
|
||||
* Sanity check the EDID block (base or extension). Return 0 if the block
|
||||
* doesn't check out, or 1 if it's valid.
|
||||
|
|
@ -139,12 +156,7 @@ drm_edid_block_valid(u8 *raw_edid)
|
|||
struct edid *edid = (struct edid *)raw_edid;
|
||||
|
||||
if (raw_edid[0] == 0x00) {
|
||||
int score = 0;
|
||||
|
||||
for (i = 0; i < sizeof(edid_header); i++)
|
||||
if (raw_edid[i] == edid_header[i])
|
||||
score++;
|
||||
|
||||
int score = drm_edid_header_is_valid(raw_edid);
|
||||
if (score == 8) ;
|
||||
else if (score >= 6) {
|
||||
DRM_DEBUG("Fixing EDID header, your hardware may be failing\n");
|
||||
|
|
|
|||
Loading…
Reference in a new issue