From: Dmitry Baryshkov <dbaryshkov@gmail.com>
To: cbouatmailru@gmail.com, linux-kernel@vger.kernel.org,
cbou@mail.ru, dwmw2@infradead.org
Subject: [PATCH 2/3] pda_power: add suspend/resume support
Date: Sun, 6 Jan 2008 15:28:39 +0300 [thread overview]
Message-ID: <20080106122839.GA13275@doriath.ww600.siemens.net> (raw)
Add suspend/resume/wakeup support for pda_power.
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
index d98622f..d1ebfa0 100644
--- a/drivers/power/pda_power.c
+++ b/drivers/power/pda_power.c
@@ -239,12 +239,44 @@ static int pda_power_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM
+static int pda_power_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ if (device_may_wakeup(&pdev->dev)) {
+ if (ac_irq)
+ enable_irq_wake(ac_irq->start);
+ if (usb_irq)
+ enable_irq_wake(usb_irq->start);
+ }
+
+ return 0;
+}
+
+static int pda_power_resume(struct platform_device *pdev)
+{
+ if (device_may_wakeup(&pdev->dev)) {
+ if (usb_irq)
+ disable_irq_wake(usb_irq->start);
+ if (ac_irq)
+ disable_irq_wake(ac_irq->start);
+ }
+
+ return 0;
+}
+#else
+#define pda_power_suspend NULL
+#define pda_power_resume NULL
+#endif
+
+
static struct platform_driver pda_power_pdrv = {
.driver = {
.name = "pda-power",
},
.probe = pda_power_probe,
.remove = pda_power_remove,
+ .suspend = pda_power_suspend,
+ .resume = pda_power_resume,
};
static int __init pda_power_init(void)
--
With best wishes
Dmitry
reply other threads:[~2008-01-06 12:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080106122839.GA13275@doriath.ww600.siemens.net \
--to=dbaryshkov@gmail.com \
--cc=cbou@mail.ru \
--cc=cbouatmailru@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).