Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1667766 > unrolled thread

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

Started byLiviu Dudau <Liviu.Dudau@arm.com>
First post2017-06-16 16:00 +0200
Last post2017-06-19 18:20 +0200
Articles 7 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] drm: hdlcd: Update PM code to save/restore console. Liviu Dudau <Liviu.Dudau@arm.com> - 2017-06-16 16:00 +0200
    Re: [PATCH] drm: hdlcd: Update PM code to save/restore console. Noralf Trønnes <noralf@tronnes.org> - 2017-06-16 19:00 +0200
      Re: [PATCH] drm: hdlcd: Update PM code to save/restore console. Liviu Dudau <Liviu.Dudau@arm.com> - 2017-06-19 15:20 +0200
        Re: [PATCH] drm: hdlcd: Update PM code to save/restore console. Noralf Trønnes <noralf@tronnes.org> - 2017-06-19 17:50 +0200
      [PATCH v2] drm: hdlcd: Update PM code to save/restore console. Liviu Dudau <Liviu.Dudau@arm.com> - 2017-06-19 16:00 +0200
        Re: [PATCH v2] drm: hdlcd: Update PM code to save/restore console. Noralf Trønnes <noralf@tronnes.org> - 2017-06-19 17:50 +0200
          Re: [PATCH v2] drm: hdlcd: Update PM code to save/restore console. Liviu Dudau <Liviu.Dudau@arm.com> - 2017-06-19 18:20 +0200

#1667766 — [PATCH] drm: hdlcd: Update PM code to save/restore console.

FromLiviu Dudau <Liviu.Dudau@arm.com>
Date2017-06-16 16:00 +0200
Subject[PATCH] drm: hdlcd: Update PM code to save/restore console.
Message-ID<tSZX4-Lj-13@gated-at.bofh.it>
Update the PM code to suspend/resume the fbdev_cma console.

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

diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index d3da87fbd85a..89cd408cde6f 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,15 @@ static int __maybe_unused hdlcd_pm_suspend(struct device *dev)
 		return 0;
 
 	drm_kms_helper_poll_disable(drm);
+	console_lock();
+	drm_fbdev_cma_set_suspend(hdlcd->fbdev, 1);
+	console_unlock();
 
 	hdlcd->state = drm_atomic_helper_suspend(drm);
 	if (IS_ERR(hdlcd->state)) {
+		console_lock();
+		drm_fbdev_cma_set_suspend(hdlcd->fbdev, 0);
+		console_unlock();
 		drm_kms_helper_poll_enable(drm);
 		return PTR_ERR(hdlcd->state);
 	}
@@ -454,8 +461,10 @@ static int __maybe_unused hdlcd_pm_resume(struct device *dev)
 		return 0;
 
 	drm_atomic_helper_resume(drm, hdlcd->state);
+	console_lock();
+	drm_fbdev_cma_set_suspend(hdlcd->fbdev, 0);
+	console_unlock();
 	drm_kms_helper_poll_enable(drm);
-	pm_runtime_set_active(dev);
 
 	return 0;
 }
-- 
2.13.1

[toc] | [next] | [standalone]


#1667899

FromNoralf Trønnes <noralf@tronnes.org>
Date2017-06-16 19:00 +0200
Message-ID<tT2Lf-2HQ-9@gated-at.bofh.it>
In reply to#1667766
Den 16.06.2017 15.53, skrev Liviu Dudau:
> Update the PM code to suspend/resume the fbdev_cma console.
>
> Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
> ---
>   drivers/gpu/drm/arm/hdlcd_drv.c | 11 ++++++++++-
>   1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> index d3da87fbd85a..89cd408cde6f 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,15 @@ static int __maybe_unused hdlcd_pm_suspend(struct device *dev)
>   		return 0;
>   
>   	drm_kms_helper_poll_disable(drm);
> +	console_lock();
> +	drm_fbdev_cma_set_suspend(hdlcd->fbdev, 1);
> +	console_unlock();

