From: Thomas Zimmermann Date: Wed, 8 Apr 2026 12:03:15 +0000 (+0200) Subject: drm/sysfb: efidrm: Support power management X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=38699486318e5b6b423aabd35476c37580f2a0ec;p=thirdparty%2Fkernel%2Flinux.git drm/sysfb: efidrm: Support power management 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 Reviewed-by: Javier Martinez Canillas Link: https://patch.msgid.link/20260408120722.328769-3-tzimmermann@suse.de --- diff --git a/drivers/gpu/drm/sysfb/efidrm.c b/drivers/gpu/drm/sysfb/efidrm.c index a335c94a7bd75..1a1e367009760 100644 --- a/drivers/gpu/drm/sysfb/efidrm.c +++ b/drivers/gpu/drm/sysfb/efidrm.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -20,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -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,