diff mbox

[v2] drm: hdlcd: Update PM code to save/restore console.

Message ID 20170619135341.4357-1-Liviu.Dudau@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Liviu Dudau June 19, 2017, 1:53 p.m. UTC
Update the PM code to suspend/resume the fbdev_cma console.

Changelog:
- v2: Use drm_fbdev_cma_set_suspend_unlocked() function for taking the
      console lock (suggested by Noralf Trønnes <noralf@tronnes.org>)
- v1: Initial submission [1]


[1] https://lists.freedesktop.org/archives/dri-devel/2017-June/144502.html

Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
---
 drivers/gpu/drm/arm/hdlcd_drv.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Noralf Trønnes June 19, 2017, 3:47 p.m. UTC | #1
Den 19.06.2017 15.53, skrev Liviu Dudau:
> Update the PM code to suspend/resume the fbdev_cma console.
>
> Changelog:
> - v2: Use drm_fbdev_cma_set_suspend_unlocked() function for taking the
>        console lock (suggested by Noralf Trønnes <noralf@tronnes.org>)
> - v1: Initial submission [1]
>
>
> [1] https://lists.freedesktop.org/archives/dri-devel/2017-June/144502.html
>
> Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
> ---
>   drivers/gpu/drm/arm/hdlcd_drv.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> index d3da87fbd85a..11ecda211f7f 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> @@ -13,6 +13,7 @@
>   #include <linux/spinlock.h>
>   #include <linux/clk.h>
>   #include <linux/component.h>
> +#include <linux/console.h>

This include isn't necessary now.

Noralf.

>   #include <linux/list.h>
>   #include <linux/of_graph.h>
>   #include <linux/of_reserved_mem.h>
> @@ -435,9 +436,11 @@ static int __maybe_unused hdlcd_pm_suspend(struct device *dev)
>   		return 0;
>   
>   	drm_kms_helper_poll_disable(drm);
> +	drm_fbdev_cma_set_suspend_unlocked(hdlcd->fbdev, 1);
>   
>   	hdlcd->state = drm_atomic_helper_suspend(drm);
>   	if (IS_ERR(hdlcd->state)) {
> +		drm_fbdev_cma_set_suspend_unlocked(hdlcd->fbdev, 0);
>   		drm_kms_helper_poll_enable(drm);
>   		return PTR_ERR(hdlcd->state);
>   	}
> @@ -454,8 +457,8 @@ static int __maybe_unused hdlcd_pm_resume(struct device *dev)
>   		return 0;
>   
>   	drm_atomic_helper_resume(drm, hdlcd->state);
> +	drm_fbdev_cma_set_suspend_unlocked(hdlcd->fbdev, 0);
>   	drm_kms_helper_poll_enable(drm);
> -	pm_runtime_set_active(dev);
>   
>   	return 0;
>   }
Liviu Dudau June 19, 2017, 4:16 p.m. UTC | #2
On Mon, Jun 19, 2017 at 05:47:07PM +0200, Noralf Trønnes wrote:
> 
> Den 19.06.2017 15.53, skrev Liviu Dudau:
> > Update the PM code to suspend/resume the fbdev_cma console.
> > 
> > Changelog:
> > - v2: Use drm_fbdev_cma_set_suspend_unlocked() function for taking the
> >        console lock (suggested by Noralf Trønnes <noralf@tronnes.org>)
> > - v1: Initial submission [1]
> > 
> > 
> > [1] https://lists.freedesktop.org/archives/dri-devel/2017-June/144502.html
> > 
> > Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
> > ---
> >   drivers/gpu/drm/arm/hdlcd_drv.c | 5 ++++-
> >   1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> > index d3da87fbd85a..11ecda211f7f 100644
> > --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> > +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> > @@ -13,6 +13,7 @@
> >   #include <linux/spinlock.h>
> >   #include <linux/clk.h>
> >   #include <linux/component.h>
> > +#include <linux/console.h>
> 
> This include isn't necessary now.

Ah, thanks for catching this!

Will respin. Also, Brian pointed out that while the pm_runtime_set_active() call being
removed is the right thing to do, it is not necessarily done in the right patch, so I
need to figure out if I need another patch that does more tweaks to the pm_runtime.

Best regards,
Liviu

> 
> Noralf.
> 
> >   #include <linux/list.h>
> >   #include <linux/of_graph.h>
> >   #include <linux/of_reserved_mem.h>
> > @@ -435,9 +436,11 @@ static int __maybe_unused hdlcd_pm_suspend(struct device *dev)
> >   		return 0;
> >   	drm_kms_helper_poll_disable(drm);
> > +	drm_fbdev_cma_set_suspend_unlocked(hdlcd->fbdev, 1);
> >   	hdlcd->state = drm_atomic_helper_suspend(drm);
> >   	if (IS_ERR(hdlcd->state)) {
> > +		drm_fbdev_cma_set_suspend_unlocked(hdlcd->fbdev, 0);
> >   		drm_kms_helper_poll_enable(drm);
> >   		return PTR_ERR(hdlcd->state);
> >   	}
> > @@ -454,8 +457,8 @@ static int __maybe_unused hdlcd_pm_resume(struct device *dev)
> >   		return 0;
> >   	drm_atomic_helper_resume(drm, hdlcd->state);
> > +	drm_fbdev_cma_set_suspend_unlocked(hdlcd->fbdev, 0);
> >   	drm_kms_helper_poll_enable(drm);
> > -	pm_runtime_set_active(dev);
> >   	return 0;
> >   }
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index d3da87fbd85a..11ecda211f7f 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -13,6 +13,7 @@ 
 #include <linux/spinlock.h>
 #include <linux/clk.h>
 #include <linux/component.h>
+#include <linux/console.h>
 #include <linux/list.h>
 #include <linux/of_graph.h>
 #include <linux/of_reserved_mem.h>
@@ -435,9 +436,11 @@  static int __maybe_unused hdlcd_pm_suspend(struct device *dev)
 		return 0;
 
 	drm_kms_helper_poll_disable(drm);
+	drm_fbdev_cma_set_suspend_unlocked(hdlcd->fbdev, 1);
 
 	hdlcd->state = drm_atomic_helper_suspend(drm);
 	if (IS_ERR(hdlcd->state)) {
+		drm_fbdev_cma_set_suspend_unlocked(hdlcd->fbdev, 0);
 		drm_kms_helper_poll_enable(drm);
 		return PTR_ERR(hdlcd->state);
 	}
@@ -454,8 +457,8 @@  static int __maybe_unused hdlcd_pm_resume(struct device *dev)
 		return 0;
 
 	drm_atomic_helper_resume(drm, hdlcd->state);
+	drm_fbdev_cma_set_suspend_unlocked(hdlcd->fbdev, 0);
 	drm_kms_helper_poll_enable(drm);
-	pm_runtime_set_active(dev);
 
 	return 0;
 }