summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/sysfb
diff options
context:
space:
mode:
authorThomas Zimmermann <tzimmermann@suse.de>2026-04-08 14:03:16 +0200
committerThomas Zimmermann <tzimmermann@suse.de>2026-05-04 14:30:59 +0200
commit41820323cc0f22d6e6b0385c22b4cb85ec0cb722 (patch)
tree6f771ae9fe2333694cf4925b426ee56ebf22b0a2 /drivers/gpu/drm/sysfb
parent38699486318e5b6b423aabd35476c37580f2a0ec (diff)
downloadlwn-41820323cc0f22d6e6b0385c22b4cb85ec0cb722.tar.gz
lwn-41820323cc0f22d6e6b0385c22b4cb85ec0cb722.zip
drm/sysfb: ofdrm: Support power management
Set PM ops for the ofdrm driver. Suspend and resume the DRM state on systems that support it. Many systems lose the hardware's framebuffer settings on suspend, hence resuming doesn't work there. Yet some systems, most notably emulators, keep the hardware state across suspend/resume cycles. There, DRM's suspend and resume helpers bring back the display on resume. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patch.msgid.link/20260408120722.328769-4-tzimmermann@suse.de
Diffstat (limited to 'drivers/gpu/drm/sysfb')
-rw-r--r--drivers/gpu/drm/sysfb/ofdrm.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/drm/sysfb/ofdrm.c b/drivers/gpu/drm/sysfb/ofdrm.c
index d38ba70f4e0d..8822ebcbc081 100644
--- a/drivers/gpu/drm/sysfb/ofdrm.c
+++ b/drivers/gpu/drm/sysfb/ofdrm.c
@@ -4,6 +4,7 @@
#include <linux/of_address.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
+#include <linux/pm.h>
#include <drm/clients/drm_client_setup.h>
#include <drm/drm_atomic.h>
@@ -20,6 +21,7 @@
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_gem_shmem_helper.h>
#include <drm/drm_managed.h>
+#include <drm/drm_modeset_helper.h>
#include <drm/drm_modeset_helper_vtables.h>
#include <drm/drm_print.h>
#include <drm/drm_probe_helper.h>
@@ -1095,6 +1097,22 @@ static struct drm_driver ofdrm_driver = {
* Platform driver
*/
+static int ofdrm_pm_suspend(struct device *dev)
+{
+ struct drm_device *drm = dev_get_drvdata(dev);
+
+ return drm_mode_config_helper_suspend(drm);
+}
+
+static int ofdrm_pm_resume(struct device *dev)
+{
+ struct drm_device *drm = dev_get_drvdata(dev);
+
+ return drm_mode_config_helper_resume(drm);
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(ofdrm_pm_ops, ofdrm_pm_suspend, ofdrm_pm_resume);
+
static int ofdrm_probe(struct platform_device *pdev)
{
struct ofdrm_device *odev;
@@ -1134,6 +1152,7 @@ static struct platform_driver ofdrm_platform_driver = {
.driver = {
.name = "of-display",
.of_match_table = ofdrm_of_match_display,
+ .pm = pm_sleep_ptr(&ofdrm_pm_ops),
},
.probe = ofdrm_probe,
.remove = ofdrm_remove,