diff options
-rw-r--r-- | drivers/input/misc/88pm860x_onkey.c | 26 | ||||
-rw-r--r-- | drivers/mfd/88pm860x-i2c.c | 25 | ||||
-rw-r--r-- | drivers/rtc/rtc-88pm860x.c | 27 | ||||
-rw-r--r-- | include/linux/mfd/88pm860x.h | 1 |
4 files changed, 79 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), |
diff --git a/drivers/mfd/88pm860x-i2c.c b/drivers/mfd/88pm860x-i2c.c index f93dd9571c3c..b2cfdc458561 100644 --- a/drivers/mfd/88pm860x-i2c.c +++ b/drivers/mfd/88pm860x-i2c.c | |||
@@ -334,10 +334,35 @@ static int __devexit pm860x_remove(struct i2c_client *client) | |||
334 | return 0; | 334 | return 0; |
335 | } | 335 | } |
336 | 336 | ||
337 | #ifdef CONFIG_PM_SLEEP | ||
338 | static int pm860x_suspend(struct device *dev) | ||
339 | { | ||
340 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | ||
341 | struct pm860x_chip *chip = i2c_get_clientdata(client); | ||
342 | |||
343 | if (device_may_wakeup(dev) && chip->wakeup_flag) | ||
344 | enable_irq_wake(chip->core_irq); | ||
345 | return 0; | ||
346 | } | ||
347 | |||
348 | static int pm860x_resume(struct device *dev) | ||
349 | { | ||
350 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | ||
351 | struct pm860x_chip *chip = i2c_get_clientdata(client); | ||
352 | |||
353 | if (device_may_wakeup(dev) && chip->wakeup_flag) | ||
354 | disable_irq_wake(chip->core_irq); | ||
355 | return 0; | ||
356 | } | ||
357 | #endif | ||
358 | |||
359 | static SIMPLE_DEV_PM_OPS(pm860x_pm_ops, pm860x_suspend, pm860x_resume); | ||
360 | |||
337 | static struct i2c_driver pm860x_driver = { | 361 | static struct i2c_driver pm860x_driver = { |
338 | .driver = { | 362 | .driver = { |
339 | .name = "88PM860x", | 363 | .name = "88PM860x", |
340 | .owner = THIS_MODULE, | 364 | .owner = THIS_MODULE, |
365 | .pm = &pm860x_pm_ops, | ||
341 | }, | 366 | }, |
342 | .probe = pm860x_probe, | 367 | .probe = pm860x_probe, |
343 | .remove = __devexit_p(pm860x_remove), | 368 | .remove = __devexit_p(pm860x_remove), |
diff --git a/drivers/rtc/rtc-88pm860x.c b/drivers/rtc/rtc-88pm860x.c index f04761e6622d..afee0e8ae714 100644 --- a/drivers/rtc/rtc-88pm860x.c +++ b/drivers/rtc/rtc-88pm860x.c | |||
@@ -376,6 +376,9 @@ static int __devinit pm860x_rtc_probe(struct platform_device *pdev) | |||
376 | INIT_DELAYED_WORK(&info->calib_work, calibrate_vrtc_work); | 376 | INIT_DELAYED_WORK(&info->calib_work, calibrate_vrtc_work); |
377 | schedule_delayed_work(&info->calib_work, VRTC_CALIB_INTERVAL); | 377 | schedule_delayed_work(&info->calib_work, VRTC_CALIB_INTERVAL); |
378 | #endif /* VRTC_CALIBRATION */ | 378 | #endif /* VRTC_CALIBRATION */ |
379 | |||
380 | device_init_wakeup(&pdev->dev, 1); | ||
381 | |||
379 | return 0; | 382 | return 0; |
380 | out_rtc: | 383 | out_rtc: |
381 | free_irq(info->irq, info); | 384 | free_irq(info->irq, info); |
@@ -401,10 +404,34 @@ static int __devexit pm860x_rtc_remove(struct platform_device *pdev) | |||
401 | return 0; | 404 | return 0; |
402 | } | 405 | } |
403 | 406 | ||
407 | #ifdef CONFIG_PM_SLEEP | ||
408 | static int pm860x_rtc_suspend(struct device *dev) | ||
409 | { | ||
410 | struct platform_device *pdev = to_platform_device(dev); | ||
411 | struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); | ||
412 | |||
413 | if (device_may_wakeup(dev)) | ||
414 | chip->wakeup_flag |= 1 << PM8607_IRQ_RTC; | ||
415 | return 0; | ||
416 | } | ||
417 | static int pm860x_rtc_resume(struct device *dev) | ||
418 | { | ||
419 | struct platform_device *pdev = to_platform_device(dev); | ||
420 | struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); | ||
421 | |||
422 | if (device_may_wakeup(dev)) | ||
423 | chip->wakeup_flag &= ~(1 << PM8607_IRQ_RTC); | ||
424 | return 0; | ||
425 | } | ||
426 | #endif | ||
427 | |||
428 | static SIMPLE_DEV_PM_OPS(pm860x_rtc_pm_ops, pm860x_rtc_suspend, pm860x_rtc_resume); | ||
429 | |||
404 | static struct platform_driver pm860x_rtc_driver = { | 430 | static struct platform_driver pm860x_rtc_driver = { |
405 | .driver = { | 431 | .driver = { |
406 | .name = "88pm860x-rtc", | 432 | .name = "88pm860x-rtc", |
407 | .owner = THIS_MODULE, | 433 | .owner = THIS_MODULE, |
434 | .pm = &pm860x_rtc_pm_ops, | ||
408 | }, | 435 | }, |
409 | .probe = pm860x_rtc_probe, | 436 | .probe = pm860x_rtc_probe, |
410 | .remove = __devexit_p(pm860x_rtc_remove), | 437 | .remove = __devexit_p(pm860x_rtc_remove), |
diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h index 92be3476c9f5..8b583f3f7926 100644 --- a/include/linux/mfd/88pm860x.h +++ b/include/linux/mfd/88pm860x.h | |||
@@ -311,6 +311,7 @@ struct pm860x_chip { | |||
311 | int core_irq; | 311 | int core_irq; |
312 | unsigned char chip_version; | 312 | unsigned char chip_version; |
313 | 313 | ||
314 | unsigned int wakeup_flag; | ||
314 | }; | 315 | }; |
315 | 316 | ||
316 | enum { | 317 | enum { |