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.c61
1 files changed, 59 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index adc9358c9bec..0a9357c66ff8 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1413,6 +1413,64 @@ 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 info->color_formats = 0;
1433
1434 /* Only defined for 1.4 with digital displays */
1435 if (edid->revision < 4)
1436 return;
1437
1438 if (!(edid->input & DRM_EDID_INPUT_DIGITAL))
1439 return;
1440
1441 switch (edid->input & DRM_EDID_DIGITAL_DEPTH_MASK) {
1442 case DRM_EDID_DIGITAL_DEPTH_6:
1443 info->bpc = 6;
1444 break;
1445 case DRM_EDID_DIGITAL_DEPTH_8:
1446 info->bpc = 8;
1447 break;
1448 case DRM_EDID_DIGITAL_DEPTH_10:
1449 info->bpc = 10;
1450 break;
1451 case DRM_EDID_DIGITAL_DEPTH_12:
1452 info->bpc = 12;
1453 break;
1454 case DRM_EDID_DIGITAL_DEPTH_14:
1455 info->bpc = 14;
1456 break;
1457 case DRM_EDID_DIGITAL_DEPTH_16:
1458 info->bpc = 16;
1459 break;
1460 case DRM_EDID_DIGITAL_DEPTH_UNDEF:
1461 default:
1462 info->bpc = 0;
1463 break;
1464 }
1465
1466 info->color_formats = DRM_COLOR_FORMAT_RGB444;
1467 if (info->color_formats & DRM_EDID_FEATURE_RGB_YCRCB444)
1468 info->color_formats = DRM_COLOR_FORMAT_YCRCB444;
1469 if (info->color_formats & DRM_EDID_FEATURE_RGB_YCRCB422)
1470 info->color_formats = DRM_COLOR_FORMAT_YCRCB422;
1471}
1472
1473/**
1416 * drm_add_edid_modes - add modes from EDID data, if available 1474 * drm_add_edid_modes - add modes from EDID data, if available
1417 * @connector: connector we're probing 1475 * @connector: connector we're probing
1418 * @edid: edid data 1476 * @edid: edid data
@@ -1460,8 +1518,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)) 1518 if (quirks & (EDID_QUIRK_PREFER_LARGE_60 | EDID_QUIRK_PREFER_LARGE_75))
1461 edid_fixup_preferred(connector, quirks); 1519 edid_fixup_preferred(connector, quirks);
1462 1520
1463 connector->display_info.width_mm = edid->width_cm * 10; 1521 drm_add_display_info(edid, &connector->display_info);
1464 connector->display_info.height_mm = edid->height_cm * 10;
1465 1522
1466 return num_modes; 1523 return num_modes;
1467} 1524}