misc: max8925_onkey: add function to work as wakeup source
Subsystems (2)
PATCH 1/1 misc: max8925_onkey: add function to work as wakeup source
From: Kevin Liu <[email protected]>
--- drivers/input/misc/max8925_onkey.c | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-)
drivers/input/misc/max8925_onkey.c +35 -0
@@ -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),
Signature · 1 line
1.7.0.4
PATCH 1/1 misc: max8925_onkey: add function to work as wakeup source
Quoted 42 lines · Haojian Zhuang
From: Kevin Liu <[email protected]>
Signed-off-by Kevin Liu <[email protected]>--- drivers/input/misc/max8925_onkey.c | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-)drivers/input/misc/max8925_onkey.c +20
-0@@ -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)) {
drivers/input/misc/max8925_onkey.c static int __devexit max8925_onkey_remove(struct platform_device *pdev) · line 190
Quoted 10 lines
drivers/input/misc/max8925_onkey.c +10
-0+ 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
Quoted 12 lines
drivers/input/misc/max8925_onkey.c +5
-0+#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),
Dmitry Torokhov
maintainerPATCH 1/1 misc: max8925_onkey: add function to work as wakeup source
In reply to Haojian ZhuangHi Haojian,
Quoted 3 lines · Haojian Zhuang
From: Kevin Liu <[email protected]>
Signed-off-by Kevin Liu <[email protected]>
Since I am getting the patch from you you need to add your own "Signed-off-by: ..." as well.
Quoted 17 lines
--- drivers/input/misc/max8925_onkey.c | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-)drivers/input/misc/max8925_onkey.c +1
-0@@ -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) {
drivers/input/misc/max8925_onkey.c static int __devexit max8925_onkey_remove(struct platform_device *pdev) · line 162
Quoted 4 lines
drivers/input/misc/max8925_onkey.c +1
-0@@ -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.
drivers/input/misc/max8925_onkey.c static int __devexit max8925_onkey_remove(struct platform_device *pdev) · line 170
Quoted 8 lines
drivers/input/misc/max8925_onkey.c +8
-0+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?
Quoted 17 lines
drivers/input/misc/max8925_onkey.c +17
-0+ } +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 = {
drivers/input/misc/max8925_onkey.c static int __devexit max8925_onkey_remove(struct platform_device *pdev) · line 197
Quoted 10 lines
drivers/input/misc/max8925_onkey.c +6
-0+ .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.
Quoted 9 lines
drivers/input/misc/max8925_onkey.c +2
-0+ .pm = &max8925_onkey_pm_ops, +#endif }, .probe = max8925_onkey_probe, .remove = __devexit_p(max8925_onkey_remove),Signature · 1 line
1.7.0.4
Thanks.
Signature · 1 line
Dmitry
PATCH 1/1 misc: max8925_onkey: add function to work as wakeup source
Quoted 34 lines · Dmitry Torokhov
Hi Haojian,
Quoted 3 lines · Haojian Zhuang
From: Kevin Liu <[email protected]>
Signed-off-by Kevin Liu <[email protected]>Since I am getting the patch from you you need to add your own "Signed-off-by: ..." as well.
Quoted 17 lines
---
?drivers/input/misc/max8925_onkey.c | ? 35 +++++++++++++++++++++++++++++++++++ ?1 files changed, 35 insertions(+), 0 deletions(-)drivers/input/misc/max8925_onkey.c +1
-0@@ -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) {drivers/input/misc/max8925_onkey.c static int __devexit max8925_onkey_remove(struct platform_device *pdev) · line 162
Quoted 4 lines
drivers/input/misc/max8925_onkey.c +1
-0@@ -158,10 +159,44 @@ static int __devexit max8925_onkey_remove(struct platform_device *pdev) ? ? ? return 0; ?} +#ifdef CONFIG_PM #ifdef
CONFIG_PM_SLEEPis better choice here.
Quoted 11 lines
drivers/input/misc/max8925_onkey.c static int __devexit max8925_onkey_remove(struct platform_device *pdev) · line 170
Quoted 8 lines
drivers/input/misc/max8925_onkey.c +8
-0+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