You can use drm_fbdev_cma_set_suspend_unlocked() instead, it takes the
lock for you and can speed up resume if the lock is contented.

Noralf.


>   
>   	hdlcd->state = drm_atomic_helper_suspend(drm);
>   	if (IS_ERR(hdlcd->state)) {
> +		console_lock();
> +		drm_fbdev_cma_set_suspend(hdlcd->fbdev, 0);
> +		console_unlock();
>   		drm_kms_helper_poll_enable(drm);
>   		return PTR_ERR(hdlcd->state);
>   	}
> @@ -454,8 +461,10 @@ static int __maybe_unused hdlcd_pm_resume(struct device *dev)
>   		return 0;
>   
>   	drm_atomic_helper_resume(drm, hdlcd->state);
> +	console_lock();
> +	drm_fbdev_cma_set_suspend(hdlcd->fbdev, 0);
> +	console_unlock();
>   	drm_kms_helper_poll_enable(drm);
> -	pm_runtime_set_active(dev);
>   
>   	return 0;
>   }

[toc] | [prev] | [next] | [standalone]


#1669053

FromLiviu Dudau <Liviu.Dudau@arm.com>
Date2017-06-19 15:20 +0200
Message-ID<tU4KZ-379-7@gated-at.bofh.it>
In reply to#1667899
On Fri, Jun 16, 2017 at 06:58:36PM +0200, Noralf Trønnes wrote:
> 
> Den 16.06.2017 15.53, skrev Liviu Dudau:
> > Update the PM code to suspend/resume the fbdev_cma console.
> > 
> > Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
> > ---
> >   drivers/gpu/drm/arm/hdlcd_drv.c | 11 ++++++++++-
> >   1 file changed, 10 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> > index d3da87fbd85a..89cd408cde6f 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,15 @@ static int __maybe_unused hdlcd_pm_suspend(struct device *dev)
> >   		return 0;
> >   	drm_kms_helper_poll_disable(drm);
> > +	console_lock();
> > +	drm_fbdev_cma_set_suspend(hdlcd->fbdev, 1);
> > +	console_unlock();
> 
> You can use drm_fbdev_cma_set_suspend_unlocked() instead, it takes the
> lock for you and can speed up resume if the lock is contented.

Hi Noralf,

Thanks for pointing out the helpful function. As you look to be the author of it,
any reason why the signature of the function doesn't match the drm_fb_helper_ one
being called through? (I'm talking about int vs bool for the state/suspend arguments).

Best regards,
Liviu

> 
> Noralf.
> 
> 
> >   	hdlcd->state = drm_atomic_helper_suspend(drm);
> >   	if (IS_ERR(hdlcd->state)) {
> > +		console_lock();
> > +		drm_fbdev_cma_set_suspend(hdlcd->fbdev, 0);
> > +		console_unlock();
> >   		drm_kms_helper_poll_enable(drm);
> >   		return PTR_ERR(hdlcd->state);
> >   	}
> > @@ -454,8 +461,10 @@ static int __maybe_unused hdlcd_pm_resume(struct device *dev)
> >   		return 0;
> >   	drm_atomic_helper_resume(drm, hdlcd->state);
> > +	console_lock();
> > +	drm_fbdev_cma_set_suspend(hdlcd->fbdev, 0);
> > +	console_unlock();
> >   	drm_kms_helper_poll_enable(drm);
> > -	pm_runtime_set_active(dev);
> >   	return 0;
> >   }
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

[toc] | [prev] | [next] | [standalone]


#1669350

