All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: hdlcd: Update PM code to save/restore console.
@ 2017-06-16 13:53 ` Liviu Dudau
  0 siblings, 0 replies; 20+ messages in thread
From: Liviu Dudau @ 2017-06-16 13:53 UTC (permalink / raw)
  To: Mali DP Maintainers; +Cc: Brian Starkey, David Airlie, DRI devel, LKML

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

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

* [PATCH] drm: hdlcd: Update PM code to save/restore console.
@ 2017-06-16 13:53 ` Liviu Dudau
  0 siblings, 0 replies; 20+ messages in thread
From: Liviu Dudau @ 2017-06-16 13:53 UTC (permalink / raw)
  To: Mali DP Maintainers; +Cc: DRI devel, LKML

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

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

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

* Re: [PATCH] drm: hdlcd: Update PM code to save/restore console.
  2017-06-16 13:53 ` Liviu Dudau
@ 2017-06-16 16:58   ` Noralf Trønnes
  -1 siblings, 0 replies; 20+ messages in thread
From: Noralf Trønnes @ 2017-06-16 16:58 UTC (permalink / raw)
  To: Liviu Dudau, Mali DP Maintainers; +Cc: DRI devel, LKML


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;
>   }

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

* Re: [PATCH] drm: hdlcd: Update PM code to save/restore console.
@ 2017-06-16 16:58   ` Noralf Trønnes
  0 siblings, 0 replies; 20+ messages in thread
From: Noralf Trønnes @ 2017-06-16 16:58 UTC (permalink / raw)
  To: Liviu Dudau, Mali DP Maintainers; +Cc: LKML, DRI devel


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;
>   }

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

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

* Re: [PATCH] drm: hdlcd: Update PM code to save/restore console.
  2017-06-16 16:58   ` Noralf Trønnes
@ 2017-06-19 13:17     ` Liviu Dudau
  -1 siblings, 0 replies; 20+ messages in thread
From: Liviu Dudau @ 2017-06-19 13:17 UTC (permalink / raw)
  To: Noralf Trønnes; +Cc: Mali DP Maintainers, DRI devel, LKML

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!  /
  ---------------
    ¯\_(ツ)_/¯

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

* Re: [PATCH] drm: hdlcd: Update PM code to save/restore console.
@ 2017-06-19 13:17     ` Liviu Dudau
  0 siblings, 0 replies; 20+ messages in thread
From: Liviu Dudau @ 2017-06-19 13:17 UTC (permalink / raw)
  To: Noralf Trønnes; +Cc: Mali DP Maintainers, LKML, DRI devel

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!  /
  ---------------
    ¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH v2] drm: hdlcd: Update PM code to save/restore console.
  2017-06-16 16:58   ` Noralf Trønnes
@ 2017-06-19 13:53     ` Liviu Dudau
  -1 siblings, 0 replies; 20+ messages in thread
From: Liviu Dudau @ 2017-06-19 13:53 UTC (permalink / raw)
  To: Mali DP Maintainers; +Cc: Brian Starkey, David Airlie, DRI devel, LKML

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

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

* [PATCH v2] drm: hdlcd: Update PM code to save/restore console.
@ 2017-06-19 13:53     ` Liviu Dudau
  0 siblings, 0 replies; 20+ messages in thread
From: Liviu Dudau @ 2017-06-19 13:53 UTC (permalink / raw)
  To: Mali DP Maintainers; +Cc: DRI devel, LKML

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

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

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

* Re: [PATCH] drm: hdlcd: Update PM code to save/restore console.
  2017-06-19 13:17     ` Liviu Dudau
@ 2017-06-19 15:45       ` Noralf Trønnes
  -1 siblings, 0 replies; 20+ messages in thread
From: Noralf Trønnes @ 2017-06-19 15:45 UTC (permalink / raw)
  To: Liviu Dudau; +Cc: Mali DP Maintainers, DRI devel, LKML


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;
>>>    }

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

* Re: [PATCH] drm: hdlcd: Update PM code to save/restore console.
@ 2017-06-19 15:45       ` Noralf Trønnes
  0 siblings, 0 replies; 20+ messages in thread
From: Noralf Trønnes @ 2017-06-19 15:45 UTC (permalink / raw)
  To: Liviu Dudau; +Cc: Mali DP Maintainers, LKML, DRI devel


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;
>>>    }

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

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

