diff mbox

fbdev: sh_mobile_lcdc: Turn dot clock on before resuming from runtime PM

Message ID 1310387754-23033-1-git-send-email-laurent.pinchart@ideasonboard.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Pinchart July 11, 2011, 12:35 p.m. UTC
Resuming from runtime PM restores all LCDC registers. If the dot clock
is off at that time display panning information will be corrupted.

Turn the dot clock on before resuming from runtime PM. Similarly,
turn the clock off after suspending the LCDC.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Damian Hobson-Garcia <dhobsong@igel.co.jp>
---
 drivers/video/sh_mobile_lcdcfb.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

This patch should fix the LCDC panning issue caused by runtime suspend. It
applies on top of Rafael J. Wysocki's pm-domains branch and Damian
Hobson-Garcia's MERAM patches.

Comments

Guennadi Liakhovetski July 12, 2011, 9:33 a.m. UTC | #1
On Mon, 11 Jul 2011, Laurent Pinchart wrote:

> Resuming from runtime PM restores all LCDC registers. If the dot clock
> is off at that time display panning information will be corrupted.
> 
> Turn the dot clock on before resuming from runtime PM. Similarly,
> turn the clock off after suspending the LCDC.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Magnus Damm <magnus.damm@gmail.com>
> Cc: Damian Hobson-Garcia <dhobsong@igel.co.jp>

(testing would have been a bit easier, if prerequisites had been specified 
in the patch;))

Tested-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Thanks
Guennadi

> ---
>  drivers/video/sh_mobile_lcdcfb.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> This patch should fix the LCDC panning issue caused by runtime suspend. It
> applies on top of Rafael J. Wysocki's pm-domains branch and Damian
> Hobson-Garcia's MERAM patches.
> 
> diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
> index 48a40e3..e9b80bc 100644
> --- a/drivers/video/sh_mobile_lcdcfb.c
> +++ b/drivers/video/sh_mobile_lcdcfb.c
> @@ -256,9 +256,9 @@ struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
>  static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
>  {
>  	if (atomic_inc_and_test(&priv->hw_usecnt)) {
> -		pm_runtime_get_sync(priv->dev);
>  		if (priv->dot_clk)
>  			clk_enable(priv->dot_clk);
> +		pm_runtime_get_sync(priv->dev);
>  		if (priv->meram_dev && priv->meram_dev->pdev)
>  			pm_runtime_get_sync(&priv->meram_dev->pdev->dev);
>  	}
> @@ -267,11 +267,11 @@ static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
>  static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
>  {
>  	if (atomic_sub_return(1, &priv->hw_usecnt) == -1) {
> -		if (priv->dot_clk)
> -			clk_disable(priv->dot_clk);
>  		if (priv->meram_dev && priv->meram_dev->pdev)
>  			pm_runtime_put_sync(&priv->meram_dev->pdev->dev);
>  		pm_runtime_put(priv->dev);
> +		if (priv->dot_clk)
> +			clk_disable(priv->dot_clk);
>  	}
>  }
>  
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sh" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Laurent Pinchart July 12, 2011, 9:37 a.m. UTC | #2
On Tuesday 12 July 2011 11:33:09 Guennadi Liakhovetski wrote:
> On Mon, 11 Jul 2011, Laurent Pinchart wrote:
> > Resuming from runtime PM restores all LCDC registers. If the dot clock
> > is off at that time display panning information will be corrupted.
> > 
> > Turn the dot clock on before resuming from runtime PM. Similarly,
> > turn the clock off after suspending the LCDC.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Cc: Magnus Damm <magnus.damm@gmail.com>
> > Cc: Damian Hobson-Garcia <dhobsong@igel.co.jp>
> 
> (testing would have been a bit easier, if prerequisites had been specified
> in the patch;))

They're specified a couple of lines down ;-)

> Tested-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

Thank you.

