Commit e03549dd authored by Hans Verkuil's avatar Hans Verkuil

media: vivid: vidioc_g_edid: do not change the original input EDID

Returning an EDID for a connected output would modify the original
input EDID with the physical address of the output. That causes
problems, and it should just update the physical address of the
output EDID.

Update vivid_hdmi_edid to set the physical address to 0.0.0.0.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
parent 0bc9574a
......@@ -218,7 +218,7 @@ static const u8 vivid_hdmi_edid[256] = {
0x5e, 0x5d, 0x10, 0x1f, 0x04, 0x13, 0x22, 0x21,
0x20, 0x05, 0x14, 0x02, 0x11, 0x01, 0x23, 0x09,
0x07, 0x07, 0x83, 0x01, 0x00, 0x00, 0x6d, 0x03,
0x0c, 0x00, 0x10, 0x00, 0x00, 0x3c, 0x21, 0x00,
0x0c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x21, 0x00,
0x60, 0x01, 0x02, 0x03, 0x67, 0xd8, 0x5d, 0xc4,
0x01, 0x78, 0x00, 0x00, 0xe2, 0x00, 0xca, 0xe3,
0x05, 0x00, 0x00, 0xe3, 0x06, 0x01, 0x00, 0x4d,
......@@ -229,7 +229,7 @@ static const u8 vivid_hdmi_edid[256] = {
0x00, 0x00, 0x1a, 0x1a, 0x1d, 0x00, 0x80, 0x51,
0xd0, 0x1c, 0x20, 0x40, 0x80, 0x35, 0x00, 0xc0,
0x1c, 0x32, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92,
};
static int vidioc_querycap(struct file *file, void *priv,
......
......@@ -1038,6 +1038,7 @@ int vidioc_g_edid(struct file *file, void *_fh,
struct vivid_dev *dev = video_drvdata(file);
struct video_device *vdev = video_devdata(file);
struct cec_adapter *adap;
unsigned int loc;
memset(edid->reserved, 0, sizeof(edid->reserved));
if (vdev->vfl_dir == VFL_DIR_RX) {
......@@ -1068,8 +1069,25 @@ int vidioc_g_edid(struct file *file, void *_fh,
return -EINVAL;
if (edid->blocks > dev->edid_blocks - edid->start_block)
edid->blocks = dev->edid_blocks - edid->start_block;
if (adap)
v4l2_set_edid_phys_addr(dev->edid, dev->edid_blocks * 128, adap->phys_addr);
memcpy(edid->edid, dev->edid + edid->start_block * 128, edid->blocks * 128);
loc = cec_get_edid_spa_location(dev->edid, dev->edid_blocks * 128);
if (vdev->vfl_dir == VFL_DIR_TX && adap && loc &&
loc >= edid->start_block * 128 &&
loc < (edid->start_block + edid->blocks) * 128) {
unsigned int i;
u8 sum = 0;
loc -= edid->start_block * 128;
edid->edid[loc] = adap->phys_addr >> 8;
edid->edid[loc + 1] = adap->phys_addr & 0xff;
loc &= ~0x7f;
/* update the checksum */
for (i = loc; i < loc + 127; i++)
sum += edid->edid[i];
edid->edid[i] = 256 - sum;
}
return 0;
}
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