diff options
-rw-r--r-- | drivers/gpu/drm/drm_edid.c | 54 | ||||
-rw-r--r-- | include/drm/drm_crtc.h | 1 | ||||
-rw-r--r-- | include/drm/drm_edid.h | 17 |
3 files changed, 69 insertions, 3 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: | |||
1413 | EXPORT_SYMBOL(drm_detect_monitor_audio); | 1413 | EXPORT_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 | */ | ||
1424 | static 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 | } |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index d94684b7ba34..ee1cb7012e56 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -198,6 +198,7 @@ struct drm_display_info { | |||
198 | unsigned int min_vfreq, max_vfreq; | 198 | unsigned int min_vfreq, max_vfreq; |
199 | unsigned int min_hfreq, max_hfreq; | 199 | unsigned int min_hfreq, max_hfreq; |
200 | unsigned int pixel_clock; | 200 | unsigned int pixel_clock; |
201 | unsigned int bpc; | ||
201 | 202 | ||
202 | enum subpixel_order subpixel_order; | 203 | enum subpixel_order subpixel_order; |
203 | 204 | ||
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index 5881fad91faa..9b9bf946a208 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h | |||
@@ -155,7 +155,22 @@ struct detailed_timing { | |||
155 | #define DRM_EDID_INPUT_SEPARATE_SYNCS (1 << 3) | 155 | #define DRM_EDID_INPUT_SEPARATE_SYNCS (1 << 3) |
156 | #define DRM_EDID_INPUT_BLANK_TO_BLACK (1 << 4) | 156 | #define DRM_EDID_INPUT_BLANK_TO_BLACK (1 << 4) |
157 | #define DRM_EDID_INPUT_VIDEO_LEVEL (3 << 5) | 157 | #define DRM_EDID_INPUT_VIDEO_LEVEL (3 << 5) |
158 | #define DRM_EDID_INPUT_DIGITAL (1 << 7) /* bits below must be zero if set */ | 158 | #define DRM_EDID_INPUT_DIGITAL (1 << 7) |
159 | #define DRM_EDID_DIGITAL_DEPTH_MASK (7 << 4) | ||
160 | #define DRM_EDID_DIGITAL_DEPTH_UNDEF (0 << 4) | ||
161 | #define DRM_EDID_DIGITAL_DEPTH_6 (1 << 4) | ||
162 | #define DRM_EDID_DIGITAL_DEPTH_8 (2 << 4) | ||
163 | #define DRM_EDID_DIGITAL_DEPTH_10 (3 << 4) | ||
164 | #define DRM_EDID_DIGITAL_DEPTH_12 (4 << 4) | ||
165 | #define DRM_EDID_DIGITAL_DEPTH_14 (5 << 4) | ||
166 | #define DRM_EDID_DIGITAL_DEPTH_16 (6 << 4) | ||
167 | #define DRM_EDID_DIGITAL_DEPTH_RSVD (7 << 4) | ||
168 | #define DRM_EDID_DIGITAL_TYPE_UNDEF (0) | ||
169 | #define DRM_EDID_DIGITAL_TYPE_DVI (1) | ||
170 | #define DRM_EDID_DIGITAL_TYPE_HDMI_A (2) | ||
171 | #define DRM_EDID_DIGITAL_TYPE_HDMI_B (3) | ||
172 | #define DRM_EDID_DIGITAL_TYPE_MDDI (4) | ||
173 | #define DRM_EDID_DIGITAL_TYPE_DP (5) | ||
159 | 174 | ||
160 | #define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 0) | 175 | #define DRM_EDID_FEATURE_DEFAULT_GTF (1 << 0) |
161 | #define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 1) | 176 | #define DRM_EDID_FEATURE_PREFERRED_TIMING (1 << 1) |