FromNoralf Trønnes <noralf@tronnes.org>
Date2017-06-19 17:50 +0200
Message-ID<tU769-4xl-3@gated-at.bofh.it>
In reply to#1669053
Den 19.06.2017 15.17, skrev Liviu Dudau:
> On Fri, Jun 16, 2017 at 06:58:36PM +0200, Noralf Trønnes wrote:
>> Den 16.06.2017 15.53, skrev Liviu Dudau:
>>> Update the PM code to suspend/resume the fbdev_cma console.
>>>
>>> Signed-off-by: Liviu Dudau <Liviu.Dudau@arm.com>
>>> ---
>>>    drivers/gpu/drm/arm/hdlcd_drv.c | 11 ++++++++++-
>>>    1 file changed, 10 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
>>> index d3da87fbd85a..89cd408cde6f 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,15 @@ static int __maybe_unused hdlcd_pm_suspend(struct device *dev)
>>>    		return 0;
>>>    	drm_kms_helper_poll_disable(drm);
>>> +	console_lock();
>>> +	drm_fbdev_cma_set_suspend(hdlcd->fbdev, 1);
>>> +	console_unlock();
>> You can use drm_fbdev_cma_set_suspend_unlocked() instead, it takes the
>> lock for you and can speed up resume if the lock is contented.
> Hi Noralf,
>
> Thanks for pointing out the helpful function. As you look to be the author of it,
> any reason why the signature of the function doesn't match the drm_fb_helper_ one
> being called through? (I'm talking about int vs bool for the state/suspend arguments).

I don't remember, but probably to match drm_fbdev_cma_set_suspend()
which uses int. drm_fb_helper_set_suspend*() uses bool, but calls
into fb_set_suspend() which uses int, but as a boolean.

Noralf.
> Best regards,
> Liviu
>
>> Noralf.
>>
>>
>>>    	hdlcd->state = drm_atomic_helper_suspend(drm);
>>>    	if (IS_ERR(hdlcd->state)) {
>>> +		console_lock();
>>> +		drm_fbdev_cma_set_suspend(hdlcd->fbdev, 0);
>>> +		console_unlock();
>>>    		drm_kms_helper_poll_enable(drm);
>>>    		return PTR_ERR(hdlcd->state);
>>>    	}
>>> @@ -454,8 +461,10 @@ static int __maybe_unused hdlcd_pm_resume(struct device *dev)
>>>    		return 0;
>>>    	drm_atomic_helper_resume(drm, hdlcd->state);
>>> +	console_lock();
>>> +	drm_fbdev_cma_set_suspend(hdlcd->fbdev, 0);
>>> +	console_unlock();
>>>    	drm_kms_helper_poll_enable(drm);
>>> -	pm_runtime_set_active(dev);
>>>    	return 0;
>>>    }

[toc] | [prev] | [next] | [standalone]


#1669083 — [PATCH v2] drm: hdlcd: Update PM code to save/restore console.

FromLiviu Dudau <Liviu.Dudau@arm.com>
Date2017-06-19 16:00 +0200
Subject[PATCH v2] drm: hdlcd: Update PM code to save/restore console.
Message-ID<tU5nI-3mQ-13@gated-at.bofh.it>
In reply to#1667899
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>
 #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;
 }
-- 
2.13.1

[toc] | [prev] | [next] | [standalone]


#1669375 — Re: [PATCH v2] drm: hdlcd: Update PM code to save/restore console.

FromNoralf Trønnes <noralf@tronnes.org>
Date2017-06-19 17:50 +0200
SubjectRe: [PATCH v2] drm: hdlcd: Update PM code to save/restore console.
Message-ID<tU76c-4xl-79@gated-at.bofh.it>
In reply to#1669083
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;
>   }

[toc] | [prev] | [next] | [standalone]


#1669434 — Re: [PATCH v2] drm: hdlcd: Update PM code to save/restore console.

FromLiviu Dudau <Liviu.Dudau@arm.com>
Date2017-06-19 18:20 +0200
SubjectRe: [PATCH v2] drm: hdlcd: Update PM code to save/restore console.
Message-ID<tU7zc-4Y3-21@gated-at.bofh.it>
In reply to#1669375
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;
> >   }
> 

-- 
====================
| I would like to |
| fix the world,  |
| but they're not |
| giving me the   |
 \ source code!  /
  ---------------
    ¯\_(ツ)_/¯

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web