diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2015-08-05 18:03:58 +0200 |
---|---|---|
committer | Stefan Agner <stefan.agner@toradex.com> | 2015-08-05 18:03:58 +0200 |
commit | c1944bbc667e0b9ee65dce0e10b75fb9dc856291 (patch) | |
tree | cca82ff95a6e41b1969817d77ff195fef6a1ff8a /drivers/video | |
parent | 756ad5099e37fe0c3782236a53c7da885460c810 (diff) | |
parent | 2cb415fc83bc733147f015a3380fc4e1bafff389 (diff) |
Merge branch 'vf610-dcu-4.1' into toradex_vf_4.1-next
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/fbdev/fsl-dcu-fb.c | 81 |
1 files changed, 46 insertions, 35 deletions
diff --git a/drivers/video/fbdev/fsl-dcu-fb.c b/drivers/video/fbdev/fsl-dcu-fb.c index bdc034285b67..df40920206ec 100644 --- a/drivers/video/fbdev/fsl-dcu-fb.c +++ b/drivers/video/fbdev/fsl-dcu-fb.c @@ -1015,6 +1015,42 @@ static int fsl_dcu_runtime_resume(struct device *dev) } #endif +static int bypass_tcon(struct device_node *np) +{ + struct device_node *tcon_np; + struct platform_device *tcon_pdev; + struct clk *tcon_clk; + struct resource *res; + void __iomem *tcon_reg; + + tcon_np = of_parse_phandle(np, "tcon-controller", 0); + if (!tcon_np) + return -EINVAL; + + tcon_pdev = of_find_device_by_node(tcon_np); + if (!tcon_pdev) + return -EINVAL; + + tcon_clk = devm_clk_get(&tcon_pdev->dev, "tcon"); + if (IS_ERR(tcon_clk)) + return PTR_ERR(tcon_clk); + clk_prepare_enable(tcon_clk); + + res = platform_get_resource(tcon_pdev, IORESOURCE_MEM, 0); + if (!res) + return -ENODEV; + + tcon_reg = ioremap(res->start, resource_size(res)); + if (IS_ERR(tcon_reg)) + return PTR_ERR(tcon_reg); + + writel(TCON_BYPASS_ENABLE, tcon_reg + TCON_CTRL1); + + iounmap(tcon_reg); + clk_disable_unprepare(tcon_clk); + return 0; +} + #ifdef CONFIG_PM_SLEEP static int fsl_dcu_suspend(struct device *dev) { @@ -1037,8 +1073,16 @@ static int fsl_dcu_resume(struct device *dev) { struct dcu_fb_data *dcufb = dev_get_drvdata(dev); struct fb_info *fbi = dcufb->fsl_dcu_info[0]; + int ret; clk_prepare_enable(dcufb->clk); + + ret = bypass_tcon(dev->of_node); + if (ret) { + dev_err(dev, "could not bypass TCON\n"); + goto failed_bypasstcon; + } + enable_controller(dcufb->fsl_dcu_info[0]); console_lock(); @@ -1047,44 +1091,11 @@ static int fsl_dcu_resume(struct device *dev) fsl_dcu_set_par(fbi); - return 0; +failed_bypasstcon: + return ret; } #endif -static int bypass_tcon(struct device_node *np) -{ - struct device_node *tcon_np; - struct platform_device *tcon_pdev; - struct clk *tcon_clk; - struct resource *res; - void __iomem *tcon_reg; - - tcon_np = of_parse_phandle(np, "tcon-controller", 0); - if (!tcon_np) - return -EINVAL; - - tcon_pdev = of_find_device_by_node(tcon_np); - if (!tcon_pdev) - return -EINVAL; - - tcon_clk = devm_clk_get(&tcon_pdev->dev, "tcon"); - if (IS_ERR(tcon_clk)) - return PTR_ERR(tcon_clk); - clk_prepare_enable(tcon_clk); - - res = platform_get_resource(tcon_pdev, IORESOURCE_MEM, 0); - if (!res) - return -ENODEV; - - tcon_reg = devm_ioremap_resource(&tcon_pdev->dev, res); - if (IS_ERR(tcon_reg)) - return PTR_ERR(tcon_reg); - - writel(TCON_BYPASS_ENABLE, tcon_reg + TCON_CTRL1); - clk_disable_unprepare(tcon_clk); - return 0; -} - static int fsl_dcu_probe(struct platform_device *pdev) { struct dcu_fb_data *dcufb; |