Convert CONFIG_SYS_INTERLAKEN et al to Kconfig
[platform/kernel/u-boot.git] / common / edid.c
index a6c875d..556c4e3 100644 (file)
@@ -139,7 +139,7 @@ static void decode_timing(u8 *buf, struct display_timing *timing)
 /**
  * Check if HDMI vendor specific data block is present in CEA block
  * @param info CEA extension block
- * @return true if block is found
+ * Return: true if block is found
  */
 static bool cea_is_hdmi_vsdb_present(struct edid_cea861_info *info)
 {
@@ -220,6 +220,24 @@ int edid_get_timing_validate(u8 *buf, int buf_size,
        /* Look for detailed timing in base EDID */
        found = edid_find_valid_timing(edid->monitor_details.descriptor, 4,
                                       timing, mode_valid, mode_valid_priv);
+
+       /* Look for detailed timing in CTA-861 Extension Block */
+       if (!found && edid->extension_flag && buf_size >= EDID_EXT_SIZE) {
+               struct edid_cea861_info *info =
+                       (struct edid_cea861_info *)(buf + sizeof(*edid));
+
+               if (info->extension_tag == EDID_CEA861_EXTENSION_TAG) {
+                       int count = EDID_CEA861_DTD_COUNT(*info);
+                       int offset = info->dtd_offset;
+                       int size = count * sizeof(struct edid_detailed_timing);
+
+                       if (offset >= 4 && offset + size < EDID_SIZE)
+                               found = edid_find_valid_timing(
+                                       (u8 *)info + offset, count, timing,
+                                       mode_valid, mode_valid_priv);
+               }
+       }
+
        if (!found)
                return -EINVAL;
 
@@ -256,7 +274,7 @@ int edid_get_timing(u8 *buf, int buf_size, struct display_timing *timing,
  * Snip the tailing whitespace/return of a string.
  *
  * @param string       The string to be snipped
- * @return the snipped string
+ * Return: the snipped string
  */
 static char *snip(char *string)
 {