> > ---
> > 
> >  drivers/video/sh_mobile_lcdcfb.c |    6 +++---
> >  1 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > This patch should fix the LCDC panning issue caused by runtime suspend.
> > It applies on top of Rafael J. Wysocki's pm-domains branch and Damian
> > Hobson-Garcia's MERAM patches.
> > 
> > diff --git a/drivers/video/sh_mobile_lcdcfb.c
> > b/drivers/video/sh_mobile_lcdcfb.c index 48a40e3..e9b80bc 100644
> > --- a/drivers/video/sh_mobile_lcdcfb.c
> > +++ b/drivers/video/sh_mobile_lcdcfb.c
> > @@ -256,9 +256,9 @@ struct sh_mobile_lcdc_sys_bus_ops
> > sh_mobile_lcdc_sys_bus_ops = {
> > 
> >  static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
> >  {
> >  
> >  	if (atomic_inc_and_test(&priv->hw_usecnt)) {
> > 
> > -		pm_runtime_get_sync(priv->dev);
> > 
> >  		if (priv->dot_clk)
> >  		
> >  			clk_enable(priv->dot_clk);
> > 
> > +		pm_runtime_get_sync(priv->dev);
> > 
> >  		if (priv->meram_dev && priv->meram_dev->pdev)
> >  		
> >  			pm_runtime_get_sync(&priv->meram_dev->pdev->dev);
> >  	
> >  	}
> > 
> > @@ -267,11 +267,11 @@ static void sh_mobile_lcdc_clk_on(struct
> > sh_mobile_lcdc_priv *priv)
> > 
> >  static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
> >  {
> >  
> >  	if (atomic_sub_return(1, &priv->hw_usecnt) == -1) {
> > 
> > -		if (priv->dot_clk)
> > -			clk_disable(priv->dot_clk);
> > 
> >  		if (priv->meram_dev && priv->meram_dev->pdev)
> >  		
> >  			pm_runtime_put_sync(&priv->meram_dev->pdev->dev);
> >  		
> >  		pm_runtime_put(priv->dev);
> > 
> > +		if (priv->dot_clk)
> > +			clk_disable(priv->dot_clk);
> > 
> >  	}
> >  
> >  }
Paul Mundt July 13, 2011, 8:21 a.m. UTC | #3
On Tue, Jul 12, 2011 at 11:37:57AM +0200, Laurent Pinchart wrote:
> On Tuesday 12 July 2011 11:33:09 Guennadi Liakhovetski wrote:
> > On Mon, 11 Jul 2011, Laurent Pinchart wrote:
> > > Resuming from runtime PM restores all LCDC registers. If the dot clock
> > > is off at that time display panning information will be corrupted.
> > > 
> > > Turn the dot clock on before resuming from runtime PM. Similarly,
> > > turn the clock off after suspending the LCDC.
> > > 
> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > Cc: Magnus Damm <magnus.damm@gmail.com>
> > > Cc: Damian Hobson-Garcia <dhobsong@igel.co.jp>
> > 
> > (testing would have been a bit easier, if prerequisites had been specified
> > in the patch;))
> 
> They're specified a couple of lines down ;-)
> 
> > Tested-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> 
> Thank you.
> 
Folded in on top of the rest of the MERAM changes, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c
index 48a40e3..e9b80bc 100644
--- a/drivers/video/sh_mobile_lcdcfb.c
+++ b/drivers/video/sh_mobile_lcdcfb.c
@@ -256,9 +256,9 @@  struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
 static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
 {
 	if (atomic_inc_and_test(&priv->hw_usecnt)) {
-		pm_runtime_get_sync(priv->dev);
 		if (priv->dot_clk)
 			clk_enable(priv->dot_clk);
+		pm_runtime_get_sync(priv->dev);
 		if (priv->meram_dev && priv->meram_dev->pdev)
 			pm_runtime_get_sync(&priv->meram_dev->pdev->dev);
 	}
@@ -267,11 +267,11 @@  static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
 static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
 {
 	if (atomic_sub_return(1, &priv->hw_usecnt) == -1) {
-		if (priv->dot_clk)
-			clk_disable(priv->dot_clk);
 		if (priv->meram_dev && priv->meram_dev->pdev)
 			pm_runtime_put_sync(&priv->meram_dev->pdev->dev);
 		pm_runtime_put(priv->dev);
+		if (priv->dot_clk)
+			clk_disable(priv->dot_clk);
 	}
 }