Commit 49dc0558 authored by Jani Nikula's avatar Jani Nikula

drm/edid: have edid_block_check() detect blocks that are all zero

We have the check function, have it also detect blocks that are all zero
instead of leaving that to callers.
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/f9ad302e6b7dbcd1dff98d94ec5500ce27bebe10.1649685475.git.jani.nikula@intel.com
parent 8baccb27
...@@ -1671,6 +1671,7 @@ EXPORT_SYMBOL(drm_edid_are_equal); ...@@ -1671,6 +1671,7 @@ EXPORT_SYMBOL(drm_edid_are_equal);
enum edid_block_status { enum edid_block_status {
EDID_BLOCK_OK = 0, EDID_BLOCK_OK = 0,
EDID_BLOCK_NULL, EDID_BLOCK_NULL,
EDID_BLOCK_ZERO,
EDID_BLOCK_HEADER_CORRUPT, EDID_BLOCK_HEADER_CORRUPT,
EDID_BLOCK_HEADER_REPAIR, EDID_BLOCK_HEADER_REPAIR,
EDID_BLOCK_HEADER_FIXED, EDID_BLOCK_HEADER_FIXED,
...@@ -1689,15 +1690,23 @@ static enum edid_block_status edid_block_check(const void *_block, ...@@ -1689,15 +1690,23 @@ static enum edid_block_status edid_block_check(const void *_block,
if (is_base_block) { if (is_base_block) {
int score = drm_edid_header_is_valid(block); int score = drm_edid_header_is_valid(block);
if (score < clamp(edid_fixup, 0, 8)) if (score < clamp(edid_fixup, 0, 8)) {
return EDID_BLOCK_HEADER_CORRUPT; if (edid_block_is_zero(block))
return EDID_BLOCK_ZERO;
else
return EDID_BLOCK_HEADER_CORRUPT;
}
if (score < 8) if (score < 8)
return EDID_BLOCK_HEADER_REPAIR; return EDID_BLOCK_HEADER_REPAIR;
} }
if (edid_block_compute_checksum(block) != edid_block_get_checksum(block)) if (edid_block_compute_checksum(block) != edid_block_get_checksum(block)) {
return EDID_BLOCK_CHECKSUM; if (edid_block_is_zero(block))
return EDID_BLOCK_ZERO;
else
return EDID_BLOCK_CHECKSUM;
}
if (is_base_block) { if (is_base_block) {
if (block->version != 1) if (block->version != 1)
...@@ -1785,7 +1794,7 @@ bool drm_edid_block_valid(u8 *_block, int block_num, bool print_bad_edid, ...@@ -1785,7 +1794,7 @@ bool drm_edid_block_valid(u8 *_block, int block_num, bool print_bad_edid,
} }
if (!valid && print_bad_edid) { if (!valid && print_bad_edid) {
if (edid_block_is_zero(block)) { if (status == EDID_BLOCK_ZERO) {
pr_notice("EDID block is all zeroes\n"); pr_notice("EDID block is all zeroes\n");
} else { } else {
pr_notice("Raw EDID:\n"); pr_notice("Raw EDID:\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment