linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] misc: max8925_onkey: add function to work as wakeup source
@ 2011-12-22  8:55 Haojian Zhuang
  2011-12-22  9:08 ` Wanlong Gao
  2011-12-22 17:43 ` Dmitry Torokhov
  0 siblings, 2 replies; 4+ messages in thread
From: Haojian Zhuang @ 2011-12-22  8:55 UTC (permalink / raw)
  To: dmitry.torokhov, dtor, linux-input, linux-arm-kernel; +Cc: Kevin Liu

From: Kevin Liu <kliu5@marvell.com>

Signed-off-by: Kevin Liu <kliu5@marvell.com>
---
 drivers/input/misc/max8925_onkey.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c
index 7de0ded..ce07ae2 100644
--- a/drivers/input/misc/max8925_onkey.c
+++ b/drivers/input/misc/max8925_onkey.c
@@ -122,6 +122,7 @@ static int __devinit max8925_onkey_probe(struct platform_device *pdev)
 	info->idev->evbit[0] = BIT_MASK(EV_KEY);
 	info->idev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
 
+	device_init_wakeup(&pdev->dev, 1);
 
 	error = input_register_device(info->idev);
 	if (error) {
@@ -158,10 +159,44 @@ static int __devexit max8925_onkey_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int max8925_onkey_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
+
+	if (device_may_wakeup(dev)) {
+		chip->wakeup_flag |= 1 << (onkey_irq[0] - chip->irq_base);
+		chip->wakeup_flag |= 1 << (onkey_irq[1] - chip->irq_base);
+	}
+	return 0;
+}
+
+static int max8925_onkey_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
+
+	if (device_may_wakeup(dev)) {
+		chip->wakeup_flag &= ~(1 << (onkey_irq[0] - chip->irq_base));
+		chip->wakeup_flag &= ~(1 << (onkey_irq[1] - chip->irq_base));
+	}
+	return 0;
+}
+
+static struct dev_pm_ops max8925_onkey_pm_ops = {
+	.suspend        = max8925_onkey_suspend,
+	.resume         = max8925_onkey_resume,
+}
+#endif
+
 static struct platform_driver max8925_onkey_driver = {
 	.driver		= {
 		.name	= "max8925-onkey",
 		.owner	= THIS_MODULE,
+#ifdef CONFIG_PM
+		.pm	= &max8925_onkey_pm_ops,
+#endif
 	},
 	.probe		= max8925_onkey_probe,
 	.remove		= __devexit_p(max8925_onkey_remove),
-- 
1.7.0.4


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

* Re: [PATCH] misc: max8925_onkey: add function to work as wakeup source
  2011-12-22  8:55 [PATCH] misc: max8925_onkey: add function to work as wakeup source Haojian Zhuang
@ 2011-12-22  9:08 ` Wanlong Gao
  2011-12-22 17:43 ` Dmitry Torokhov
  1 sibling, 0 replies; 4+ messages in thread
From: Wanlong Gao @ 2011-12-22  9:08 UTC (permalink / raw)
  To: Haojian Zhuang
  Cc: dmitry.torokhov, dtor, linux-input, linux-arm-kernel, Kevin Liu

On 12/22/2011 04:55 PM, Haojian Zhuang wrote:

> From: Kevin Liu <kliu5@marvell.com>
> 
> Signed-off-by: Kevin Liu <kliu5@marvell.com>
> ---
>  drivers/input/misc/max8925_onkey.c |   35 +++++++++++++++++++++++++++++++++++
>  1 files changed, 35 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c
> index 7de0ded..ce07ae2 100644
> --- a/drivers/input/misc/max8925_onkey.c
> +++ b/drivers/input/misc/max8925_onkey.c
> @@ -122,6 +122,7 @@ static int __devinit max8925_onkey_probe(struct platform_device *pdev)
>  	info->idev->evbit[0] = BIT_MASK(EV_KEY);
>  	info->idev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
>  
> +	device_init_wakeup(&pdev->dev, 1);
>  
>  	error = input_register_device(info->idev);
>  	if (error) {
> @@ -158,10 +159,44 @@ static int __devexit max8925_onkey_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_PM
> +static int max8925_onkey_suspend(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +	struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
> +
> +	if (device_may_wakeup(dev)) {
> +		chip->wakeup_flag |= 1 << (onkey_irq[0] - chip->irq_base);
> +		chip->wakeup_flag |= 1 << (onkey_irq[1] - chip->irq_base);
> +	}
> +	return 0;
> +}
> +
> +static int max8925_onkey_resume(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +	struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
> +
> +	if (device_may_wakeup(dev)) {
> +		chip->wakeup_flag &= ~(1 << (onkey_irq[0] - chip->irq_base));
> +		chip->wakeup_flag &= ~(1 << (onkey_irq[1] - chip->irq_base));
> +	}
> +	return 0;
> +}
> +
> +static struct dev_pm_ops max8925_onkey_pm_ops = {
> +	.suspend        = max8925_onkey_suspend,
> +	.resume         = max8925_onkey_resume,
> +}


You can use SIMPLE_DEV_PM_OPS here.


Thanks
-Wanlong Gao

> +#endif
> +
>  static struct platform_driver max8925_onkey_driver = {
>  	.driver		= {
>  		.name	= "max8925-onkey",
>  		.owner	= THIS_MODULE,
> +#ifdef CONFIG_PM
> +		.pm	= &max8925_onkey_pm_ops,
> +#endif
>  	},
>  	.probe		= max8925_onkey_probe,
>  	.remove		= __devexit_p(max8925_onkey_remove),



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

* Re: [PATCH] misc: max8925_onkey: add function to work as wakeup source
  2011-12-22  8:55 [PATCH] misc: max8925_onkey: add function to work as wakeup source Haojian Zhuang
  2011-12-22  9:08 ` Wanlong Gao
@ 2011-12-22 17:43 ` Dmitry Torokhov
  2011-12-23 14:43   ` Haojian Zhuang
  1 sibling, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2011-12-22 17:43 UTC (permalink / raw)
  To: Haojian Zhuang; +Cc: linux-input, linux-arm-kernel, Kevin Liu

Hi Haojian,

On Thu, Dec 22, 2011 at 04:55:51PM +0800, Haojian Zhuang wrote:
> From: Kevin Liu <kliu5@marvell.com>
> 
> Signed-off-by: Kevin Liu <kliu5@marvell.com>

Since I am getting the patch from you you need to add your own
"Signed-off-by: ..." as well.

> ---
>  drivers/input/misc/max8925_onkey.c |   35 +++++++++++++++++++++++++++++++++++
>  1 files changed, 35 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c
> index 7de0ded..ce07ae2 100644
> --- a/drivers/input/misc/max8925_onkey.c
> +++ b/drivers/input/misc/max8925_onkey.c
> @@ -122,6 +122,7 @@ static int __devinit max8925_onkey_probe(struct platform_device *pdev)
>  	info->idev->evbit[0] = BIT_MASK(EV_KEY);
>  	info->idev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
>  
> +	device_init_wakeup(&pdev->dev, 1);
>  
>  	error = input_register_device(info->idev);
>  	if (error) {
> @@ -158,10 +159,44 @@ static int __devexit max8925_onkey_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_PM

#ifdef CONFIG_PM_SLEEP is better choice here.

> +static int max8925_onkey_suspend(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +	struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
> +
> +	if (device_may_wakeup(dev)) {
> +		chip->wakeup_flag |= 1 << (onkey_irq[0] - chip->irq_base);
> +		chip->wakeup_flag |= 1 << (onkey_irq[1] - chip->irq_base);

You don't need to actually communicate this to the device?

> +	}
> +	return 0;
> +}
> +
> +static int max8925_onkey_resume(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +	struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
> +
> +	if (device_may_wakeup(dev)) {
> +		chip->wakeup_flag &= ~(1 << (onkey_irq[0] - chip->irq_base));
> +		chip->wakeup_flag &= ~(1 << (onkey_irq[1] - chip->irq_base));
> +	}
> +	return 0;
> +}
> +
> +static struct dev_pm_ops max8925_onkey_pm_ops = {
> +	.suspend        = max8925_onkey_suspend,
> +	.resume         = max8925_onkey_resume,
> +}
> +#endif
> +
>  static struct platform_driver max8925_onkey_driver = {
>  	.driver		= {
>  		.name	= "max8925-onkey",
>  		.owner	= THIS_MODULE,
> +#ifdef CONFIG_PM

CONFIG_PM_SLEEP here as well.

> +		.pm	= &max8925_onkey_pm_ops,
> +#endif
>  	},
>  	.probe		= max8925_onkey_probe,
>  	.remove		= __devexit_p(max8925_onkey_remove),
> -- 
> 1.7.0.4
> 
> 

Thanks.

-- 
Dmitry

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

* Re: [PATCH] misc: max8925_onkey: add function to work as wakeup source
  2011-12-22 17:43 ` Dmitry Torokhov
@ 2011-12-23 14:43   ` Haojian Zhuang
  0 siblings, 0 replies; 4+ messages in thread
From: Haojian Zhuang @ 2011-12-23 14:43 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Haojian Zhuang, Kevin Liu, linux-arm-kernel, linux-input

On Fri, Dec 23, 2011 at 1:43 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> Hi Haojian,
>
> On Thu, Dec 22, 2011 at 04:55:51PM +0800, Haojian Zhuang wrote:
>> From: Kevin Liu <kliu5@marvell.com>
>>
>> Signed-off-by: Kevin Liu <kliu5@marvell.com>
>
> Since I am getting the patch from you you need to add your own
> "Signed-off-by: ..." as well.
>
>> ---
>>  drivers/input/misc/max8925_onkey.c |   35 +++++++++++++++++++++++++++++++++++
>>  1 files changed, 35 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c
>> index 7de0ded..ce07ae2 100644
>> --- a/drivers/input/misc/max8925_onkey.c
>> +++ b/drivers/input/misc/max8925_onkey.c
>> @@ -122,6 +122,7 @@ static int __devinit max8925_onkey_probe(struct platform_device *pdev)
>>       info->idev->evbit[0] = BIT_MASK(EV_KEY);
>>       info->idev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
>>
>> +     device_init_wakeup(&pdev->dev, 1);
>>
>>       error = input_register_device(info->idev);
>>       if (error) {
>> @@ -158,10 +159,44 @@ static int __devexit max8925_onkey_remove(struct platform_device *pdev)
>>       return 0;
>>  }
>>
>> +#ifdef CONFIG_PM
>
> #ifdef CONFIG_PM_SLEEP is better choice here.
>
>> +static int max8925_onkey_suspend(struct device *dev)
>> +{
>> +     struct platform_device *pdev = to_platform_device(dev);
>> +     struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
>> +
>> +     if (device_may_wakeup(dev)) {
>> +             chip->wakeup_flag |= 1 << (onkey_irq[0] - chip->irq_base);
>> +             chip->wakeup_flag |= 1 << (onkey_irq[1] - chip->irq_base);
>
> You don't need to actually communicate this to the device?
>
Excuse me that I missed another patch in this series. So I'll send it again.

Best Regards
Haojian
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2011-12-23 14:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-22  8:55 [PATCH] misc: max8925_onkey: add function to work as wakeup source Haojian Zhuang
2011-12-22  9:08 ` Wanlong Gao
2011-12-22 17:43 ` Dmitry Torokhov
2011-12-23 14:43   ` Haojian Zhuang

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).