* Re: [PATCH v2] drm: hdlcd: Update PM code to save/restore console.
  2017-06-19 13:53     ` Liviu Dudau
@ 2017-06-19 15:47       ` Noralf Trønnes
  -1 siblings, 0 replies; 20+ messages in thread
From: Noralf Trønnes @ 2017-06-19 15:47 UTC (permalink / raw)
  To: Liviu Dudau, Mali DP Maintainers; +Cc: DRI devel, LKML


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;
>   }

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

* Re: [PATCH v2] drm: hdlcd: Update PM code to save/restore console.
@ 2017-06-19 15:47       ` Noralf Trønnes
  0 siblings, 0 replies; 20+ messages in thread
From: Noralf Trønnes @ 2017-06-19 15:47 UTC (permalink / raw)
  To: Liviu Dudau, Mali DP Maintainers; +Cc: LKML, DRI devel


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;
>   }

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

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

* Re: [PATCH v2] drm: hdlcd: Update PM code to save/restore console.
  2017-06-19 15:47       ` Noralf Trønnes
@ 2017-06-19 16:16         ` Liviu Dudau
  -1 siblings, 0 replies; 20+ messages in thread
From: Liviu Dudau @ 2017-06-19 16:16 UTC (permalink / raw)
  To: Noralf Trønnes; +Cc: Mali DP Maintainers, DRI devel, LKML

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!  /
  ---------------
    ¯\_(ツ)_/¯

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

* Re: [PATCH v2] drm: hdlcd: Update PM code to save/restore console.
@ 2017-06-19 16:16         ` Liviu Dudau
  0 siblings, 0 replies; 20+ messages in thread
From: Liviu Dudau @ 2017-06-19 16:16 UTC (permalink / raw)
  To: Noralf Trønnes; +Cc: Mali DP Maintainers, LKML, DRI devel

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!  /
  ---------------
    ¯\_(ツ)_/¯
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm: hdlcd: Update PM code to save/restore console.
  2017-06-19 15:45       ` Noralf Trønnes
@ 2017-06-20  9:37         ` Daniel Vetter
  -1 siblings, 0 replies; 20+ messages in thread
From: Daniel Vetter @ 2017-06-20  9:37 UTC (permalink / raw)
  To: Noralf Trønnes; +Cc: Liviu Dudau, Mali DP Maintainers, LKML, DRI devel

On Mon, Jun 19, 2017 at 05:45:21PM +0200, Noralf Trønnes wrote:
> 
> 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.

I'd be happy to apply a patch which changes them all to bool ...

Cheers, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [PATCH] drm: hdlcd: Update PM code to save/restore console.
@ 2017-06-20  9:37         ` Daniel Vetter
  0 siblings, 0 replies; 20+ messages in thread
From: Daniel Vetter @ 2017-06-20  9:37 UTC (permalink / raw)
  To: Noralf Trønnes; +Cc: Mali DP Maintainers, Liviu Dudau, LKML, DRI devel

On Mon, Jun 19, 2017 at 05:45:21PM +0200, Noralf Trønnes wrote:
> 
> 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.

I'd be happy to apply a patch which changes them all to bool ...

Cheers, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH] drm: Convert CMA fbdev console suspend helpers to use bool
  2017-06-20  9:37         ` Daniel Vetter
@ 2017-06-20 10:23           ` Liviu Dudau
  -1 siblings, 0 replies; 20+ messages in thread
From: Liviu Dudau @ 2017-06-20 10:23 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Jani Nikula, Sean Paul, David Airlie, DRI devel, LKML, Liviu Dudau

drm_fbdev_cma_set_suspend{,_unlocked} use an integer parameter
to describe whether the intended state is a suspend or a resume.
It then passes the value to drm_fb_helper_set_suspend{,_unlocked}
which uses a boolean. Switch to using bool everywhere.

Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
---
 drivers/gpu/drm/drm_fb_cma_helper.c | 4 ++--
 include/drm/drm_fb_cma_helper.h     | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index 53f9bdf470d7..ade319d10e70 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -640,7 +640,7 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
  * Calls drm_fb_helper_set_suspend, which is a wrapper around
  * fb_set_suspend implemented by fbdev core.
  */
-void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state)
+void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state)
 {
 	if (fbdev_cma)
 		drm_fb_helper_set_suspend(&fbdev_cma->fb_helper, state);
@@ -657,7 +657,7 @@ EXPORT_SYMBOL(drm_fbdev_cma_set_suspend);
  * fb_set_suspend implemented by fbdev core.
  */
 void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
-					int state)
+					bool state)
 {
 	if (fbdev_cma)
 		drm_fb_helper_set_suspend_unlocked(&fbdev_cma->fb_helper,
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
index 199a63f48659..a323781afc3f 100644
--- a/include/drm/drm_fb_cma_helper.h
+++ b/include/drm/drm_fb_cma_helper.h
@@ -24,9 +24,9 @@ void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma);
 
 void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
 void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
-void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state);
+void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state);
 void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
-					int state);
+					bool state);
 
 void drm_fb_cma_destroy(struct drm_framebuffer *fb);
 int drm_fb_cma_create_handle(struct drm_framebuffer *fb,
-- 
2.13.1

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

* [PATCH] drm: Convert CMA fbdev console suspend helpers to use bool
@ 2017-06-20 10:23           ` Liviu Dudau
  0 siblings, 0 replies; 20+ messages in thread
