mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 04:37:32 -04:00
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 <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patch.msgid.link/20260408120722.328769-6-tzimmermann@suse.de
This commit is contained in:
@@ -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>
|
||||
@@ -21,6 +22,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>
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user