From: Thomas Zimmermann Date: Wed, 8 Apr 2026 12:03:14 +0000 (+0200) Subject: drm/sysfb: corebootdrm: Support power management X-Git-Tag: v7.2-rc1~141^2~23^2~60 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=54068b05c85d75746034ef75721b240823cc872d;p=thirdparty%2Fkernel%2Flinux.git drm/sysfb: corebootdrm: Support power management Set PM ops for the corebootdrm 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-2-tzimmermann@suse.de --- diff --git a/drivers/gpu/drm/sysfb/corebootdrm.c b/drivers/gpu/drm/sysfb/corebootdrm.c index 5dc6f3c76f7bd..853da9a609dfb 100644 --- a/drivers/gpu/drm/sysfb/corebootdrm.c +++ b/drivers/gpu/drm/sysfb/corebootdrm.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include @@ -18,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -286,6 +288,24 @@ static struct drm_driver corebootdrm_drm_driver = { * Coreboot driver */ +static int corebootdrm_pm_suspend(struct device *dev) +{ + struct corebootdrm_device *cdev = dev_get_drvdata(dev); + struct drm_device *drm = &cdev->sysfb.dev; + + return drm_mode_config_helper_suspend(drm); +} + +static int corebootdrm_pm_resume(struct device *dev) +{ + struct corebootdrm_device *cdev = dev_get_drvdata(dev); + struct drm_device *drm = &cdev->sysfb.dev; + + return drm_mode_config_helper_resume(drm); +} + +static DEFINE_SIMPLE_DEV_PM_OPS(corebootdrm_pm_ops, corebootdrm_pm_suspend, corebootdrm_pm_resume); + static int corebootdrm_probe(struct platform_device *pdev) { const struct lb_framebuffer *fb = dev_get_platdata(&pdev->dev); @@ -423,6 +443,7 @@ static void corebootdrm_remove(struct platform_device *pdev) static struct platform_driver corebootdrm_platform_driver = { .driver = { .name = "coreboot-framebuffer", + .pm = pm_sleep_ptr(&corebootdrm_pm_ops), }, .probe = corebootdrm_probe, .remove = corebootdrm_remove,