aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_edid.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/drm_edid.c')
-rw-r--r--drivers/gpu/drm/drm_edid.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index adc9358c9bec..fe0d3dcd4d31 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1413,6 +1413,57 @@ end:
1413EXPORT_SYMBOL(drm_detect_monitor_audio); 1413EXPORT_SYMBOL(drm_detect_monitor_audio);
1414 1414
1415/** 1415/**
1416 * drm_add_display_info - pull display info out if present
1417 * @edid: EDID data
1418 * @info: display info (attached to connector)
1419 *
1420 * Grab any available display info and stuff it into the drm_display_info
1421 * structure that's part of the connector. Useful for tracking bpp and
1422 * color spaces.
1423 */
1424static void drm_add_display_info(struct edid *edid,
1425 struct drm_display_info *info)
1426{
1427 info->width_mm = edid->width_cm * 10;
1428 info->height_mm = edid->height_cm * 10;
1429
1430 /* driver figures it out in this case */
1431 info->bpc = 0;
1432
1433 /* Only defined for 1.4 with digital displays */
1434 if (edid->revision < 4)
1435 return;
1436
1437 if (!(edid->input & DRM_EDID_INPUT_DIGITAL))
1438 return;
1439
1440 switch (edid->input & DRM_EDID_DIGITAL_DEPTH_MASK) {
1441 case DRM_EDID_DIGITAL_DEPTH_6:
1442 info->bpc = 6;
1443 break;
1444 case DRM_EDID_DIGITAL_DEPTH_8:
1445 info->bpc = 8;
1446 break;
1447 case DRM_EDID_DIGITAL_DEPTH_10:
1448 info->bpc = 10;
1449 break;
1450 case DRM_EDID_DIGITAL_DEPTH_12:
1451 info->bpc = 12;
1452 break;
1453 case DRM_EDID_DIGITAL_DEPTH_14:
1454 info->bpc = 14;
1455 break;
1456 case DRM_EDID_DIGITAL_DEPTH_16:
1457 info->bpc = 16;
1458 break;
1459 case DRM_EDID_DIGITAL_DEPTH_UNDEF:
1460 default:
1461 info->bpc = 0;
1462 break;
1463 }
1464}
1465
1466/**
1416 * drm_add_edid_modes - add modes from EDID data, if available 1467 * drm_add_edid_modes - add modes from EDID data, if available
1417 * @connector: connector we're probing 1468 * @connector: connector we're probing
1418 * @edid: edid data 1469 * @edid: edid data
@@ -1460,8 +1511,7 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)
1460 if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75)) 1511 if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
1461 edid_fixup_preferred(connector, quirks); 1512 edid_fixup_preferred(connector, quirks);
1462 1513
1463 connector->display_info.width_mm = edid->width_cm * 10; 1514 drm_add_display_info(edid, &connector->display_info);
1464 connector->display_info.height_mm = edid->height_cm * 10;
1465 1515
1466 return num_modes; 1516 return num_modes;
1467} 1517}