# \[PATCH\] fbdev: sh\_mobile\_lcdc: Turn dot clock on before resuming from runtime PM

- Subsystems: FRAMEBUFFER LAYER, THE REST
- Maintainers: Helge Deller, Linus Torvalds
- List: linux-fbdev
- 10 messages, 4 authors
- Page: https://ratatoskr.run/linux-fbdev/2011/07/13461708/t

## \[PATCH\] fbdev: sh\_mobile\_lcdc: Turn dot clock on before resuming from runtime PM

- From: Laurent Pinchart \<laurent.pinchart@ideasonboard.com\>
- Date: 2011-07-11 12:35:54 
- Message: https://ratatoskr.run/linux-fbdev/2011/07/13461708.md

```text
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 <redacted>
---
 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

```

## Re: \[PATCH\] fbdev: sh\_mobile\_lcdc: Turn dot clock on before resuming

- From: Guennadi Liakhovetski \<hidden\>
- Date: 2011-07-12 09:33:09 
- Message: https://ratatoskr.run/linux-fbdev/2011/07/13461709.md

```text
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 <redacted>

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

Tested-by: Guennadi Liakhovetski <redacted>

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/
```

## Re: \[PATCH\] fbdev: sh\_mobile\_lcdc: Turn dot clock on before resuming from runtime PM

- From: Laurent Pinchart \<laurent.pinchart@ideasonboard.com\>
- Date: 2011-07-12 09:37:57 
- Message: https://ratatoskr.run/linux-fbdev/2011/07/13461710.md

```text
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 <redacted>
> 
> (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 <redacted>

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

-- 
Regards,

Laurent Pinchart
```

## Re: \[PATCH\] fbdev: sh\_mobile\_lcdc: Turn dot clock on before resuming from runtime PM

- From: Paul Mundt \<hidden\>
- Date: 2011-07-13 08:21:13 
- Message: https://ratatoskr.run/linux-fbdev/2011/07/13461711.md

```text
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 <redacted>
> > 
> > (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 <redacted>
> 
> Thank you.
> 
Folded in on top of the rest of the MERAM changes, thanks.
```

## Re: \[PATCH\] fbdev: sh\_mobile\_lcdc: Turn dot clock on before resuming from runtime PM

- From: Laurent Pinchart \<laurent.pinchart@ideasonboard.com\>
- Date: 2011-09-20 19:30:56 
- Message: https://ratatoskr.run/linux-fbdev/2011/09/13461953.md

```text
Hi Florian,

On Monday 11 July 2011 14:35:54 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.

Could you please pick this patch for v3.2 ?

-- 
Regards,

Laurent Pinchart
```

## Re: \[PATCH\] fbdev: sh\_mobile\_lcdc: Turn dot clock on before resuming

- From: Florian Tobias Schandinat \<FlorianSchandinat@gmx.de\>
- Date: 2011-09-20 19:52:36 
- Message: https://ratatoskr.run/linux-fbdev/2011/09/13461954.md

```text
Hi Laurent,

On 09/20/2011 07:30 PM, Laurent Pinchart wrote:
> Hi Florian,
> 
> On Monday 11 July 2011 14:35:54 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.
> 
> Could you please pick this patch for v3.2 ?

I assume you meant the currently developed 3.1? (as 3.2 is the next one for
which the patch is lying in my fbdev-next anyway)
Uhm, I originally didn't plan to ask Linus pulling anything before getting rid
of the old stuff, but okay, will go through my patches in the next days and look
what else is appropriate unless Linus beats me and releases 3.1 (although I do
not consider this likely as long as kernel.org is still down)


Best regards,

Florian Tobias Schandinat
```

## Re: \[PATCH\] fbdev: sh\_mobile\_lcdc: Turn dot clock on before resuming from runtime PM

- From: Laurent Pinchart \<laurent.pinchart@ideasonboard.com\>
- Date: 2011-09-20 19:56:43 
- Message: https://ratatoskr.run/linux-fbdev/2011/09/13461955.md

```text
Hi Florian,

On Tuesday 20 September 2011 21:52:36 Florian Tobias Schandinat wrote:
> On 09/20/2011 07:30 PM, Laurent Pinchart wrote:
> > On Monday 11 July 2011 14:35:54 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.
> > 
> > Could you please pick this patch for v3.2 ?
> 
> I assume you meant the currently developed 3.1? (as 3.2 is the next one for
> which the patch is lying in my fbdev-next anyway)

No, I meant v3.2. As I haven't received any pull notification in response to 
the patch, and as I had no way to check your fbdev-next tree on kernel.org, I 
just wanted to make sure the patch would be queued for v3.2.

Please ignore this e-mail (and the other similar ones I've just sent) if the 
patches are already in your queue. And thank you for picking them.

> Uhm, I originally didn't plan to ask Linus pulling anything before getting
> rid of the old stuff, but okay, will go through my patches in the next
> days and look what else is appropriate unless Linus beats me and releases
> 3.1 (although I do not consider this likely as long as kernel.org is still
> down)

-- 
Regards,

Laurent Pinchart
```

## Re: \[PATCH\] fbdev: sh\_mobile\_lcdc: Turn dot clock on before resuming