From: Liviu Dudau @ 2017-06-20 10:23 UTC (permalink / raw)
  To: Daniel Vetter; +Cc: Liviu Dudau, LKML, DRI devel

drm_fbdev_cma_set_suspend{,_unlocked} use an integer parameter
to describe whether the intended state is a suspend or a resume.
It then passes the value to drm_fb_helper_set_suspend{,_unlocked}
which uses a boolean. Switch to using bool everywhere.

Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
---
 drivers/gpu/drm/drm_fb_cma_helper.c | 4 ++--
 include/drm/drm_fb_cma_helper.h     | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index 53f9bdf470d7..ade319d10e70 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -640,7 +640,7 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
  * Calls drm_fb_helper_set_suspend, which is a wrapper around
  * fb_set_suspend implemented by fbdev core.
  */
-void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state)
+void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state)
 {
 	if (fbdev_cma)
 		drm_fb_helper_set_suspend(&fbdev_cma->fb_helper, state);
@@ -657,7 +657,7 @@ EXPORT_SYMBOL(drm_fbdev_cma_set_suspend);
  * fb_set_suspend implemented by fbdev core.
  */
 void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
-					int state)
+					bool state)
 {
 	if (fbdev_cma)
 		drm_fb_helper_set_suspend_unlocked(&fbdev_cma->fb_helper,
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
index 199a63f48659..a323781afc3f 100644
--- a/include/drm/drm_fb_cma_helper.h
+++ b/include/drm/drm_fb_cma_helper.h
@@ -24,9 +24,9 @@ void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma);
 
 void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
 void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
-void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state);
+void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state);
 void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
