All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/ingenic: Add basic PM support
@ 2020-11-28 17:16 ` Paul Cercueil
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Cercueil @ 2020-11-28 17:16 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter
  Cc: Sam Ravnborg, od, dri-devel, linux-kernel, 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.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index 368bfef8b340..818a0e4f5bfe 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -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,
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] drm/ingenic: Add basic PM support
@ 2020-11-28 17:16 ` Paul Cercueil
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Cercueil @ 2020-11-28 17:16 UTC (permalink / raw)
  To: David Airlie, Daniel Vetter
  Cc: Paul Cercueil, od, Sam Ravnborg, linux-kernel, dri-devel

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: Paul Cercueil <paul@crapouillou.net>
---
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index 368bfef8b340..818a0e4f5bfe 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -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,
-- 
2.29.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/ingenic: Add basic PM support
  2020-11-28 17:16 ` Paul Cercueil
@ 2020-11-28 18:58   ` Sam Ravnborg
  -1 siblings, 0 replies; 6+ messages in thread
From: Sam Ravnborg @ 2020-11-28 18:58 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: David Airlie, Daniel Vetter, od, dri-devel, linux-kernel

Hi Paul.

On Sat, Nov 28, 2020 at 05:16:06PM +0000, Paul Cercueil wrote:
> 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: Paul Cercueil <paul@crapouillou.net>

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

Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/ingenic: Add basic PM support
@ 2020-11-28 18:58   ` Sam Ravnborg
  0 siblings, 0 replies; 6+ messages in thread
From: Sam Ravnborg @ 2020-11-28 18:58 UTC (permalink / raw)
  To: Paul Cercueil; +Cc: David Airlie, od, dri-devel, linux-kernel

Hi Paul.

On Sat, Nov 28, 2020 at 05:16:06PM +0000, Paul Cercueil wrote:
> 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: Paul Cercueil <paul@crapouillou.net>

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

Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/ingenic: Add basic PM support
  2020-11-28 18:58   ` Sam Ravnborg
@ 2020-11-28 20:03     ` Paul Cercueil
  -1 siblings, 0 replies; 6+ messages in thread
From: Paul Cercueil @ 2020-11-28 20:03 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: David Airlie, Daniel Vetter, od, dri-devel, linux-kernel



Le sam. 28 nov. 2020 à 19:58, Sam Ravnborg <sam@ravnborg.org> a écrit 
:
> Hi Paul.
> 
> On Sat, Nov 28, 2020 at 05:16:06PM +0000, Paul Cercueil wrote:
>>  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: Paul Cercueil <paul@crapouillou.net>
> 
> As discussed on irc, with resume fixed to return the result of the
> drm_mode_config_helper_resume() call.
> 
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

Applied with the fix, thanks.

Cheers,
-Paul



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drm/ingenic: Add basic PM support
@ 2020-11-28 20:03     ` Paul Cercueil
  0 siblings, 0 replies; 6+ messages in thread
From: Paul Cercueil @ 2020-11-28 20:03 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: David Airlie, od, dri-devel, linux-kernel



Le sam. 28 nov. 2020 à 19:58, Sam Ravnborg <sam@ravnborg.org> a écrit 
:
> Hi Paul.
> 
> On Sat, Nov 28, 2020 at 05:16:06PM +0000, Paul Cercueil wrote:
>>  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: Paul Cercueil <paul@crapouillou.net>
> 
> As discussed on irc, with resume fixed to return the result of the
> drm_mode_config_helper_resume() call.
> 
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

Applied with the fix, thanks.

Cheers,
-Paul


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-11-30  1:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-28 17:16 [PATCH] drm/ingenic: Add basic PM support Paul Cercueil
2020-11-28 17:16 ` Paul Cercueil
2020-11-28 18:58 ` Sam Ravnborg
2020-11-28 18:58   ` Sam Ravnborg
2020-11-28 20:03   ` Paul Cercueil
2020-11-28 20:03     ` Paul Cercueil

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.