summaryrefslogtreecommitdiff
path: root/drivers/media/i2c/adv7511.c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-11-07 15:34:56 +0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-11 13:58:25 +0300
commitc81285ae4780e5df83f191f545c156435fdb01ba (patch)
treebc4195e69438d804f85e6ccba7eab85f2addac58 /drivers/media/i2c/adv7511.c
parentc909e5ba6b1d79edfa809150da36a2c0c9cb095e (diff)
downloadlinux-c81285ae4780e5df83f191f545c156435fdb01ba.tar.xz
[media] adv7511: fix G/S_EDID behavior
This fixes the v4l2-compliance failures. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/i2c/adv7511.c')
-rw-r--r--drivers/media/i2c/adv7511.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c
index f98acf4aafd4..8acc8c5d67d7 100644
--- a/drivers/media/i2c/adv7511.c
+++ b/drivers/media/i2c/adv7511.c
@@ -779,21 +779,28 @@ static int adv7511_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
{
struct adv7511_state *state = get_adv7511_state(sd);
+ memset(edid->reserved, 0, sizeof(edid->reserved));
+
if (edid->pad != 0)
return -EINVAL;
- if ((edid->blocks == 0) || (edid->blocks > 256))
- return -EINVAL;
- if (!state->edid.segments) {
- v4l2_dbg(1, debug, sd, "EDID segment 0 not found\n");
- return -ENODATA;
+
+ if (edid->start_block == 0 && edid->blocks == 0) {
+ edid->blocks = state->edid.segments * 2;
+ return 0;
}
+
+ if (state->edid.segments == 0)
+ return -ENODATA;
+
if (edid->start_block >= state->edid.segments * 2)
- return -E2BIG;
- if ((edid->blocks + edid->start_block) >= state->edid.segments * 2)
+ return -EINVAL;
+
+ if (edid->start_block + edid->blocks > state->edid.segments * 2)
edid->blocks = state->edid.segments * 2 - edid->start_block;
memcpy(edid->edid, &state->edid.data[edid->start_block * 128],
128 * edid->blocks);
+
return 0;
}