video: rockchip: dp: get edid for discrete vr

Change-Id: Id791e838e37e76f72202731e53afd2533e653069
Signed-off-by: wjh <wjh@rock-chips.com>
This commit is contained in:
wjh
2016-11-07 09:57:45 +08:00
committed by Huang, Tao
parent 28fc1091f4
commit eacfb327ea
2 changed files with 49 additions and 2 deletions

View File

@@ -230,7 +230,10 @@ int cdn_dp_fb_register(struct platform_device *pdev, void *dp)
rockchip_dp_dev_init_ops(rk_dp_ops);
rk_cdn_dp_prop->videosrc = dp_dev->disp_info.vop_sel;
rk_cdn_dp_prop->display = DISPLAY_MAIN;
rk_cdn_dp_prop->defaultmode = HDMI_VIDEO_DEFAULT_MODE;
if (!of_property_read_u32(np, "dp_defaultmode", &val))
rk_cdn_dp_prop->defaultmode = val;
else
rk_cdn_dp_prop->defaultmode = HDMI_VIDEO_DEFAULT_MODE;
rk_cdn_dp_prop->name = (char *)pdev->name;
rk_cdn_dp_prop->priv = dp_dev;
rk_cdn_dp_prop->feature |=

View File

@@ -131,9 +131,53 @@ int cdn_dp_get_edid(void *dp, u8 *buf, int block)
{
int ret;
struct cdn_dp_device *dp_dev = dp;
char guid[16];
char start_read_edid = -1;
u32 readed_size = 0;
u32 left_size = EDID_BLOCK_SIZE;
mutex_lock(&dp_dev->lock);
ret = cdn_dp_get_edid_block(dp_dev, buf, block, EDID_BLOCK_SIZE);
ret = cdn_dp_dpcd_read(dp, 0x0030, guid, 8);
if (ret == 0 && guid[0] == 'n' && guid[1] == 'a' &&
guid[2] == 'n' && guid[3] == 'o' && guid[4] == 'c') {
int try_times = 0;
cdn_dp_dpcd_write(dp, 0x0038, 0x55);
while (left_size > 0) {
u32 length = (left_size > 8) ? 8 : left_size;
ret = cdn_dp_dpcd_read(dp, 0x0038, &start_read_edid, 1);
if (ret != 0) {
dev_err(dp_dev->dev, "read edid sync number error!\n");
break;
} else if (start_read_edid == 0xaa) {
try_times = 0;
ret = cdn_dp_dpcd_read(dp, 0x0030,
buf + readed_size,
length);
if (ret != 0) {
dev_err(dp_dev->dev,
"read edid bytes [%d~%d] error!\n",
readed_size,
readed_size + length);
break;
}
readed_size += length;
left_size -= length;
cdn_dp_dpcd_write(dp, 0x0038, 0x55);
} else {
if (try_times++ >= 100) {
dev_err(dp_dev->dev, "read edid from NanoC failed!\n");
break;
}
continue;
}
}
} else {
ret = cdn_dp_get_edid_block(dp_dev, buf,
block, EDID_BLOCK_SIZE);
}
mutex_unlock(&dp_dev->lock);
return ret;