From 64bccfea371fb6ac0784f35f23bea734dffe895e Mon Sep 17 00:00:00 2001 From: Zheng Yang Date: Mon, 15 Feb 2016 16:46:37 +0800 Subject: [PATCH] video: rockchip: hdmi: 3368 work okay Change-Id: I40f6b87f1f77fb410d4adb9c2b352624b6b19d34 Signed-off-by: Zheng Yang --- .../video/rockchip/hdmi/rockchip-hdmi-cec.c | 6 ++--- .../video/rockchip/hdmi/rockchip-hdmi-core.c | 10 ++++--- .../video/rockchip/hdmi/rockchip-hdmi-edid.c | 7 +++-- .../hdmi/rockchip-hdmiv1/rockchip_hdmiv1.c | 2 +- .../hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c | 27 ++++++++----------- .../hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c | 4 +-- .../hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.h | 7 +++++ 7 files changed, 33 insertions(+), 30 deletions(-) diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi-cec.c b/drivers/video/rockchip/hdmi/rockchip-hdmi-cec.c index f8f3d3d096d3..59965cdaed9a 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmi-cec.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmi-cec.c @@ -172,9 +172,9 @@ static ssize_t cec_state_show(struct device *dev, } static struct device_attribute cec_attrs[] = { - __ATTR(logic, 0666, cec_logic_show, cec_logic_store), - __ATTR(phy, 0666, cec_phy_show, cec_phy_store), - __ATTR(enable, 0666, cec_enable_show, cec_enable_store), + __ATTR(logic, S_IRUGO | S_IWUSR, cec_logic_show, cec_logic_store), + __ATTR(phy, S_IRUGO | S_IWUSR, cec_phy_show, cec_phy_store), + __ATTR(enable, S_IRUGO | S_IWUSR, cec_enable_show, cec_enable_store), __ATTR(stat, S_IRUGO, cec_state_show, NULL), }; diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi-core.c b/drivers/video/rockchip/hdmi/rockchip-hdmi-core.c index 1696c0405965..344f23691e37 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmi-core.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmi-core.c @@ -645,10 +645,12 @@ int snd_config_hdmi_audio(struct snd_pcm_hw_params *params) audio_cfg.rate = rate; - if (params->flags == HW_PARAMS_FLAG_NLPCM) - audio_cfg.type = HDMI_AUDIO_NLPCM; - else - audio_cfg.type = HDMI_AUDIO_LPCM; + /* + *if (params->flags == HW_PARAMS_FLAG_NLPCM) + * audio_cfg.type = HDMI_AUDIO_NLPCM; + *else + */ + audio_cfg.type = HDMI_AUDIO_LPCM; audio_cfg.channel = params_channels(params); audio_cfg.word_length = HDMI_AUDIO_WORD_LENGTH_16bit; diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmi-edid.c b/drivers/video/rockchip/hdmi/rockchip-hdmi-edid.c index 1025433ebcd8..6ce7171bf45a 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmi-edid.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmi-edid.c @@ -1,5 +1,5 @@ #include "rockchip-hdmi.h" -#include "../../edid.h" +#include "../../fbdev/edid.h" #ifdef EDIDDEBUG #define EDBG DBG @@ -368,6 +368,7 @@ static int hdmi_edid_parse_extensions_cea(unsigned char *buf, { unsigned int ddc_offset, native_dtd_num, cur_offset = 4; unsigned int tag, IEEEOUI = 0, count, i; + struct fb_videomode *vmode; if (!buf) return E_HDMI_EDID_PARAM; @@ -457,8 +458,7 @@ static int hdmi_edid_parse_extensions_cea(unsigned char *buf, } /* Parse DTD */ - struct fb_videomode *vmode = - kmalloc(sizeof(struct fb_videomode), GFP_KERNEL); + vmode = kmalloc(sizeof(*vmode), GFP_KERNEL); if (!vmode) return E_HDMI_EDID_SUCCESS; @@ -472,7 +472,6 @@ static int hdmi_edid_parse_extensions_cea(unsigned char *buf, } kfree(vmode); -#endif return E_HDMI_EDID_SUCCESS; } diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv1/rockchip_hdmiv1.c b/drivers/video/rockchip/hdmi/rockchip-hdmiv1/rockchip_hdmiv1.c index c2b80280a0bf..bcc01b5f3070 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv1/rockchip_hdmiv1.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv1/rockchip_hdmiv1.c @@ -357,7 +357,7 @@ static int rockchip_hdmiv1_probe(struct platform_device *pdev) ret = devm_request_irq(hdmi_dev->hdmi->dev, hdmi_dev->irq, rockchip_hdmiv1_irq_func, - IRQF_TRIGGER_HIGH | IRQF_DISABLED, + IRQF_TRIGGER_HIGH, dev_name(hdmi_dev->hdmi->dev), hdmi_dev->hdmi); if (ret) { diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c index f82100c83406..6850b8ed18c9 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -224,15 +225,7 @@ static int rockchip_hdmiv2_clk_enable(struct hdmi_dev *hdmi_dev) hdmi_dev->clk_on |= HDMI_EXT_PHY_CLK_ON; } } else if ((hdmi_dev->clk_on & HDMI_PD_ON) == 0) { - if (!hdmi_dev->pd) { - hdmi_dev->pd = devm_clk_get(hdmi_dev->dev, "pd_hdmi"); - if (IS_ERR(hdmi_dev->pd)) { - dev_err(hdmi_dev->dev, - "Unable to get hdmi pd\n"); - return -1; - } - } - clk_prepare_enable(hdmi_dev->pd); + pm_runtime_get_sync(hdmi_dev->dev); hdmi_dev->clk_on |= HDMI_PD_ON; } @@ -286,8 +279,8 @@ static int rockchip_hdmiv2_clk_disable(struct hdmi_dev *hdmi_dev) if (hdmi_dev->clk_on == 0) return 0; - if ((hdmi_dev->clk_on & HDMI_PD_ON) && (hdmi_dev->pd)) { - clk_disable_unprepare(hdmi_dev->pd); + if ((hdmi_dev->clk_on & HDMI_PD_ON)) { + pm_runtime_put(hdmi_dev->dev); hdmi_dev->clk_on &= ~HDMI_PD_ON; } @@ -548,7 +541,7 @@ static int rockchip_hdmiv2_probe(struct platform_device *pdev) dev_err(&pdev->dev, "failed to get hdmi reset: %d\n", ret); goto failed; } - + pm_runtime_enable(hdmi_dev->dev); /*enable pd and pclk and hdcp_clk*/ if (rockchip_hdmiv2_clk_enable(hdmi_dev) < 0) { ret = -ENXIO; @@ -585,10 +578,12 @@ static int rockchip_hdmiv2_probe(struct platform_device *pdev) SUPPORT_YCBCR_INPUT | SUPPORT_1080I | SUPPORT_480I_576I; - if (rockchip_get_cpu_version()) - rk_hdmi_property.feature |= - SUPPORT_YUV420 | - SUPPORT_DEEP_10BIT; + /* + *if (rockchip_get_cpu_version()) + * rk_hdmi_property.feature |= + * SUPPORT_YUV420 | + * SUPPORT_DEEP_10BIT; + */ } 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 b22eaa3f2796..ec80cdbdde9f 100755 --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c @@ -673,7 +673,7 @@ static int ext_phy_config(struct hdmi_dev *hdmi_dev) if ((stat & EXT_PHY_PPLL_LOCK_STATUS_MASK) == 0) { stat = hdmi_readl(hdmi_dev, MC_LOCKONCLOCK); dev_err(hdmi_dev->hdmi->dev, - "PHY PLL not locked: PCLK_ON=%d,TMDSCLK_ON=%d\n", + "PHY PLL not locked: PCLK_ON=%ld,TMDSCLK_ON=%ld\n", (stat & m_PCLK_ON) >> 6, (stat & m_TMDSCLK_ON) >> 5); return -1; } @@ -803,7 +803,7 @@ static int rockchip_hdmiv2_config_phy(struct hdmi_dev *hdmi_dev) if ((stat & m_PHY_LOCK) == 0) { stat = hdmi_readl(hdmi_dev, MC_LOCKONCLOCK); dev_err(hdmi_dev->hdmi->dev, - "PHY PLL not locked: PCLK_ON=%d,TMDSCLK_ON=%d\n", + "PHY PLL not locked: PCLK_ON=%ld,TMDSCLK_ON=%ld\n", (stat & m_PCLK_ON) >> 6, (stat & m_TMDSCLK_ON) >> 5); return -1; } diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.h b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.h index ad85e6a6c1b6..af3b834215f1 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.h +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.h @@ -1662,6 +1662,13 @@ struct phy_mpll_config_tab { #define RK322X_PLL_PDATA_DEN BIT(11 + 16) #define RK322X_PLL_PDATA_EN (BIT(11) | BIT(11 + 16)) +#ifndef RK322X_GRF_SOC_CON2 +#define RK322X_GRF_SOC_CON2 RK3228_GRF_SOC_CON2 +#endif +#ifndef RK322X_GRF_SOC_CON6 +#define RK322X_GRF_SOC_CON6 RK3228_GRF_SOC_CON6 +#endif + struct ext_pll_config_tab { u32 pix_clock; u32 tmdsclock; -- 2.34.1