diff options
Diffstat (limited to 'drivers/gpu/drm/drm_edid.c')
| -rw-r--r-- | drivers/gpu/drm/drm_edid.c | 37 | 
1 files changed, 29 insertions, 8 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 09292193daf..7425e5c9bd7 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -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"); @@ -185,8 +197,8 @@ drm_edid_block_valid(u8 *raw_edid)  bad:  	if (raw_edid) {  		printk(KERN_ERR "Raw EDID:\n"); -		print_hex_dump_bytes(KERN_ERR, DUMP_PREFIX_NONE, raw_edid, EDID_LENGTH); -		printk(KERN_ERR "\n"); +		print_hex_dump(KERN_ERR, " \t", DUMP_PREFIX_NONE, 16, 1, +			       raw_edid, EDID_LENGTH, false);  	}  	return 0;  } @@ -1439,6 +1451,8 @@ EXPORT_SYMBOL(drm_detect_monitor_audio);  static void drm_add_display_info(struct edid *edid,  				 struct drm_display_info *info)  { +	u8 *edid_ext; +  	info->width_mm = edid->width_cm * 10;  	info->height_mm = edid->height_cm * 10; @@ -1483,6 +1497,13 @@ static void drm_add_display_info(struct edid *edid,  		info->color_formats = DRM_COLOR_FORMAT_YCRCB444;  	if (info->color_formats & DRM_EDID_FEATURE_RGB_YCRCB422)  		info->color_formats = DRM_COLOR_FORMAT_YCRCB422; + +	/* Get data from CEA blocks if present */ +	edid_ext = drm_find_cea_extension(edid); +	if (!edid_ext) +		return; + +	info->cea_rev = edid_ext[1];  }  /**  |