diff options
author | Daniel Drake <dsd@laptop.org> | 2011-08-10 16:46:02 -0400 |
---|---|---|
committer | Anton Vorontsov <cbouatmailru@gmail.com> | 2011-08-19 13:03:25 -0400 |
commit | cae659af87288a4b1723cdf94d713ef7fb4c56d9 (patch) | |
tree | ca7f38e6148bc0ac3a5e7f4522b8d8d3718f49d2 /drivers/power | |
parent | c3503fd02558245ebbb0b48f3ae1d62416e3fd2a (diff) |
olpc_battery: Add wakeup support
Battery and AC events can now be used to wake up the system from suspend.
Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Andres Salomon <dilinger@queued.net>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/olpc_battery.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/power/olpc_battery.c b/drivers/power/olpc_battery.c index 9972268fea72..46a2f07edab1 100644 --- a/drivers/power/olpc_battery.c +++ b/drivers/power/olpc_battery.c | |||
@@ -533,6 +533,24 @@ void olpc_battery_trigger_uevent(unsigned long cause) | |||
533 | kobject_uevent(&olpc_bat.dev->kobj, KOBJ_CHANGE); | 533 | kobject_uevent(&olpc_bat.dev->kobj, KOBJ_CHANGE); |
534 | } | 534 | } |
535 | 535 | ||
536 | static int olpc_battery_suspend(struct platform_device *pdev, | ||
537 | pm_message_t state) | ||
538 | { | ||
539 | if (device_may_wakeup(olpc_ac.dev)) | ||
540 | olpc_ec_wakeup_set(EC_SCI_SRC_ACPWR); | ||
541 | else | ||
542 | olpc_ec_wakeup_clear(EC_SCI_SRC_ACPWR); | ||
543 | |||
544 | if (device_may_wakeup(olpc_bat.dev)) | ||
545 | olpc_ec_wakeup_set(EC_SCI_SRC_BATTERY | EC_SCI_SRC_BATSOC | ||
546 | | EC_SCI_SRC_BATERR); | ||
547 | else | ||
548 | olpc_ec_wakeup_clear(EC_SCI_SRC_BATTERY | EC_SCI_SRC_BATSOC | ||
549 | | EC_SCI_SRC_BATERR); | ||
550 | |||
551 | return 0; | ||
552 | } | ||
553 | |||
536 | static int __devinit olpc_battery_probe(struct platform_device *pdev) | 554 | static int __devinit olpc_battery_probe(struct platform_device *pdev) |
537 | { | 555 | { |
538 | int ret; | 556 | int ret; |
@@ -578,6 +596,11 @@ static int __devinit olpc_battery_probe(struct platform_device *pdev) | |||
578 | if (ret) | 596 | if (ret) |
579 | goto error_failed; | 597 | goto error_failed; |
580 | 598 | ||
599 | if (olpc_ec_wakeup_available()) { | ||
600 | device_set_wakeup_capable(olpc_ac.dev, true); | ||
601 | device_set_wakeup_capable(olpc_bat.dev, true); | ||
602 | } | ||
603 | |||
581 | return 0; | 604 | return 0; |
582 | 605 | ||
583 | error_failed: | 606 | error_failed: |
@@ -612,6 +635,7 @@ static struct platform_driver olpc_battery_drv = { | |||
612 | }, | 635 | }, |
613 | .probe = olpc_battery_probe, | 636 | .probe = olpc_battery_probe, |
614 | .remove = __devexit_p(olpc_battery_remove), | 637 | .remove = __devexit_p(olpc_battery_remove), |
638 | .suspend = olpc_battery_suspend, | ||
615 | }; | 639 | }; |
616 | 640 | ||
617 | static int __init olpc_bat_init(void) | 641 | static int __init olpc_bat_init(void) |