diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2014-12-12 11:32:51 +0100 |
---|---|---|
committer | Stefan Agner <stefan.agner@toradex.com> | 2014-12-12 11:32:51 +0100 |
commit | 118a17e4a8d9f91cc7c72e6f02134f17a0198ca2 (patch) | |
tree | f46d5adabc343b890da8ff890cd6043e4421cc4f /drivers/video/fbdev/fsl-dcu-fb.c | |
parent | 2c77d4d1b05ba11859703bd1fc1566098abac185 (diff) |
video: fsl-dcu-fb: add suspend/resume support
Add suspend and resume support which disables the panel completely.
Tested with the main frame buffer instance (fb0).
Diffstat (limited to 'drivers/video/fbdev/fsl-dcu-fb.c')
-rw-r--r-- | drivers/video/fbdev/fsl-dcu-fb.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/video/fbdev/fsl-dcu-fb.c b/drivers/video/fbdev/fsl-dcu-fb.c index 78a534fcfefb..9c7e9b8cf31e 100644 --- a/drivers/video/fbdev/fsl-dcu-fb.c +++ b/drivers/video/fbdev/fsl-dcu-fb.c @@ -22,6 +22,7 @@ #include <video/of_display_timing.h> #include <video/videomode.h> #include <linux/pm_runtime.h> +#include <linux/console.h> #define DRIVER_NAME "fsl-dcu-fb" @@ -968,6 +969,42 @@ static int fsl_dcu_runtime_resume(struct device *dev) } #endif +#ifdef CONFIG_PM_SLEEP +static int fsl_dcu_suspend(struct device *dev) +{ + struct dcu_fb_data *dcufb = dev_get_drvdata(dev); + struct fb_info *fbi = dcufb->fsl_dcu_info[0]; + + console_lock(); + fb_set_suspend(fbi, 1); + console_unlock(); + + disable_panel(fbi); + + disable_controller(dcufb->fsl_dcu_info[0]); + clk_disable_unprepare(dcufb->clk); + + return 0; +} + +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]; + + clk_prepare_enable(dcufb->clk); + enable_controller(dcufb->fsl_dcu_info[0]); + + console_lock(); + fb_set_suspend(fbi, 0); + console_unlock(); + + fsl_dcu_set_par(fbi); + + return 0; +} +#endif + static int bypass_tcon(struct device_node *np) { struct device_node *tcon_np; @@ -998,6 +1035,7 @@ static int bypass_tcon(struct device_node *np) return PTR_ERR(tcon_reg); writel(TCON_BYPASS_ENABLE, tcon_reg + TCON_CTRL1); + clk_disable_unprepare(tcon_clk); return 0; } @@ -1147,6 +1185,7 @@ static int fsl_dcu_remove(struct platform_device *pdev) static const struct dev_pm_ops fsl_dcu_pm_ops = { SET_RUNTIME_PM_OPS(fsl_dcu_runtime_suspend, fsl_dcu_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(fsl_dcu_suspend, fsl_dcu_resume) }; static struct of_device_id fsl_dcu_dt_ids[] = { |