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.c48
1 files changed, 42 insertions, 6 deletions
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index fadcd44ff196..5a3770fbd770 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -307,12 +307,9 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf,
307 307
308static bool drm_edid_is_zero(u8 *in_edid, int length) 308static bool drm_edid_is_zero(u8 *in_edid, int length)
309{ 309{
310 int i; 310 if (memchr_inv(in_edid, 0, length))
311 u32 *raw_edid = (u32 *)in_edid; 311 return false;
312 312
313 for (i = 0; i < length / 4; i++)
314 if (*(raw_edid + i) != 0)
315 return false;
316 return true; 313 return true;
317} 314}
318 315
@@ -1516,6 +1513,26 @@ u8 *drm_find_cea_extension(struct edid *edid)
1516} 1513}
1517EXPORT_SYMBOL(drm_find_cea_extension); 1514EXPORT_SYMBOL(drm_find_cea_extension);
1518 1515
1516/*
1517 * Looks for a CEA mode matching given drm_display_mode.
1518 * Returns its CEA Video ID code, or 0 if not found.
1519 */
1520u8 drm_match_cea_mode(struct drm_display_mode *to_match)
1521{
1522 struct drm_display_mode *cea_mode;
1523 u8 mode;
1524
1525 for (mode = 0; mode < drm_num_cea_modes; mode++) {
1526 cea_mode = (struct drm_display_mode *)&edid_cea_modes[mode];
1527
1528 if (drm_mode_equal(to_match, cea_mode))
1529 return mode + 1;
1530 }
1531 return 0;
1532}
1533EXPORT_SYMBOL(drm_match_cea_mode);
1534
1535
1519static int 1536static int
1520do_cea_modes (struct drm_connector *connector, u8 *db, u8 len) 1537do_cea_modes (struct drm_connector *connector, u8 *db, u8 len)
1521{ 1538{
@@ -1622,7 +1639,7 @@ parse_hdmi_vsdb(struct drm_connector *connector, const u8 *db)
1622 if (len >= 12) 1639 if (len >= 12)
1623 connector->audio_latency[1] = db[12]; 1640 connector->audio_latency[1] = db[12];
1624 1641
1625 DRM_LOG_KMS("HDMI: DVI dual %d, " 1642 DRM_DEBUG_KMS("HDMI: DVI dual %d, "
1626 "max TMDS clock %d, " 1643 "max TMDS clock %d, "
1627 "latency present %d %d, " 1644 "latency present %d %d, "
1628 "video latency %d %d, " 1645 "video latency %d %d, "
@@ -2062,3 +2079,22 @@ int drm_add_modes_noedid(struct drm_connector *connector,
2062 return num_modes; 2079 return num_modes;
2063} 2080}
2064EXPORT_SYMBOL(drm_add_modes_noedid); 2081EXPORT_SYMBOL(drm_add_modes_noedid);
2082
2083/**
2084 * drm_mode_cea_vic - return the CEA-861 VIC of a given mode
2085 * @mode: mode
2086 *
2087 * RETURNS:
2088 * The VIC number, 0 in case it's not a CEA-861 mode.
2089 */
2090uint8_t drm_mode_cea_vic(const struct drm_display_mode *mode)
2091{
2092 uint8_t i;
2093
2094 for (i = 0; i < drm_num_cea_modes; i++)
2095 if (drm_mode_equal(mode, &edid_cea_modes[i]))
2096 return i + 1;
2097
2098 return 0;
2099}
2100EXPORT_SYMBOL(drm_mode_cea_vic);