diff options
| author | Jett.Zhou <jtzhou@marvell.com> | 2012-02-27 09:44:20 -0500 |
|---|---|---|
| committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-03-06 12:46:49 -0500 |
| commit | 2853378b6eafd8b9e2f0e39ab599c93ce518b04d (patch) | |
| tree | 2e92700fe3714e3b919cbd920709fcbc4fb8aed8 /drivers/input | |
| parent | b8b8d7932bb83300d0ae6553e320ab1aecb37990 (diff) | |
mfd: Add ability to wake the system for 88pm860x
For 88pm860x pmic, it can wake the system from low power mode by irq,
its sub-devs like RTC and onkey can be enabled for this usage.
Signed-off-by: Jett.Zhou <jtzhou@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/input')
| -rw-r--r-- | drivers/input/misc/88pm860x_onkey.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/input/misc/88pm860x_onkey.c b/drivers/input/misc/88pm860x_onkey.c index f2e0cbc5ab64..f9ce1835e4d7 100644 --- a/drivers/input/misc/88pm860x_onkey.c +++ b/drivers/input/misc/88pm860x_onkey.c | |||
| @@ -105,6 +105,8 @@ static int __devinit pm860x_onkey_probe(struct platform_device *pdev) | |||
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | platform_set_drvdata(pdev, info); | 107 | platform_set_drvdata(pdev, info); |
| 108 | device_init_wakeup(&pdev->dev, 1); | ||
| 109 | |||
| 108 | return 0; | 110 | return 0; |
| 109 | 111 | ||
| 110 | out_irq: | 112 | out_irq: |
| @@ -129,10 +131,34 @@ static int __devexit pm860x_onkey_remove(struct platform_device *pdev) | |||
| 129 | return 0; | 131 | return 0; |
| 130 | } | 132 | } |
| 131 | 133 | ||
| 134 | #ifdef CONFIG_PM_SLEEP | ||
| 135 | static int pm860x_onkey_suspend(struct device *dev) | ||
| 136 | { | ||
| 137 | struct platform_device *pdev = to_platform_device(dev); | ||
| 138 | struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); | ||
| 139 | |||
| 140 | if (device_may_wakeup(dev)) | ||
| 141 | chip->wakeup_flag |= 1 << PM8607_IRQ_ONKEY; | ||
| 142 | return 0; | ||
| 143 | } | ||
| 144 | static int pm860x_onkey_resume(struct device *dev) | ||
| 145 | { | ||
| 146 | struct platform_device *pdev = to_platform_device(dev); | ||
| 147 | struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); | ||
| 148 | |||
| 149 | if (device_may_wakeup(dev)) | ||
| 150 | chip->wakeup_flag &= ~(1 << PM8607_IRQ_ONKEY); | ||
| 151 | return 0; | ||
| 152 | } | ||
| 153 | #endif | ||
| 154 | |||
| 155 | static SIMPLE_DEV_PM_OPS(pm860x_onkey_pm_ops, pm860x_onkey_suspend, pm860x_onkey_resume); | ||
| 156 | |||
| 132 | static struct platform_driver pm860x_onkey_driver = { | 157 | static struct platform_driver pm860x_onkey_driver = { |
| 133 | .driver = { | 158 | .driver = { |
| 134 | .name = "88pm860x-onkey", | 159 | .name = "88pm860x-onkey", |
| 135 | .owner = THIS_MODULE, | 160 | .owner = THIS_MODULE, |
| 161 | .pm = &pm860x_onkey_pm_ops, | ||
| 136 | }, | 162 | }, |
| 137 | .probe = pm860x_onkey_probe, | 163 | .probe = pm860x_onkey_probe, |
| 138 | .remove = __devexit_p(pm860x_onkey_remove), | 164 | .remove = __devexit_p(pm860x_onkey_remove), |
