Commit dd9ac11a authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] adv7604: Correct G/S_EDID behaviour

In order to have v4l2-compliance tool pass the G/S_EDID some modifications
where needed in the driver.
In particular, the edid.reserved zone must be blanked.

Based on a patch from Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>,
but reworked it a bit. It should use 'data' (which depends on edid.present)
instead of edid.blocks as the check whether edid data is present.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent c81285ae
...@@ -1997,19 +1997,7 @@ static int adv7604_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) ...@@ -1997,19 +1997,7 @@ static int adv7604_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
struct adv7604_state *state = to_state(sd); struct adv7604_state *state = to_state(sd);
u8 *data = NULL; u8 *data = NULL;
if (edid->pad > ADV7604_PAD_HDMI_PORT_D) memset(edid->reserved, 0, sizeof(edid->reserved));
return -EINVAL;
if (edid->blocks == 0)
return -EINVAL;
if (edid->blocks > 2)
return -EINVAL;
if (edid->start_block > 1)
return -EINVAL;
if (edid->start_block == 1)
edid->blocks = 1;
if (edid->blocks > state->edid.blocks)
edid->blocks = state->edid.blocks;
switch (edid->pad) { switch (edid->pad) {
case ADV7604_PAD_HDMI_PORT_A: case ADV7604_PAD_HDMI_PORT_A:
...@@ -2021,14 +2009,24 @@ static int adv7604_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) ...@@ -2021,14 +2009,24 @@ static int adv7604_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
break; break;
default: default:
return -EINVAL; return -EINVAL;
break;
} }
if (!data)
if (edid->start_block == 0 && edid->blocks == 0) {
edid->blocks = data ? state->edid.blocks : 0;
return 0;
}
if (data == NULL)
return -ENODATA; return -ENODATA;
memcpy(edid->edid, if (edid->start_block >= state->edid.blocks)
data + edid->start_block * 128, return -EINVAL;
edid->blocks * 128);
if (edid->start_block + edid->blocks > state->edid.blocks)
edid->blocks = state->edid.blocks - edid->start_block;
memcpy(edid->edid, data + edid->start_block * 128, edid->blocks * 128);
return 0; return 0;
} }
...@@ -2068,6 +2066,8 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) ...@@ -2068,6 +2066,8 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
int err; int err;
int i; int i;
memset(edid->reserved, 0, sizeof(edid->reserved));
if (edid->pad > ADV7604_PAD_HDMI_PORT_D) if (edid->pad > ADV7604_PAD_HDMI_PORT_D)
return -EINVAL; return -EINVAL;
if (edid->start_block != 0) if (edid->start_block != 0)
...@@ -2164,7 +2164,6 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid) ...@@ -2164,7 +2164,6 @@ static int adv7604_set_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
return -EIO; return -EIO;
} }
/* enable hotplug after 100 ms */ /* enable hotplug after 100 ms */
queue_delayed_work(state->work_queues, queue_delayed_work(state->work_queues,
&state->delayed_work_enable_hotplug, HZ / 10); &state->delayed_work_enable_hotplug, HZ / 10);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment