[PATCH] drm: mxsfb: Add PM support to MXSFB
Marek Vasut
marex at denx.de
Thu Dec 8 02:47:15 UTC 2016
Add simple PM hooks into the MXSFB controller to allow proper suspend
both of the controller and optionally an attached panel.
Signed-off-by: Marek Vasut <marex at denx.de>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Cc: Dave Airlie <airlied at redhat.com>
Cc: Stefan Agner <stefan at agner.ch>
---
drivers/gpu/drm/mxsfb/mxsfb_drv.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 79a18bf..e4eecb3 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -427,12 +427,49 @@ static int mxsfb_remove(struct platform_device *pdev)
return 0;
}
+static int __maybe_unused mxsfb_pm_suspend(struct device *dev)
+{
+ struct drm_device *drm = dev_get_drvdata(dev);
+ struct mxsfb_drm_private *mxsfb = drm ? drm->dev_private : NULL;
+
+ if (!mxsfb)
+ return 0;
+
+ drm_kms_helper_poll_disable(drm);
+
+ mxsfb->state = drm_atomic_helper_suspend(drm);
+ if (IS_ERR(mxsfb->state)) {
+ drm_kms_helper_poll_enable(drm);
+ return PTR_ERR(mxsfb->state);
+ }
+
+ return 0;
+}
+
+static int __maybe_unused mxsfb_pm_resume(struct device *dev)
+{
+ struct drm_device *drm = dev_get_drvdata(dev);
+ struct mxsfb_drm_private *mxsfb = drm ? drm->dev_private : NULL;
+
+ if (!mxsfb)
+ return 0;
+
+ drm_atomic_helper_resume(drm, mxsfb->state);
+ drm_kms_helper_poll_enable(drm);
+ pm_runtime_set_active(dev);
+
+ return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(mxsfb_pm_ops, mxsfb_pm_suspend, mxsfb_pm_resume);
+
static struct platform_driver mxsfb_platform_driver = {
.probe = mxsfb_probe,
.remove = mxsfb_remove,
.id_table = mxsfb_devtype,
.driver = {
.name = "mxsfb",
+ .pm = &mxsfb_pm_ops,
.of_match_table = mxsfb_dt_ids,
},
};
--
2.10.2
More information about the dri-devel
mailing list