Commit f0525a1c authored by Leonard Crestez's avatar Leonard Crestez Committed by Stefan Agner

drm/mxsfb: Add PM_SLEEP support

Since power to the lcdif block can be lost on suspend implement
PM_SLEEP_OPS using drm_mode_config_helper_suspend/resume to save/restore
the current mode.
Signed-off-by: default avatarLeonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: default avatarStefan Agner <stefan@agner.ch>
Reviewed-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/cfa1a4083eefd112362e640deeb2e120584ac3f5.1537191359.git.leonard.crestez@nxp.com
parent 4201f4e8
...@@ -418,6 +418,26 @@ static int mxsfb_remove(struct platform_device *pdev) ...@@ -418,6 +418,26 @@ static int mxsfb_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_PM_SLEEP
static int mxsfb_suspend(struct device *dev)
{
struct drm_device *drm = dev_get_drvdata(dev);
return drm_mode_config_helper_suspend(drm);
}
static int mxsfb_resume(struct device *dev)
{
struct drm_device *drm = dev_get_drvdata(dev);
return drm_mode_config_helper_resume(drm);
}
#endif
static const struct dev_pm_ops mxsfb_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(mxsfb_suspend, mxsfb_resume)
};
static struct platform_driver mxsfb_platform_driver = { static struct platform_driver mxsfb_platform_driver = {
.probe = mxsfb_probe, .probe = mxsfb_probe,
.remove = mxsfb_remove, .remove = mxsfb_remove,
...@@ -425,6 +445,7 @@ static struct platform_driver mxsfb_platform_driver = { ...@@ -425,6 +445,7 @@ static struct platform_driver mxsfb_platform_driver = {
.driver = { .driver = {
.name = "mxsfb", .name = "mxsfb",
.of_match_table = mxsfb_dt_ids, .of_match_table = mxsfb_dt_ids,
.pm = &mxsfb_pm_ops,
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment