]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/sysfb: efidrm: Support power management
authorThomas Zimmermann <tzimmermann@suse.de>
Wed, 8 Apr 2026 12:03:15 +0000 (14:03 +0200)
committerThomas Zimmermann <tzimmermann@suse.de>
Mon, 4 May 2026 12:30:59 +0000 (14:30 +0200)
Set PM ops for the efidrm 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-3-tzimmermann@suse.de
drivers/gpu/drm/sysfb/efidrm.c

index a335c94a7bd7505ff32928d331e315618d011af9..1a1e367009760dfec24d837083e5f54d981cd88c 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/limits.h>
 #include <linux/platform_device.h>
 #include <linux/sysfb.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>
@@ -371,6 +373,22 @@ static struct drm_driver efidrm_driver = {
  * Platform driver
  */
 
+static int efidrm_pm_suspend(struct device *dev)
+{
+       struct drm_device *drm = dev_get_drvdata(dev);
+
+       return drm_mode_config_helper_suspend(drm);
+}
+
+static int efidrm_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(efidrm_pm_ops, efidrm_pm_suspend, efidrm_pm_resume);
+
 static int efidrm_probe(struct platform_device *pdev)
 {
        struct efidrm_device *efi;
@@ -403,6 +421,7 @@ static void efidrm_remove(struct platform_device *pdev)
 static struct platform_driver efidrm_platform_driver = {
        .driver = {
                .name = "efi-framebuffer",
+               .pm = pm_sleep_ptr(&efidrm_pm_ops),
        },
        .probe = efidrm_probe,
        .remove = efidrm_remove,