From: wenping.zhang Date: Mon, 29 Aug 2016 01:19:58 +0000 (+0800) Subject: video: rockchip: hdmi: add new hdmi resolution mode support for discrete vr device. X-Git-Tag: firefly_0821_release~1642 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=914ca8100494814fdc909dc9f1e0ee6dedad5667;p=firefly-linux-kernel-4.4.55.git video: rockchip: hdmi: add new hdmi resolution mode support for discrete vr device. For some special hdmi pixclock we should add support for this clock in hdmi phy mpll table. Add new format SUPPORT_RK_DISCRETE_VR for rockchip discrete vr device,if hdmi device is rockchip discrete vr device, please set the vic = HDMI_VIDEO_DISCRETE_VR in hdmi timing. Change-Id: I820f967a84fbb7737cd9e1c2951b89df63863298 Signed-off-by: wenping.zhang --- diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi-core.c b/drivers/video/rockchip/hdmi/rockchip-hdmi-core.c index ece097f6054a..bd490b09a323 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmi-core.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmi-core.c @@ -131,7 +131,7 @@ static void hdmi_wq_set_video(struct hdmi *hdmi) else video->color_input = HDMI_COLOR_RGB_0_255; - if (hdmi->vic & HDMI_VIDEO_DMT) { + if ((hdmi->vic & HDMI_VIDEO_DMT) || (hdmi->vic & HDMI_VIDEO_DISCRETE_VR)) { video->vic = hdmi->vic; video->color_output_depth = 8; } else { diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c b/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c index db6d0a4b6f31..957d68d6682c 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c @@ -771,6 +771,50 @@ static const struct hdmi_video_timing hdmi_mode[] = { .pixelrepeat = 1, .interface = OUT_P888, }, + { + .mode = { + .name = "1440x1280@60Hz", + .refresh = 60, + .xres = 1440, + .yres = 1280, + .pixclock = 148500000, + .left_margin = 84, + .right_margin = 360, + .upper_margin = 8, + .lower_margin = 10, + .hsync_len = 20, + .vsync_len = 2, + .sync = 0, + .vmode = 0, + .flag = 0, + }, + .vic = HDMI_VIDEO_DISCRETE_VR | 1, + .vic_2nd = 0, + .pixelrepeat = 1, + .interface = OUT_P888, + }, + { + .mode = { + .name = "1440x2560@60Hz", + .refresh = 60, + .xres = 1440, + .yres = 2560, + .pixclock = 269390000, + .left_margin = 80, + .right_margin = 180, + .upper_margin = 7, + .lower_margin = 7, + .hsync_len = 40, + .vsync_len = 6, + .sync = 0, + .vmode = 0, + .flag = 0, + }, + .vic = HDMI_VIDEO_DISCRETE_VR | 2, + .vic_2nd = 0, + .pixelrepeat = 1, + .interface = OUT_P888, + }, }; static int hdmi_set_info(struct rk_screen *screen, struct hdmi *hdmi) @@ -784,7 +828,7 @@ static int hdmi_set_info(struct rk_screen *screen, struct hdmi *hdmi) if (hdmi->vic == 0) hdmi->vic = hdmi->property->defaultmode; - if (hdmi->vic & HDMI_VIDEO_DMT) + if ((hdmi->vic & HDMI_VIDEO_DMT) || (hdmi->vic & HDMI_VIDEO_DISCRETE_VR)) vic = hdmi->vic; else vic = hdmi->vic & HDMI_VIC_MASK; @@ -1074,8 +1118,8 @@ static void hdmi_sort_modelist(struct hdmi_edid *edid, int feature) modelist = list_entry(pos, struct display_modelist, list); /*pr_info("%s vic %d\n", __function__, modelist->vic);*/ for (i = 0; i < ARRAY_SIZE(hdmi_mode); i++) { - if (modelist->vic & HDMI_VIDEO_DMT) { - if (feature & SUPPORT_VESA_DMT) + if ((modelist->vic & HDMI_VIDEO_DMT) || (modelist->vic & HDMI_VIDEO_DISCRETE_VR)) { + if (feature & (SUPPORT_VESA_DMT | SUPPORT_RK_DISCRETE_VR)) vic = modelist->vic; else continue; @@ -1219,7 +1263,8 @@ int hdmi_ouputmode_select(struct hdmi *hdmi, int edid_ok) if (mode->xres > 3840 || mode->refresh < 50 || (mode->vmode & FB_VMODE_INTERLACED) || - hdmi_mode[i].vic & HDMI_VIDEO_DMT) + hdmi_mode[i].vic & HDMI_VIDEO_DMT || + hdmi_mode[i].vic & HDMI_VIDEO_DISCRETE_VR) continue; } if ((feature & SUPPORT_TMDS_600M) == 0 && @@ -1319,7 +1364,7 @@ const struct fb_videomode *hdmi_vic_to_videomode(int vic) if (vic == 0) return NULL; - else if (vic & HDMI_VIDEO_DMT) + else if ((vic & HDMI_VIDEO_DMT) || (vic & HDMI_VIDEO_DISCRETE_VR)) vid = vic; else vid = vic & HDMI_VIC_MASK; @@ -1346,7 +1391,7 @@ void hdmi_init_modelist(struct hdmi *hdmi) feature = hdmi->property->feature; INIT_LIST_HEAD(&hdmi->edid.modelist); for (i = 0; i < ARRAY_SIZE(hdmi_mode); i++) { - if (hdmi_mode[i].vic & HDMI_VIDEO_DMT) + if ((hdmi_mode[i].vic & HDMI_VIDEO_DMT) || (hdmi_mode[i].vic & HDMI_VIDEO_DISCRETE_VR)) continue; if ((feature & SUPPORT_TMDS_600M) == 0 && hdmi_mode[i].mode.pixclock > 340000000) diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi.h b/drivers/video/rockchip/hdmi/rockchip-hdmi.h index e514031890c3..a5e8dd548080 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmi.h +++ b/drivers/video/rockchip/hdmi/rockchip-hdmi.h @@ -12,6 +12,7 @@ #define HDMI_VIDEO_NORMAL 0 #define HDMI_VIDEO_DMT BIT(9) #define HDMI_VIDEO_YUV420 BIT(10) +#define HDMI_VIDEO_DISCRETE_VR BIT(11) #define HDMI_VIC_MASK (0xFF) #define HDMI_TYPE_MASK (0xFF << 8) #define HDMI_MAX_ID 4 @@ -359,7 +360,8 @@ enum rk_hdmi_feature { SUPPORT_HDCP = (1 << 10), SUPPORT_HDCP2 = (1 << 11), SUPPORT_YCBCR_INPUT = (1 << 12), - SUPPORT_VESA_DMT = (1 << 13) + SUPPORT_VESA_DMT = (1 << 13), + SUPPORT_RK_DISCRETE_VR = (1 << 14) }; struct hdmi_property { diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c index 2510374e1699..6e607a27d993 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c @@ -617,7 +617,8 @@ static int rockchip_hdmiv2_probe(struct platform_device *pdev) SUPPORT_YCBCR_INPUT | SUPPORT_1080I | SUPPORT_480I_576I | - SUPPORT_VESA_DMT; + SUPPORT_VESA_DMT | + SUPPORT_RK_DISCRETE_VR; if (rk_hdmi_property.videosrc == DISPLAY_SOURCE_LCDC0) rk_hdmi_property.feature |= SUPPORT_4K | diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c old mode 100755 new mode 100644 index 3db85bc229d3..e4e812ff671f --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c @@ -73,6 +73,8 @@ static const struct phy_mpll_config_tab PHY_MPLL_TABLE[] = { 1, 1, 0, 0, 0, 0, 3}, {148500000, 594000000, 0, 8, 0, 3, 1, 1, 3, 0, 0, 0, 0, 3}, + {269390000, 269390000, 0, 8, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 3}, {297000000, 148500000, 0, 8, 0, 0, 0, 1, 0, 1, 0, 0, 0, 3}, {297000000, 297000000, 0, 8, 0, 0, 0, @@ -1536,7 +1538,8 @@ static void hdmi_dev_config_avi(struct hdmi_dev *hdmi_dev, /* Set AVI infoFrame Data byte4 */ if ((vpara->vic > 92 && vpara->vic < 96) || (vpara->vic == 98) || - (vpara->vic & HDMI_VIDEO_DMT)) + (vpara->vic & HDMI_VIDEO_DMT) || + (vpara->vic & HDMI_VIDEO_DISCRETE_VR)) hdmi_writel(hdmi_dev, FC_AVIVID, 0); else hdmi_writel(hdmi_dev, FC_AVIVID, vpara->vic & 0xff);