Skip to contentSkip to conversation

drm/ingenic: Add basic PM support

PATCH In review Paul Cercueil 2 participants 3 messages Nov 28, 2020

Subsystems (3)
lore
Share & tools
lore

Paul Cercueil

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +20 -0
index 368bfef8b340..818a0e4f5bfe 100644
@@ -14,6 +14,7 @@
 #include <linux/of_device.h>
 #include <linux/of_reserved_mem.h>
 #include <linux/platform_device.h>
+#include <linux/pm.h>
 #include <linux/regmap.h>
 
 #include <drm/drm_atomic.h>
@@ -1167,6 +1168,24 @@ static int ingenic_drm_remove(struct platform_device *pdev)
 	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);
+
+	drm_mode_config_helper_resume(&priv->drm);
+
+	return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(ingenic_drm_pm_ops, ingenic_drm_suspend, ingenic_drm_resume);
+
 static const u32 jz4740_formats[] = {
 	DRM_FORMAT_XRGB1555,
 	DRM_FORMAT_RGB565,
@@ -1246,6 +1265,7 @@ MODULE_DEVICE_TABLE(of, ingenic_drm_of_match);
 static struct platform_driver ingenic_drm_driver = {
 	.driver = {
 		.name = "ingenic-drm",
+		.pm = pm_ptr(&ingenic_drm_pm_ops),
 		.of_match_table = of_match_ptr(ingenic_drm_of_match),
 	},
 	.probe = ingenic_drm_probe,
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw

Hi Paul.

Quoted 7 lines · Paul Cercueil

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.

As discussed on irc, with resume fixed to return the result of the drm_mode_config_helper_resume() call.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author maintainer
#2 lore raw
Quoted 9 lines · Sam Ravnborg

Hi Paul.

Quoted 6 lines · Paul Cercueil

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.

Quoted 6 lines
Quoted 1 line

As discussed on irc, with resume fixed to return the result of the drm_mode_config_helper_resume() call.

Applied with the fix, thanks.

Cheers,
-Paul