diff options
author | Per Persson <per.xb.persson@stericsson.com> | 2011-06-01 10:51:05 +0200 |
---|---|---|
committer | Jimmy RUBIN <jimmy.rubin@stericsson.com> | 2011-06-01 12:46:10 +0200 |
commit | d0509803a9c1423042d19e7d28841d5edc40c678 (patch) | |
tree | abcedae999a355734adf9cae9a768f7c225c5c1d /src | |
parent | f82701356e5cc01e2ad60b3059c3ea5ccecde3fe (diff) |
HDMIservice: Improve error handling
EDID block 1 error handling is improved.
ST-Ericsson ID: 326691
ST-Ericsson FOSS-OUT ID: STETL-FOSS-OUT-10177
Signed-off-by: Per Persson <per.xb.persson@stericsson.com>
Change-Id: I83d0f1fb1b9dace539f851cc240e2da81bd14404
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/24314
Reviewed-by: Per-Daniel OLSSON <per-daniel.olsson@stericsson.com>
Reviewed-by: Marcel TUNNISSEN <marcel.tuennissen@stericsson.com>
Reviewed-by: Jimmy RUBIN <jimmy.rubin@stericsson.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/edid.c | 12 | ||||
-rw-r--r-- | src/hdmi_service.c | 29 |
2 files changed, 26 insertions, 15 deletions
@@ -322,6 +322,7 @@ int edid_parse0(__u8 *data, __u8 *extension, struct video_format formats[], int edid_parse1(__u8 *data, struct video_format formats[], int nr_formats, int *basic_audio_support, struct edid_latency *edid_latency) { + __u8 tag; __u8 rev; __u8 offset; __u8 blockp; @@ -342,11 +343,16 @@ int edid_parse1(__u8 *data, struct video_format formats[], int nr_formats, __u8 edidp; __u8 *p; + tag = *(data + EDID_BL1_TAG_OFFSET); rev = *(data + EDID_BL1_REVNR_OFFSET); + if ((tag != EDID_BL1_TAG_EXPECTED) || rev != EDID_BL1_REV_EXPECTED) { + LOGHDMILIB("edid bl1 tag:%02x or rev:%02x invalid", tag, rev); + return EDIDREAD_BL1_TAG_REV_ERR; + } + offset = *(data + EDID_BL1_OFFSET_OFFSET); LOGHDMILIB("rev:%d offset:%d", rev, offset); - if ((rev != EDID_EXTVER_3) || (offset == 0) || (offset == EDID_NO_DATA)) { LOGHDMILIB("%s", "No video block"); @@ -403,7 +409,7 @@ int edid_parse1(__u8 *data, struct video_format formats[], int nr_formats, /* Video and Audio latency */ if ((length >= EDID_VSD_AUD_LAT) && (*(p + EDID_VSD_LATENCY_IND) & - EDID_VSD_LAT_FLD_MASK )) { + EDID_VSD_LAT_FLD_MASK)) { edid_latency->video_latency = 2 * (*(p + EDID_VSD_VID_LAT) - 1); edid_latency->audio_latency = @@ -413,7 +419,7 @@ int edid_parse1(__u8 *data, struct video_format formats[], int nr_formats, /* Interlaced Video and Audio latency */ if ((length >= EDID_VSD_INTLCD_AUD_LAT) && (*(p + EDID_VSD_LATENCY_IND) & - EDID_VSD_INTLCD_LAT_FLD_MASK )) { + EDID_VSD_INTLCD_LAT_FLD_MASK)) { edid_latency->intlcd_video_latency = 2 * (*(p + EDID_VSD_INTLCD_VID_LAT) - 1); edid_latency->audio_latency = diff --git a/src/hdmi_service.c b/src/hdmi_service.c index 7e4ea08..e262f8b 100644 --- a/src/hdmi_service.c +++ b/src/hdmi_service.c @@ -35,7 +35,7 @@ void (*hdmi_callback_fn)(int cmd, int data_length, __u8 *data) = NULL; #endif /*HDMI_SERVICE_USE_CALLBACK_FN*/ int hdmi_events; enum hdmi_fb_state hdmi_fb_state; -enum hdmi_plug_state hdmi_plug_state; +enum hdmi_plug_state hdmi_plug_state = HDMI_PLUGUNDEF; struct cmd_data *cmd_data; int cmd_id_ind; @@ -199,11 +199,6 @@ int hdmiplug_subscribe(void) goto hdmiplug_subscribe_err2; } - /* Unsubscribe */ - res = write(plugdetenfd, plugdetdis_val, sizeof(plugdetdis_val)); - if (res != sizeof(plugdetdis_val)) - goto hdmiplug_subscribe_err1; - /* Subscribe */ res = write(plugdetenfd, plugdeten_val, sizeof(plugdeten_val)); if (res != sizeof(plugdeten_val)) @@ -296,7 +291,7 @@ static int hdmiplugged_handle(int *basic_audio_support) res = edid_parse0(data + 1, &extension, formats, nr_formats); if (res && (cnt < 2)) - usleep(EDIDREAD_WAITTIME); + usleep(EDIDREAD_WAITTIME0); cnt++; } if (res) { @@ -306,13 +301,23 @@ static int hdmiplugged_handle(int *basic_audio_support) if (extension) { /* Extension data exists */ - if (edid_read(1, data) != 0) { - ret = -2; - goto hdmiplugged_handle_end; + cnt = 0; + res = -1; + while (res && (cnt < 3)) { + res = edid_read(1, data); + if (res == 0) + res = edid_parse1(data + 1, formats, nr_formats, + basic_audio_support, + &edid_latency); + if (res && (cnt < 2)) + usleep(EDIDREAD_WAITTIME1); + cnt++; } - edid_parse1(data + 1, formats, nr_formats, - basic_audio_support, &edid_latency); + if (res) { + ret = -1; + goto hdmiplugged_handle_end; + } /* Set hdmi format to hdmi */ hdmi_format_set(HDMI_FORMAT_HDMI); |