Commit d6bff5b0 authored by Paul Cercueil's avatar Paul Cercueil

drm/ingenic: Add basic PM support

Call drm_mode_config_helper_suspend() and
drm_mode_config_helper_resume() on suspend and resume, respectively.

This makes sure that the display stack is properly disabled when the
hardware is put to sleep.
Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20201128171606.132830-1-paul@crapouillou.net
parent 57fcd550
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_reserved_mem.h> #include <linux/of_reserved_mem.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <drm/drm_atomic.h> #include <drm/drm_atomic.h>
...@@ -1167,6 +1168,22 @@ static int ingenic_drm_remove(struct platform_device *pdev) ...@@ -1167,6 +1168,22 @@ static int ingenic_drm_remove(struct platform_device *pdev)
return 0; return 0;
} }
static int __maybe_unused ingenic_drm_suspend(struct device *dev)
{
struct ingenic_drm *priv = dev_get_drvdata(dev);
return drm_mode_config_helper_suspend(&priv->drm);
}
static int __maybe_unused ingenic_drm_resume(struct device *dev)
{
struct ingenic_drm *priv = dev_get_drvdata(dev);
return drm_mode_config_helper_resume(&priv->drm);
}
static SIMPLE_DEV_PM_OPS(ingenic_drm_pm_ops, ingenic_drm_suspend, ingenic_drm_resume);
static const u32 jz4740_formats[] = { static const u32 jz4740_formats[] = {
DRM_FORMAT_XRGB1555, DRM_FORMAT_XRGB1555,
DRM_FORMAT_RGB565, DRM_FORMAT_RGB565,
...@@ -1246,6 +1263,7 @@ MODULE_DEVICE_TABLE(of, ingenic_drm_of_match); ...@@ -1246,6 +1263,7 @@ MODULE_DEVICE_TABLE(of, ingenic_drm_of_match);
static struct platform_driver ingenic_drm_driver = { static struct platform_driver ingenic_drm_driver = {
.driver = { .driver = {
.name = "ingenic-drm", .name = "ingenic-drm",
.pm = pm_ptr(&ingenic_drm_pm_ops),
.of_match_table = of_match_ptr(ingenic_drm_of_match), .of_match_table = of_match_ptr(ingenic_drm_of_match),
}, },
.probe = ingenic_drm_probe, .probe = ingenic_drm_probe,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment