summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorLeonard Crestez <leonard.crestez@nxp.com>2018-09-17 16:42:14 +0300
committerStefan Agner <stefan@agner.ch>2018-09-26 22:07:40 +0200
commitf0525a1c922eefe8cb1a23a026ea90bad400797e (patch)
tree5886f8809630d2903524cf50f078e0215d9e9585 /drivers/gpu/drm
parent4201f4e8484509499a40feb9fd6a6642f453f61e (diff)
downloadlwn-f0525a1c922eefe8cb1a23a026ea90bad400797e.tar.gz
lwn-f0525a1c922eefe8cb1a23a026ea90bad400797e.zip
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: Leonard Crestez <leonard.crestez@nxp.com> Reviewed-by: Stefan Agner <stefan@agner.ch> Reviewed-by: Sean Paul <seanpaul@chromium.org> Signed-off-by: Stefan Agner <stefan@agner.ch> Link: https://patchwork.freedesktop.org/patch/msgid/cfa1a4083eefd112362e640deeb2e120584ac3f5.1537191359.git.leonard.crestez@nxp.com
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/mxsfb/mxsfb_drv.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 68d79f5dc0d3..5199a1febc01 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -418,6 +418,26 @@ static int mxsfb_remove(struct platform_device *pdev)
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 = {
.probe = mxsfb_probe,
.remove = mxsfb_remove,
@@ -425,6 +445,7 @@ static struct platform_driver mxsfb_platform_driver = {
.driver = {
.name = "mxsfb",
.of_match_table = mxsfb_dt_ids,
+ .pm = &mxsfb_pm_ops,
},
};