From a8f043edd5cc2c14dc0d3004bf142a12e0046ef9 Mon Sep 17 00:00:00 2001 From: Zheng Yang Date: Wed, 17 Feb 2016 15:51:41 +0800 Subject: [PATCH] video: rockchip: hdmi: support rk3366 Change-Id: I944e9749e559c25651de619c89eead0589c1eb5b Signed-off-by: Zheng Yang --- .../video/rockchip/hdmi/rockchip-hdmi-lcdc.c | 2 +- drivers/video/rockchip/hdmi/rockchip-hdmi.h | 3 +- .../hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c | 31 ++++++++++++++++--- .../hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c | 2 ++ 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c b/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c index 9228fd134387..3fb7d689d66a 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmi-lcdc.c @@ -848,7 +848,7 @@ static int hdmi_set_info(struct rk_screen *screen, struct hdmi *hdmi) screen->pin_dclk = 1; /* Swap rule */ - if (hdmi->soctype > HDMI_SOC_RK3288 && + if (hdmi->soctype > HDMI_SOC_RK312X && screen->color_mode > COLOR_RGB && (screen->face == OUT_P888 || screen->face == OUT_P101010)) diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi.h b/drivers/video/rockchip/hdmi/rockchip-hdmi.h index e061fd6e3948..953f054792b7 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmi.h +++ b/drivers/video/rockchip/hdmi/rockchip-hdmi.h @@ -373,9 +373,10 @@ struct hdmi_property { enum { HDMI_SOC_RK3036 = 0, HDMI_SOC_RK312X, + HDMI_SOC_RK322X, HDMI_SOC_RK3288, + HDMI_SOC_RK3366, HDMI_SOC_RK3368, - HDMI_SOC_RK322X }; /* HDMI Information */ diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c index 6850b8ed18c9..86cedf5f548c 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c @@ -209,12 +209,18 @@ void ext_pll_set_27m_out(void) static int rockchip_hdmiv2_clk_enable(struct hdmi_dev *hdmi_dev) { - if (hdmi_dev->soctype == HDMI_SOC_RK322X) { + if (hdmi_dev->soctype == HDMI_SOC_RK322X || + hdmi_dev->soctype == HDMI_SOC_RK3366) { if ((hdmi_dev->clk_on & HDMI_EXT_PHY_CLK_ON) == 0) { if (!hdmi_dev->pclk_phy) { - hdmi_dev->pclk_phy = - devm_clk_get(hdmi_dev->dev, - "pclk_hdmi_phy"); + if (hdmi_dev->soctype == HDMI_SOC_RK322X) + hdmi_dev->pclk_phy = + devm_clk_get(hdmi_dev->dev, + "pclk_hdmi_phy"); + else + hdmi_dev->pclk_phy = + devm_clk_get(hdmi_dev->dev, + "dclk_hdmi_phy"); if (IS_ERR(hdmi_dev->pclk_phy)) { dev_err(hdmi_dev->dev, "get hdmi phy pclk error\n"); @@ -391,9 +397,10 @@ static struct hdmi_ops rk_hdmi_ops; #if defined(CONFIG_OF) static const struct of_device_id rk_hdmi_dt_ids[] = { + {.compatible = "rockchip,rk322x-hdmi",}, {.compatible = "rockchip,rk3288-hdmi",}, + {.compatible = "rockchip,rk3366-hdmi",}, {.compatible = "rockchip,rk3368-hdmi",}, - {.compatible = "rockchip,rk322x-hdmi",}, {} }; @@ -413,6 +420,8 @@ static int rockchip_hdmiv2_parse_dt(struct hdmi_dev *hdmi_dev) hdmi_dev->soctype = HDMI_SOC_RK3368; } else if (!strcmp(match->compatible, "rockchip,rk322x-hdmi")) { hdmi_dev->soctype = HDMI_SOC_RK322X; + } else if (!strcmp(match->compatible, "rockchip,rk3366-hdmi")) { + hdmi_dev->soctype = HDMI_SOC_RK3366; } else { pr_err("It is not a valid rockchip soc!"); return -ENOMEM; @@ -584,6 +593,18 @@ static int rockchip_hdmiv2_probe(struct platform_device *pdev) * SUPPORT_YUV420 | * SUPPORT_DEEP_10BIT; */ + } else if (hdmi_dev->soctype == HDMI_SOC_RK3366) { + rk_hdmi_property.feature |= + SUPPORT_YCBCR_INPUT | + SUPPORT_1080I | + SUPPORT_480I_576I; + if (rk_hdmi_property.videosrc == DISPLAY_SOURCE_LCDC0) + rk_hdmi_property.feature |= + SUPPORT_4K | + SUPPORT_4K_4096 | + SUPPORT_YUV420 | + SUPPORT_YCBCR_INPUT | + SUPPORT_TMDS_600M; } else { ret = -ENXIO; goto failed1; diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c index ec80cdbdde9f..f43138d66270 100755 --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c @@ -693,6 +693,8 @@ static int rockchip_hdmiv2_config_phy(struct hdmi_dev *hdmi_dev) if (hdmi_dev->soctype == HDMI_SOC_RK322X) return ext_phy_config(hdmi_dev); + else if (hdmi_dev->soctype == HDMI_SOC_RK3366) + clk_set_rate(hdmi_dev->pclk_phy, hdmi_dev->pixelclk); hdmi_msk_reg(hdmi_dev, PHY_I2CM_DIV, m_PHY_I2CM_FAST_STD, v_PHY_I2CM_FAST_STD(0)); -- 2.34.1