From: zwl Date: Sun, 30 Mar 2014 14:18:40 +0000 (+0800) Subject: rk3288-hdmi: fix resume failed and modify some phy para config X-Git-Tag: firefly_0821_release~5710^2 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=060776dcbccef872fb428ec33c5d9eba396e777d;p=firefly-linux-kernel-4.4.55.git rk3288-hdmi: fix resume failed and modify some phy para config --- diff --git a/drivers/video/rockchip/hdmi/chips/rk3288/rk3288_hdmi.c b/drivers/video/rockchip/hdmi/chips/rk3288/rk3288_hdmi.c index 3ec29f552b09..e4e5cf49fdaa 100644 --- a/drivers/video/rockchip/hdmi/chips/rk3288/rk3288_hdmi.c +++ b/drivers/video/rockchip/hdmi/chips/rk3288/rk3288_hdmi.c @@ -142,6 +142,7 @@ struct hdmi* rk3288_hdmi_register_hdcp_callbacks( } #ifdef HDMI_INT_USE_POLL +#define HDMI_POLL_MDELAY 100 static void rk3288_poll_delay_work(struct work_struct *work) { struct hdmi *hdmi_drv = &hdmi_dev->driver; @@ -151,7 +152,7 @@ static void rk3288_poll_delay_work(struct work_struct *work) hdmi_irq(0, hdmi_drv); } if(hdmi_dev->irq == 0) { - queue_delayed_work(hdmi_drv->workqueue, &hdmi_dev->delay_work, 100); + queue_delayed_work(hdmi_drv->workqueue, &hdmi_dev->delay_work, msecs_to_jiffies(HDMI_POLL_MDELAY)); } } } @@ -190,10 +191,13 @@ static int rk3288_hdmi_drv_init(struct hdmi *hdmi_drv) return ret; } -static void rk3288_hdmi_early_suspend() +static void rk3288_hdmi_early_suspend(void) { struct hdmi *hdmi_drv = &hdmi_dev->driver; + if(hdmi_drv->suspend) + return; + hdmi_dbg(hdmi_drv->dev, "hdmi enter early suspend pwr %d state %d\n", hdmi_drv->pwr_mode, hdmi_drv->state); flush_delayed_work(&hdmi_drv->delay_work); mutex_lock(&hdmi_drv->enable_mutex); @@ -214,17 +218,24 @@ static void rk3288_hdmi_early_suspend() return; } -static void rk3288_hdmi_early_resume() +static void rk3288_hdmi_early_resume(void) { struct hdmi *hdmi_drv = &hdmi_dev->driver; + if(!hdmi_drv->suspend) + return; + hdmi_dbg(hdmi_drv->dev, "hdmi enter early resume\n"); mutex_lock(&hdmi_drv->enable_mutex); hdmi_drv->suspend = 0; rk3288_hdmi_initial(hdmi_drv); - if(hdmi_drv->enable) { + if(hdmi_dev->irq == 0){ + queue_delayed_work(hdmi_drv->workqueue, &hdmi_dev->delay_work, msecs_to_jiffies(HDMI_POLL_MDELAY / 2)); + } + else if(hdmi_drv->enable){ enable_irq(hdmi_drv->irq); } + queue_delayed_work(hdmi_drv->workqueue, &hdmi_drv->delay_work, msecs_to_jiffies(10)); mutex_unlock(&hdmi_drv->enable_mutex); return; } diff --git a/drivers/video/rockchip/hdmi/chips/rk3288/rk3288_hdmi_hw.c b/drivers/video/rockchip/hdmi/chips/rk3288/rk3288_hdmi_hw.c index 4e0ff08ccfe2..e89d9ac07a02 100644 --- a/drivers/video/rockchip/hdmi/chips/rk3288/rk3288_hdmi_hw.c +++ b/drivers/video/rockchip/hdmi/chips/rk3288/rk3288_hdmi_hw.c @@ -5,9 +5,9 @@ static const struct phy_mpll_config_tab PHY_MPLL_TABLE[] = { //opmode: 0:HDMI1.4 1:HDMI2.0 // |pixclock|pixrepet|colordepth|prepdiv|tmdsmhl|opmode|fbdiv2|fbdiv1|ref_cntrl|nctrl|propctrl|intctrl|gmpctrl| - {27000000, 0, 8, 0, 0, 0, 2, 3, 0, 3, 3, 0, 0}, - {74250000, 0, 8, 0, 0, 0, 2, 3, 0, 3, 7, 0, 3}, - {148500000, 0, 8, 0, 0, 0, 1, 3, 0, 2, 7, 0, 3}, + {27000000, 0, 8, 0, 0, 0, 2, 3, 0, 3, 7, 0, 3}, + {74250000, 0, 8, 0, 0, 0, 4, 3, 3, 2, 7, 0, 3}, + {148500000, 0, 8, 0, 0, 0, 4, 3, 3, 2, 7, 0, 3}, {297000000, 0, 8, 0, 0, 0, 1, 3, 0, 2, 7, 0, 3}, {297000000, 0, 16, 3, 3, 1, 1, 1, 0, 0, 5, 0, 3}, {594000000, 0, 8, 0, 3, 1, 1, 0, 0, 0, 3, 0, 3}, @@ -471,7 +471,7 @@ static int rk3288_hdmi_write_phy(struct rk3288_hdmi_device *hdmi_dev, int reg_ad } msleep(100); #else - msleep(300); + msleep(50); return 0; #endif } @@ -508,7 +508,7 @@ int rk3288_hdmi_config_phy(struct hdmi *hdmi_drv) rk3288_hdmi_write_phy(hdmi_dev, PHYTX_PLLCURRCTRL, v_MPLL_PROP_CNTRL(phy_mpll->prop_cntrl) | v_MPLL_INT_CNTRL(phy_mpll->int_cntrl)); rk3288_hdmi_write_phy(hdmi_dev, PHYTX_PLLGMPCTRL, v_MPLL_GMP_CNTRL(phy_mpll->gmp_cntrl)); } - if(hdmi_drv->tmdsclk == 74250000) { + if(hdmi_drv->tmdsclk <= 74250000) { rk3288_hdmi_write_phy(hdmi_dev, PHYTX_CLKSYMCTRL, v_OVERRIDE(1) | v_SLOPEBOOST(0) | v_TX_SYMON(1) | v_TX_TRAON(0) | v_TX_TRBON(0) | v_CLK_SYMON(1)); rk3288_hdmi_write_phy(hdmi_dev, PHYTX_TERM_RESIS, v_TX_TERM(R100_Ohms)); @@ -547,7 +547,7 @@ int rk3288_hdmi_config_phy(struct hdmi *hdmi_drv) } if((stat & m_PHY_LOCK) == 0) { stat = hdmi_readl(hdmi_dev, MC_LOCKONCLOCK); - hdmi_err(hdmi_dev->dev, "PHY PLL not locked: PCLK_ON=%d,TMDSCLK_ON=%d\n", stat & m_PCLK_ON, stat & m_TMDSCLK_ON); + hdmi_err(hdmi_dev->dev, "PHY PLL not locked: PCLK_ON=%d,TMDSCLK_ON=%d\n", (stat & m_PCLK_ON) >> 6, (stat & m_TMDSCLK_ON) >> 5); return -1; }