summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/cmd_hdmitx.c14
-rw-r--r--common/edid-decode.c14
2 files changed, 23 insertions, 5 deletions
diff --git a/common/cmd_hdmitx.c b/common/cmd_hdmitx.c
index 1de873144a..20a85c887b 100644
--- a/common/cmd_hdmitx.c
+++ b/common/cmd_hdmitx.c
@@ -29,7 +29,7 @@
#undef DEBUG_DUMPEDID
-extern void parse_edid(unsigned char *edid, unsigned int blk_len);
+extern int parse_edid(unsigned char *edid, unsigned int blk_len, unsigned char count);
extern char *select_best_resolution(void);
static int do_hpd_detect(cmd_tbl_t *cmdtp, int flag, int argc,
@@ -60,12 +60,17 @@ static void dump_edid_raw(unsigned char *buf, unsigned int blk_len)
}
#endif
+/* 500ms for each retry, total 5 retry */
+#define EDID_RETRY_WAITTIME 500
static int do_edid(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{
unsigned int blk_len = 0;
+ unsigned char count = 0;
memset(edid_raw_buf, 0, ARRAY_SIZE(edid_raw_buf));
if (argc < 1)
return cmd_usage(cmdtp);
+
+READ_EDID:
/* read edid raw data */
blk_len = hdmitx_device.HWOp.read_edid(edid_raw_buf);
@@ -77,7 +82,12 @@ static int do_edid(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
dump_edid_raw(edid_raw_buf, blk_len);
#endif
/* parsing edid data */
- parse_edid(edid_raw_buf, blk_len);
+ if (-1 == parse_edid(edid_raw_buf, blk_len, count)) {
+ printf("hdmitx: read edid fails.. retry..\n");
+ mdelay(EDID_RETRY_WAITTIME);
+ count++;
+ goto READ_EDID;
+ }
/* select best resolution */
setenv("m", select_best_resolution());
setenv("hdmimode", getenv("m"));
diff --git a/common/edid-decode.c b/common/edid-decode.c
index 72541b7fa4..bd5e1ddbe1 100644
--- a/common/edid-decode.c
+++ b/common/edid-decode.c
@@ -1682,7 +1682,8 @@ void dump_breakdown(unsigned char *edid)
}
#endif
-void parse_edid(unsigned char *edid, unsigned int blk_len)
+#define EDID_RETRY_COUNT 3
+int parse_edid(unsigned char *edid, unsigned int blk_len, unsigned char count)
{
unsigned char *x;
int analog, i;
@@ -1717,8 +1718,13 @@ void parse_edid(unsigned char *edid, unsigned int blk_len)
if (!edid || memcmp(edid, "\x00\xFF\xFF\xFF\xFF\xFF\xFF\x00", 8)) {
- printf("No header found\n");
- /* return 1; */
+ /*
+ * If edid data is invalid, read it again after 200ms.
+ * This situation can be occured when a monitor need a long standby time
+ * after powering up.
+ */
+ printf("No header found - count %d\n", count);
+ if (count < EDID_RETRY_COUNT) return -1;
}
/* set edid_lines */
@@ -2052,6 +2058,8 @@ void parse_edid(unsigned char *edid, unsigned int blk_len)
if (warning_zero_preferred_refresh)
printf("Warning: CVT block does not set preferred refresh rate\n");
#endif
+
+ return 0;
}
#ifdef DEBUG_EDID