From: Thomas Zimmermann Date: Wed, 8 Apr 2026 12:03:18 +0000 (+0200) Subject: drm/sysfb: vesadrm: Support power management X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=c813bdae379f95145c77be0ef075e28efd082af7;p=thirdparty%2Flinux.git drm/sysfb: vesadrm: Support power management Set PM ops for the vesadrm 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-6-tzimmermann@suse.de --- diff --git a/drivers/gpu/drm/sysfb/vesadrm.c b/drivers/gpu/drm/sysfb/vesadrm.c index 4e00113e5c77..255b90a200b0 100644 --- a/drivers/gpu/drm/sysfb/vesadrm.c +++ b/drivers/gpu/drm/sysfb/vesadrm.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -21,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -617,6 +619,22 @@ static struct drm_driver vesadrm_driver = { * Platform driver */ +static int vesadrm_pm_suspend(struct device *dev) +{ + struct drm_device *drm = dev_get_drvdata(dev); + + return drm_mode_config_helper_suspend(drm); +} + +static int vesadrm_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(vesadrm_pm_ops, vesadrm_pm_suspend, vesadrm_pm_resume); + static int vesadrm_probe(struct platform_device *pdev) { struct vesadrm_device *vesa; @@ -649,6 +667,7 @@ static void vesadrm_remove(struct platform_device *pdev) static struct platform_driver vesadrm_platform_driver = { .driver = { .name = "vesa-framebuffer", + .pm = pm_sleep_ptr(&vesadrm_pm_ops), }, .probe = vesadrm_probe, .remove = vesadrm_remove,