From 4c72ed2af6ff1453c32ea4d5af9be66e1b676809 Mon Sep 17 00:00:00 2001 From: xubilv Date: Sat, 16 May 2015 14:24:14 +0800 Subject: [PATCH] EDP: avoid repeatedly enable. Signed-off-by: xubilv --- drivers/video/rockchip/transmitter/rk32_dp.c | 83 ++++++++++---------- drivers/video/rockchip/transmitter/rk32_dp.h | 1 + 2 files changed, 43 insertions(+), 41 deletions(-) mode change 100644 => 100755 drivers/video/rockchip/transmitter/rk32_dp.h diff --git a/drivers/video/rockchip/transmitter/rk32_dp.c b/drivers/video/rockchip/transmitter/rk32_dp.c index f8345a7637b2..067d37c67d7f 100755 --- a/drivers/video/rockchip/transmitter/rk32_dp.c +++ b/drivers/video/rockchip/transmitter/rk32_dp.c @@ -1181,62 +1181,63 @@ static int rk32_edp_enable(void) int ret = 0; struct rk32_edp *edp = rk32_edp; + if (!edp->edp_en) { + rk32_edp_clk_enable(edp); + rk32_edp_pre_init(edp); + rk32_edp_init_edp(edp); + enable_irq(edp->irq); + /*ret = rk32_edp_handle_edid(edp); + if (ret) { + dev_err(edp->dev, "unable to handle edid\n"); + //goto out; + } - rk32_edp_clk_enable(edp); - rk32_edp_pre_init(edp); - rk32_edp_init_edp(edp); - enable_irq(edp->irq); - /*ret = rk32_edp_handle_edid(edp); - if (ret) { - dev_err(edp->dev, "unable to handle edid\n"); - //goto out; - } - - - ret = rk32_edp_enable_scramble(edp, 0); - if (ret) { - dev_err(edp->dev, "unable to set scramble\n"); - //goto out; - } + ret = rk32_edp_enable_scramble(edp, 0); + if (ret) { + dev_err(edp->dev, "unable to set scramble\n"); + //goto out; + } - ret = rk32_edp_enable_rx_to_enhanced_mode(edp, 0); - if (ret) { - dev_err(edp->dev, "unable to set enhanced mode\n"); - //goto out; - } - rk32_edp_enable_enhanced_mode(edp, 1);*/ + ret = rk32_edp_enable_rx_to_enhanced_mode(edp, 0); + if (ret) { + dev_err(edp->dev, "unable to set enhanced mode\n"); + //goto out; + } + rk32_edp_enable_enhanced_mode(edp, 1);*/ - ret = rk32_edp_set_link_train(edp); - if (ret) - dev_err(edp->dev, "link train failed!\n"); - else - dev_info(edp->dev, "link training success.\n"); + ret = rk32_edp_set_link_train(edp); + if (ret) + dev_err(edp->dev, "link train failed!\n"); + else + dev_info(edp->dev, "link training success.\n"); - rk32_edp_set_lane_count(edp, edp->link_train.lane_count); - rk32_edp_set_link_bandwidth(edp, edp->link_train.link_rate); - rk32_edp_init_video(edp); + rk32_edp_set_lane_count(edp, edp->link_train.lane_count); + rk32_edp_set_link_bandwidth(edp, edp->link_train.link_rate); + rk32_edp_init_video(edp); #ifdef EDP_BIST_MODE - rk32_edp_bist_cfg(edp); + rk32_edp_bist_cfg(edp); #endif - ret = rk32_edp_config_video(edp, &edp->video_info); - if (ret) - dev_err(edp->dev, "unable to config video\n"); + ret = rk32_edp_config_video(edp, &edp->video_info); + if (ret) + dev_err(edp->dev, "unable to config video\n"); + edp->edp_en = true; + } return ret; - - - } static int rk32_edp_disable(void) { struct rk32_edp *edp = rk32_edp; - disable_irq(edp->irq); - rk32_edp_reset(edp); - rk32_edp_analog_power_ctr(edp, 0); - rk32_edp_clk_disable(edp); + if (edp->edp_en) { + disable_irq(edp->irq); + rk32_edp_reset(edp); + rk32_edp_analog_power_ctr(edp, 0); + rk32_edp_clk_disable(edp); + edp->edp_en = false; + } return 0; } diff --git a/drivers/video/rockchip/transmitter/rk32_dp.h b/drivers/video/rockchip/transmitter/rk32_dp.h old mode 100644 new mode 100755 index a1c6909b1528..7e25f26c086a --- a/drivers/video/rockchip/transmitter/rk32_dp.h +++ b/drivers/video/rockchip/transmitter/rk32_dp.h @@ -531,6 +531,7 @@ struct rk32_edp { struct rk_screen screen; struct fb_monspecs specs; bool clk_on; + bool edp_en; struct dentry *debugfs_dir; }; -- 2.34.1