video: rockchip: lcdc: 3366: add support power domain control

Change-Id: Ibb9d15e6e2a84a1847f4cfbbc8e75bca54e1782b
Signed-off-by: Huang Jiachai <hjc@rock-chips.com>
This commit is contained in:
Huang Jiachai 2016-03-11 16:00:20 +08:00 committed by Gerrit Code Review
parent 65fa879a39
commit d4a6147e3d
2 changed files with 17 additions and 2 deletions

View File

@ -167,6 +167,9 @@ static int rk3368_lcdc_clk_enable(struct lcdc_device *lcdc_dev)
clk_prepare_enable(lcdc_dev->aclk);
if (lcdc_dev->pd)
clk_prepare_enable(lcdc_dev->pd);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
pm_runtime_get_sync(lcdc_dev->dev);
#endif
spin_lock(&lcdc_dev->reg_lock);
lcdc_dev->clk_on = 1;
spin_unlock(&lcdc_dev->reg_lock);
@ -186,11 +189,14 @@ static int rk3368_lcdc_clk_disable(struct lcdc_device *lcdc_dev)
lcdc_dev->clk_on = 0;
spin_unlock(&lcdc_dev->reg_lock);
mdelay(25);
if (lcdc_dev->pd)
clk_disable_unprepare(lcdc_dev->pd);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
pm_runtime_put(lcdc_dev->dev);
#endif
clk_disable_unprepare(lcdc_dev->dclk);
clk_disable_unprepare(lcdc_dev->hclk);
clk_disable_unprepare(lcdc_dev->aclk);
if (lcdc_dev->pd)
clk_disable_unprepare(lcdc_dev->pd);
}
return 0;
@ -5008,6 +5014,10 @@ static int rk3368_lcdc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, lcdc_dev);
lcdc_dev->dev = dev;
rk3368_lcdc_parse_dt(lcdc_dev);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
/* enable power domain */
pm_runtime_enable(dev);
#endif
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
lcdc_dev->reg_phy_base = res->start;
lcdc_dev->len = resource_size(res);
@ -5120,6 +5130,9 @@ static void rk3368_lcdc_shutdown(struct platform_device *pdev)
dev_drv->trsm_ops->disable();*/
rk3368_lcdc_clk_disable(lcdc_dev);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0))
pm_runtime_disable(lcdc_dev->dev);
#endif
rk_disp_pwr_disable(dev_drv);
#else
rk3368_lcdc_early_suspend(&lcdc_dev->driver);

View File

@ -28,6 +28,8 @@
#include "../../drivers/staging/android/sw_sync.h"
#include <linux/file.h>
#include <linux/kthread.h>
#include <linux/pm_runtime.h>
#include <linux/version.h>
#define RK30_MAX_LCDC_SUPPORT 2