- From: Florian Tobias Schandinat \<FlorianSchandinat@gmx.de\>
- Date: 2011-09-20 20:19:25 
- Message: https://ratatoskr.run/linux-fbdev/2011/09/13461956.md

```text
Hi Laurent,

On 09/20/2011 07:56 PM, Laurent Pinchart wrote:
> Hi Florian,
> 
> On Tuesday 20 September 2011 21:52:36 Florian Tobias Schandinat wrote:
>> On 09/20/2011 07:30 PM, Laurent Pinchart wrote:
>>> On Monday 11 July 2011 14:35:54 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.
>>>
>>> Could you please pick this patch for v3.2 ?
>>
>> I assume you meant the currently developed 3.1? (as 3.2 is the next one for
>> which the patch is lying in my fbdev-next anyway)
> 
> No, I meant v3.2. As I haven't received any pull notification in response to 
> the patch, and as I had no way to check your fbdev-next tree on kernel.org, I 
> just wanted to make sure the patch would be queued for v3.2.

Just for your info, my tree [1] never was on kernel.org, you can see the patch
in it here [2] (webfrontend). Looks like the patch I got come from your pull
request "SH mobile LCDC cleanups and fixes", hope that's the right version.


Best regards,

Florian Tobias Schandinat


[1] git://github.com/schandinat/linux-2.6.git
[2]
https://github.com/schandinat/linux-2.6/commit/f1ad90da5c0fcb8841cc5e6d66c56f4005d8c960

```

## Re: \[PATCH\] fbdev: sh\_mobile\_lcdc: Turn dot clock on before resuming from runtime PM

- From: Laurent Pinchart \<laurent.pinchart@ideasonboard.com\>
- Date: 2011-09-20 22:44:10 
- Message: https://ratatoskr.run/linux-fbdev/2011/09/13461957.md

```text
Hi Florian,

On Tuesday 20 September 2011 22:19:25 Florian Tobias Schandinat wrote:
> On 09/20/2011 07:56 PM, Laurent Pinchart wrote:
> > On Tuesday 20 September 2011 21:52:36 Florian Tobias Schandinat wrote:
> >> On 09/20/2011 07:30 PM, Laurent Pinchart wrote:
> >>> On Monday 11 July 2011 14:35:54 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.
> >>> 
> >>> Could you please pick this patch for v3.2 ?
> >> 
> >> I assume you meant the currently developed 3.1? (as 3.2 is the next one
> >> for which the patch is lying in my fbdev-next anyway)
> > 
> > No, I meant v3.2. As I haven't received any pull notification in response
> > to the patch, and as I had no way to check your fbdev-next tree on
> > kernel.org, I just wanted to make sure the patch would be queued for
> > v3.2.
> 
> Just for your info, my tree [1] never was on kernel.org, you can see the
> patch in it here [2] (webfrontend). Looks like the patch I got come from
> your pull request "SH mobile LCDC cleanups and fixes", hope that's the
> right version.

Oops, my bad.

I'm rebasing my pending patches on top of your fbdev/fbdev-next tree. There 
are a couple of conflicts, I'll resent the rebased patches to the list.

-- 
Regards,

Laurent Pinchart
```

## Re: \[PATCH\] fbdev: sh\_mobile\_lcdc: Turn dot clock on before resuming from runtime PM

- From: Laurent Pinchart \<laurent.pinchart@ideasonboard.com\>
- Date: 2011-09-20 23:03:26 
- Message: https://ratatoskr.run/linux-fbdev/2011/09/13461958.md

```text
Hi Florian,

On Wednesday 21 September 2011 00:44:10 Laurent Pinchart wrote:
> On Tuesday 20 September 2011 22:19:25 Florian Tobias Schandinat wrote:
> > On 09/20/2011 07:56 PM, Laurent Pinchart wrote:
> > > On Tuesday 20 September 2011 21:52:36 Florian Tobias Schandinat wrote:
> > >> On 09/20/2011 07:30 PM, Laurent Pinchart wrote:
> > >>> On Monday 11 July 2011 14:35:54 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.
> > >>> 
> > >>> Could you please pick this patch for v3.2 ?
> > >> 
> > >> I assume you meant the currently developed 3.1? (as 3.2 is the next
> > >> one for which the patch is lying in my fbdev-next anyway)
> > > 
> > > No, I meant v3.2. As I haven't received any pull notification in
> > > response to the patch, and as I had no way to check your fbdev-next
> > > tree on kernel.org, I just wanted to make sure the patch would be
> > > queued for v3.2.
> > 
> > Just for your info, my tree [1] never was on kernel.org, you can see the
> > patch in it here [2] (webfrontend). Looks like the patch I got come from
> > your pull request "SH mobile LCDC cleanups and fixes", hope that's the
> > right version.
> 
> Oops, my bad.
> 
> I'm rebasing my pending patches on top of your fbdev/fbdev-next tree. There
> are a couple of conflicts, I'll resent the rebased patches to the list.

Conflicts are only in the WIP/RFC patches. Those are not meant for upstream 
inclusion now, I'll resend them later after getting feedback.

The only pending patches are about the new YUV API. They don't conflict with 
your fbdev-next branch.

-- 
Regards,

Laurent Pinchart
```
