From: Benson Leung <bleung@chromium.org>
To: lars@metafoo.de, cbouatmailru@gmail.com
Cc: rklein@nvidia.com, linux-kernel@vger.kernel.org,
Benson Leung <bleung@chromium.org>
Subject: [PATCH] gpio-charger: Add gpio_charger_resume
Date: Sat, 2 Apr 2011 16:16:24 -0700 [thread overview]
Message-ID: <1301786184-19603-1-git-send-email-bleung@chromium.org> (raw)
Gpio charger should notify if the gpio state had changed
during suspend. This will send a CHANGED event each time
the system resumes, ensuring a plug/unplug of the charger
is not missed.
Signed-off-by: Benson Leung <bleung@chromium.org>
---
drivers/power/gpio-charger.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c
index 25b88ac..e83c892 100644
--- a/drivers/power/gpio-charger.c
+++ b/drivers/power/gpio-charger.c
@@ -161,9 +161,26 @@ static int __devexit gpio_charger_remove(struct platform_device *pdev)
return 0;
}
+#if defined CONFIG_PM
+static int gpio_charger_resume(struct platform_device *pdev)
+{
+ struct gpio_charger *gpio_charger = platform_get_drvdata(pdev);
+
+ power_supply_changed(&gpio_charger->charger);
+
+ return 0;
+}
+#else
+#define gpio_charger_resume NULL
+#endif
+#define gpio_charger_suspend NULL
+
+
static struct platform_driver gpio_charger_driver = {
.probe = gpio_charger_probe,
.remove = __devexit_p(gpio_charger_remove),
+ .suspend = gpio_charger_suspend,
+ .resume = gpio_charger_resume,
.driver = {
.name = "gpio-charger",
.owner = THIS_MODULE,
--
1.7.1
next reply other threads:[~2011-04-02 23:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-02 23:16 Benson Leung [this message]
2011-04-02 23:36 ` [PATCH] gpio-charger: Add gpio_charger_resume Lars-Peter Clausen
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=1301786184-19603-1-git-send-email-bleung@chromium.org \
--to=bleung@chromium.org \
--cc=cbouatmailru@gmail.com \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.kernel.org \
--cc=rklein@nvidia.com \
/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).