-					int state);
+					bool state);
 
 void drm_fb_cma_destroy(struct drm_framebuffer *fb);
 int drm_fb_cma_create_handle(struct drm_framebuffer *fb,
-- 
2.13.1

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

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

* Re: [PATCH] drm: Convert CMA fbdev console suspend helpers to use bool
  2017-06-20 10:23           ` Liviu Dudau
@ 2017-06-20 14:23             ` Daniel Vetter
  -1 siblings, 0 replies; 20+ messages in thread
From: Daniel Vetter @ 2017-06-20 14:23 UTC (permalink / raw)
  To: Liviu Dudau; +Cc: Daniel Vetter, LKML, DRI devel

On Tue, Jun 20, 2017 at 11:23:20AM +0100, Liviu Dudau wrote:
> drm_fbdev_cma_set_suspend{,_unlocked} use an integer parameter
> to describe whether the intended state is a suspend or a resume.
> It then passes the value to drm_fb_helper_set_suspend{,_unlocked}
> which uses a boolean. Switch to using bool everywhere.
> 
> Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>

Sweet, patch applied, thanks.
-Daniel

> ---
>  drivers/gpu/drm/drm_fb_cma_helper.c | 4 ++--
>  include/drm/drm_fb_cma_helper.h     | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
> index 53f9bdf470d7..ade319d10e70 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -640,7 +640,7 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
>   * Calls drm_fb_helper_set_suspend, which is a wrapper around
>   * fb_set_suspend implemented by fbdev core.
>   */
> -void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state)
> +void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state)
>  {
>  	if (fbdev_cma)
>  		drm_fb_helper_set_suspend(&fbdev_cma->fb_helper, state);
> @@ -657,7 +657,7 @@ EXPORT_SYMBOL(drm_fbdev_cma_set_suspend);
>   * fb_set_suspend implemented by fbdev core.
>   */
>  void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
> -					int state)
> +					bool state)
>  {
>  	if (fbdev_cma)
>  		drm_fb_helper_set_suspend_unlocked(&fbdev_cma->fb_helper,
> diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
> index 199a63f48659..a323781afc3f 100644
> --- a/include/drm/drm_fb_cma_helper.h
> +++ b/include/drm/drm_fb_cma_helper.h
> @@ -24,9 +24,9 @@ void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma);
>  
>  void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
>  void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
> -void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state);
> +void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state);
>  void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
> -					int state);
> +					bool state);
>  
>  void drm_fb_cma_destroy(struct drm_framebuffer *fb);
>  int drm_fb_cma_create_handle(struct drm_framebuffer *fb,
> -- 
> 2.13.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

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

* Re: [PATCH] drm: Convert CMA fbdev console suspend helpers to use bool
@ 2017-06-20 14:23             ` Daniel Vetter
  0 siblings, 0 replies; 20+ messages in thread
From: Daniel Vetter @ 2017-06-20 14:23 UTC (permalink / raw)
  To: Liviu Dudau; +Cc: Daniel Vetter, LKML, DRI devel

On Tue, Jun 20, 2017 at 11:23:20AM +0100, Liviu Dudau wrote:
> drm_fbdev_cma_set_suspend{,_unlocked} use an integer parameter
> to describe whether the intended state is a suspend or a resume.
> It then passes the value to drm_fb_helper_set_suspend{,_unlocked}
> which uses a boolean. Switch to using bool everywhere.
> 
> Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>

Sweet, patch applied, thanks.
-Daniel

> ---
>  drivers/gpu/drm/drm_fb_cma_helper.c | 4 ++--
>  include/drm/drm_fb_cma_helper.h     | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
> index 53f9bdf470d7..ade319d10e70 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -640,7 +640,7 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
>   * Calls drm_fb_helper_set_suspend, which is a wrapper around
>   * fb_set_suspend implemented by fbdev core.
>   */
> -void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state)
> +void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state)
>  {
>  	if (fbdev_cma)
>  		drm_fb_helper_set_suspend(&fbdev_cma->fb_helper, state);
> @@ -657,7 +657,7 @@ EXPORT_SYMBOL(drm_fbdev_cma_set_suspend);
>   * fb_set_suspend implemented by fbdev core.
>   */
>  void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
> -					int state)
> +					bool state)
>  {
>  	if (fbdev_cma)
>  		drm_fb_helper_set_suspend_unlocked(&fbdev_cma->fb_helper,
> diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
> index 199a63f48659..a323781afc3f 100644
> --- a/include/drm/drm_fb_cma_helper.h
> +++ b/include/drm/drm_fb_cma_helper.h
> @@ -24,9 +24,9 @@ void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma);
>  
>  void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
>  void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
> -void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state);
> +void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, bool state);
>  void drm_fbdev_cma_set_suspend_unlocked(struct drm_fbdev_cma *fbdev_cma,
> -					int state);
> +					bool state);
>  
>  void drm_fb_cma_destroy(struct drm_framebuffer *fb);
>  int drm_fb_cma_create_handle(struct drm_framebuffer *fb,
> -- 
> 2.13.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2017-06-20 14:23 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-16 13:53 [PATCH] drm: hdlcd: Update PM code to save/restore console Liviu Dudau
2017-06-16 13:53 ` Liviu Dudau
2017-06-16 16:58 ` Noralf Trønnes
2017-06-16 16:58   ` Noralf Trønnes
2017-06-19 13:17   ` Liviu Dudau
2017-06-19 13:17     ` Liviu Dudau
2017-06-19 15:45     ` Noralf Trønnes
2017-06-19 15:45       ` Noralf Trønnes
2017-06-20  9:37       ` Daniel Vetter
2017-06-20  9:37         ` Daniel Vetter
2017-06-20 10:23         ` [PATCH] drm: Convert CMA fbdev console suspend helpers to use bool Liviu Dudau
2017-06-20 10:23           ` Liviu Dudau
2017-06-20 14:23           ` Daniel Vetter
2017-06-20 14:23             ` Daniel Vetter
2017-06-19 13:53   ` [PATCH v2] drm: hdlcd: Update PM code to save/restore console Liviu Dudau
2017-06-19 13:53     ` Liviu Dudau
2017-06-19 15:47     ` Noralf Trønnes
2017-06-19 15:47       ` Noralf Trønnes
2017-06-19 16:16       ` Liviu Dudau
2017-06-19 16:16         ` Liviu Dudau

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.