linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] backlight: pwm_bl: move suspend/resume entries from platform_driver to driver.pm
@ 2011-12-01  1:53 Barry Song
  2011-12-01  2:02 ` Eric Miao
  2012-01-13  9:33 ` Wanlong Gao
  0 siblings, 2 replies; 5+ messages in thread
From: Barry Song @ 2011-12-01  1:53 UTC (permalink / raw)
  To: Richard Purdie, Eric Miao
  Cc: linux-kernel, workgroup.linux, linux-arm-kernel, Xiangzhen Ye,
	Barry Song

From: Xiangzhen Ye <Xiangzhen.Ye@csr.com>

At first, people are moving suspend/resume entries from platform_driver
to driver.pm for many drivers.
On the other hand, if we use swsusp to do hibernation for an embedded
system using pwm_bl, in the process of preparing snapshot, backlight
will be off and make lcd black screen. This gives bad user experiences.
This patch will fix this issue as swsusp will go to call pm.freeze()
but not platform_driver.suspend. we have no pm.freeze() for pwm_bl, so
the lcd black screen will disappear.

Signed-off-by: Xiangzhen Ye <Xiangzhen.Ye@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
---
 drivers/video/backlight/pwm_bl.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
index 8b5b2a4..50f3134 100644
--- a/drivers/video/backlight/pwm_bl.c
+++ b/drivers/video/backlight/pwm_bl.c
@@ -169,9 +169,9 @@ static int pwm_backlight_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_PM
-static int pwm_backlight_suspend(struct platform_device *pdev,
-				 pm_message_t state)
+static int pwm_backlight_suspend(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
 	struct backlight_device *bl = platform_get_drvdata(pdev);
 	struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
 
@@ -184,8 +184,9 @@ static int pwm_backlight_suspend(struct platform_device *pdev,
 	return 0;
 }
 
-static int pwm_backlight_resume(struct platform_device *pdev)
+static int pwm_backlight_resume(struct device *dev)
 {
+	struct platform_device *pdev = to_platform_device(dev);
 	struct backlight_device *bl = platform_get_drvdata(pdev);
 
 	backlight_update_status(bl);
@@ -196,15 +197,19 @@ static int pwm_backlight_resume(struct platform_device *pdev)
 #define pwm_backlight_resume	NULL
 #endif
 
+static const struct dev_pm_ops pwm_backlight_pm_ops = {
+	.suspend = pwm_backlight_suspend,
+	.resume = pwm_backlight_resume,
+};
+
 static struct platform_driver pwm_backlight_driver = {
 	.driver		= {
 		.name	= "pwm-backlight",
 		.owner	= THIS_MODULE,
+		.pm	= &pwm_backlight_pm_ops,
 	},
 	.probe		= pwm_backlight_probe,
 	.remove		= pwm_backlight_remove,
-	.suspend	= pwm_backlight_suspend,
-	.resume		= pwm_backlight_resume,
 };
 
 static int __init pwm_backlight_init(void)
-- 
1.7.1



Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog

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

* Re: [PATCH] backlight: pwm_bl: move suspend/resume entries from platform_driver to driver.pm
  2011-12-01  1:53 [PATCH] backlight: pwm_bl: move suspend/resume entries from platform_driver to driver.pm Barry Song
@ 2011-12-01  2:02 ` Eric Miao
  2012-01-13  9:17   ` Barry Song
  2012-01-13  9:33 ` Wanlong Gao
  1 sibling, 1 reply; 5+ messages in thread
From: Eric Miao @ 2011-12-01  2:02 UTC (permalink / raw)
  To: Barry Song
  Cc: Richard Purdie, linux-kernel, workgroup.linux, linux-arm-kernel,
	Xiangzhen Ye, Barry Song

On Thu, Dec 1, 2011 at 9:53 AM, Barry Song <Barry.Song@csr.com> wrote:
> From: Xiangzhen Ye <Xiangzhen.Ye@csr.com>
>
> At first, people are moving suspend/resume entries from platform_driver
> to driver.pm for many drivers.
> On the other hand, if we use swsusp to do hibernation for an embedded
> system using pwm_bl, in the process of preparing snapshot, backlight
> will be off and make lcd black screen. This gives bad user experiences.
> This patch will fix this issue as swsusp will go to call pm.freeze()
> but not platform_driver.suspend. we have no pm.freeze() for pwm_bl, so
> the lcd black screen will disappear.
>
> Signed-off-by: Xiangzhen Ye <Xiangzhen.Ye@csr.com>
> Signed-off-by: Barry Song <Baohua.Song@csr.com>

Acked-by: Eric Miao <eric.y.miao@gmail.com>

> ---
>  drivers/video/backlight/pwm_bl.c |   15 ++++++++++-----
>  1 files changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index 8b5b2a4..50f3134 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -169,9 +169,9 @@ static int pwm_backlight_remove(struct platform_device *pdev)
>  }
>
>  #ifdef CONFIG_PM
> -static int pwm_backlight_suspend(struct platform_device *pdev,
> -                                pm_message_t state)
> +static int pwm_backlight_suspend(struct device *dev)
>  {
> +       struct platform_device *pdev = to_platform_device(dev);
>        struct backlight_device *bl = platform_get_drvdata(pdev);
>        struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
>
> @@ -184,8 +184,9 @@ static int pwm_backlight_suspend(struct platform_device *pdev,
>        return 0;
>  }
>
> -static int pwm_backlight_resume(struct platform_device *pdev)
> +static int pwm_backlight_resume(struct device *dev)
>  {
> +       struct platform_device *pdev = to_platform_device(dev);
>        struct backlight_device *bl = platform_get_drvdata(pdev);
>
>        backlight_update_status(bl);
> @@ -196,15 +197,19 @@ static int pwm_backlight_resume(struct platform_device *pdev)
>  #define pwm_backlight_resume   NULL
>  #endif
>
> +static const struct dev_pm_ops pwm_backlight_pm_ops = {
> +       .suspend = pwm_backlight_suspend,
> +       .resume = pwm_backlight_resume,
> +};
> +
>  static struct platform_driver pwm_backlight_driver = {
>        .driver         = {
>                .name   = "pwm-backlight",
>                .owner  = THIS_MODULE,
> +               .pm     = &pwm_backlight_pm_ops,
>        },
>        .probe          = pwm_backlight_probe,
>        .remove         = pwm_backlight_remove,
> -       .suspend        = pwm_backlight_suspend,
> -       .resume         = pwm_backlight_resume,
>  };
>
>  static int __init pwm_backlight_init(void)
> --
> 1.7.1
>
>
>
> Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
> More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog

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

* Re: [PATCH] backlight: pwm_bl: move suspend/resume entries from platform_driver to driver.pm
  2011-12-01  2:02 ` Eric Miao
@ 2012-01-13  9:17   ` Barry Song
  0 siblings, 0 replies; 5+ messages in thread
From: Barry Song @ 2012-01-13  9:17 UTC (permalink / raw)
  To: Eric Miao
  Cc: Barry Song, Xiangzhen Ye, linux-kernel, workgroup.linux,
	Richard Purdie, Barry Song, linux-arm-kernel

2011/12/1 Eric Miao <eric.y.miao@gmail.com>:
> On Thu, Dec 1, 2011 at 9:53 AM, Barry Song <Barry.Song@csr.com> wrote:
>> From: Xiangzhen Ye <Xiangzhen.Ye@csr.com>
>>
>> At first, people are moving suspend/resume entries from platform_driver
>> to driver.pm for many drivers.
>> On the other hand, if we use swsusp to do hibernation for an embedded
>> system using pwm_bl, in the process of preparing snapshot, backlight
>> will be off and make lcd black screen. This gives bad user experiences.
>> This patch will fix this issue as swsusp will go to call pm.freeze()
>> but not platform_driver.suspend. we have no pm.freeze() for pwm_bl, so
>> the lcd black screen will disappear.
>>
>> Signed-off-by: Xiangzhen Ye <Xiangzhen.Ye@csr.com>
>> Signed-off-by: Barry Song <Baohua.Song@csr.com>
>
> Acked-by: Eric Miao <eric.y.miao@gmail.com>

Eric, thanks. Mark Brown's "backlight: convert pwm_bl to dev_pm_ops"
http://www.spinics.net/lists/mm-commits/msg86844.html
did seem and has been merged as commit e2c17bc6f.


>
>> ---
>>  drivers/video/backlight/pwm_bl.c |   15 ++++++++++-----
>>  1 files changed, 10 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
>> index 8b5b2a4..50f3134 100644
>> --- a/drivers/video/backlight/pwm_bl.c
>> +++ b/drivers/video/backlight/pwm_bl.c
>> @@ -169,9 +169,9 @@ static int pwm_backlight_remove(struct platform_device *pdev)
>>  }
>>
>>  #ifdef CONFIG_PM
>> -static int pwm_backlight_suspend(struct platform_device *pdev,
>> -                                pm_message_t state)
>> +static int pwm_backlight_suspend(struct device *dev)
>>  {
>> +       struct platform_device *pdev = to_platform_device(dev);
>>        struct backlight_device *bl = platform_get_drvdata(pdev);
>>        struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
>>
>> @@ -184,8 +184,9 @@ static int pwm_backlight_suspend(struct platform_device *pdev,
>>        return 0;
>>  }
>>
>> -static int pwm_backlight_resume(struct platform_device *pdev)
>> +static int pwm_backlight_resume(struct device *dev)
>>  {
>> +       struct platform_device *pdev = to_platform_device(dev);
>>        struct backlight_device *bl = platform_get_drvdata(pdev);
>>
>>        backlight_update_status(bl);
>> @@ -196,15 +197,19 @@ static int pwm_backlight_resume(struct platform_device *pdev)
>>  #define pwm_backlight_resume   NULL
>>  #endif
>>
>> +static const struct dev_pm_ops pwm_backlight_pm_ops = {
>> +       .suspend = pwm_backlight_suspend,
>> +       .resume = pwm_backlight_resume,
>> +};
>> +
>>  static struct platform_driver pwm_backlight_driver = {
>>        .driver         = {
>>                .name   = "pwm-backlight",
>>                .owner  = THIS_MODULE,
>> +               .pm     = &pwm_backlight_pm_ops,
>>        },
>>        .probe          = pwm_backlight_probe,
>>        .remove         = pwm_backlight_remove,
>> -       .suspend        = pwm_backlight_suspend,
>> -       .resume         = pwm_backlight_resume,
>>  };
>>
>>  static int __init pwm_backlight_init(void)
>> --
>> 1.7.1

-barry

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

* Re: [PATCH] backlight: pwm_bl: move suspend/resume entries from platform_driver to driver.pm
  2011-12-01  1:53 [PATCH] backlight: pwm_bl: move suspend/resume entries from platform_driver to driver.pm Barry Song
  2011-12-01  2:02 ` Eric Miao
@ 2012-01-13  9:33 ` Wanlong Gao
  2012-01-13  9:38   ` Barry Song
  1 sibling, 1 reply; 5+ messages in thread
From: Wanlong Gao @ 2012-01-13  9:33 UTC (permalink / raw)
  To: Barry Song
  Cc: Richard Purdie, Eric Miao, linux-kernel, workgroup.linux,
	linux-arm-kernel, Xiangzhen Ye, Barry Song

On 12/01/2011 09:53 AM, Barry Song wrote:

> From: Xiangzhen Ye <Xiangzhen.Ye@csr.com>
> 
> At first, people are moving suspend/resume entries from platform_driver
> to driver.pm for many drivers.
> On the other hand, if we use swsusp to do hibernation for an embedded
> system using pwm_bl, in the process of preparing snapshot, backlight
> will be off and make lcd black screen. This gives bad user experiences.
> This patch will fix this issue as swsusp will go to call pm.freeze()
> but not platform_driver.suspend. we have no pm.freeze() for pwm_bl, so
> the lcd black screen will disappear.
> 
> Signed-off-by: Xiangzhen Ye <Xiangzhen.Ye@csr.com>
> Signed-off-by: Barry Song <Baohua.Song@csr.com>
> ---
>  drivers/video/backlight/pwm_bl.c |   15 ++++++++++-----
>  1 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
> index 8b5b2a4..50f3134 100644
> --- a/drivers/video/backlight/pwm_bl.c
> +++ b/drivers/video/backlight/pwm_bl.c
> @@ -169,9 +169,9 @@ static int pwm_backlight_remove(struct platform_device *pdev)
>  }
>  
>  #ifdef CONFIG_PM
> -static int pwm_backlight_suspend(struct platform_device *pdev,
> -				 pm_message_t state)
> +static int pwm_backlight_suspend(struct device *dev)
>  {
> +	struct platform_device *pdev = to_platform_device(dev);
>  	struct backlight_device *bl = platform_get_drvdata(pdev);
>  	struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
>  
> @@ -184,8 +184,9 @@ static int pwm_backlight_suspend(struct platform_device *pdev,
>  	return 0;
>  }
>  
> -static int pwm_backlight_resume(struct platform_device *pdev)
> +static int pwm_backlight_resume(struct device *dev)
>  {
> +	struct platform_device *pdev = to_platform_device(dev);
>  	struct backlight_device *bl = platform_get_drvdata(pdev);
>  
>  	backlight_update_status(bl);
> @@ -196,15 +197,19 @@ static int pwm_backlight_resume(struct platform_device *pdev)
>  #define pwm_backlight_resume	NULL
>  #endif
>  
> +static const struct dev_pm_ops pwm_backlight_pm_ops = {
> +	.suspend = pwm_backlight_suspend,
> +	.resume = pwm_backlight_resume,
> +};


Why not use SIMPLE_DEV_PM_OPS instead?

Thanks
-Wanlong Gao

> +
>  static struct platform_driver pwm_backlight_driver = {
>  	.driver		= {
>  		.name	= "pwm-backlight",
>  		.owner	= THIS_MODULE,
> +		.pm	= &pwm_backlight_pm_ops,
>  	},
>  	.probe		= pwm_backlight_probe,
>  	.remove		= pwm_backlight_remove,
> -	.suspend	= pwm_backlight_suspend,
> -	.resume		= pwm_backlight_resume,
>  };
>  
>  static int __init pwm_backlight_init(void)



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

* Re: [PATCH] backlight: pwm_bl: move suspend/resume entries from platform_driver to driver.pm
  2012-01-13  9:33 ` Wanlong Gao
@ 2012-01-13  9:38   ` Barry Song
  0 siblings, 0 replies; 5+ messages in thread
From: Barry Song @ 2012-01-13  9:38 UTC (permalink / raw)
  To: gaowanlong
  Cc: Barry Song, Eric Miao, Xiangzhen Ye, linux-kernel,
	workgroup.linux, Richard Purdie, Barry Song, linux-arm-kernel

>
> Why not use SIMPLE_DEV_PM_OPS instead?
>

Mark's revision merged did use SIMPLE_DEV_PM_OPS

-barry

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

end of thread, other threads:[~2012-01-13  9:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-01  1:53 [PATCH] backlight: pwm_bl: move suspend/resume entries from platform_driver to driver.pm Barry Song
2011-12-01  2:02 ` Eric Miao
2012-01-13  9:17   ` Barry Song
2012-01-13  9:33 ` Wanlong Gao
2012-01-13  9:38   ` Barry Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).