From: Laxman Dewangan <ldewangan@nvidia.com>
To: cw00.choi@samsung.com, myungjoo.ham@samsung.com
Cc: devicetree-discuss@lists.ozlabs.org, rob@landley.net,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
kishon@ti.com, gg@slimlogic.co.uk,
Laxman Dewangan <ldewangan@nvidia.com>
Subject: [PATCH V2 3/4] extcon: palams: add support for suspend/resume
Date: Wed, 10 Jul 2013 11:45:58 +0530 [thread overview]
Message-ID: <1373436959-32444-4-git-send-email-ldewangan@nvidia.com> (raw)
In-Reply-To: <1373436959-32444-1-git-send-email-ldewangan@nvidia.com>
Add suspend/resume callbacks and support for wakeup from
suspend on USB HOST or USB Device cable insertion or removal.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
---
No changes from V1.
drivers/extcon/extcon-palmas.c | 38 +++++++++++++++++++++++++++++++++++---
1 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
index 33254d9..dc7ebf3 100644
--- a/drivers/extcon/extcon-palmas.c
+++ b/drivers/extcon/extcon-palmas.c
@@ -182,7 +182,8 @@ static int palmas_usb_probe(struct platform_device *pdev)
status = devm_request_threaded_irq(palmas_usb->dev, palmas_usb->id_irq,
NULL, palmas_id_irq_handler,
- IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
+ IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
+ IRQF_ONESHOT | IRQF_EARLY_RESUME,
"palmas_usb_id", palmas_usb);
if (status < 0) {
dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
@@ -192,7 +193,8 @@ static int palmas_usb_probe(struct platform_device *pdev)
status = devm_request_threaded_irq(palmas_usb->dev,
palmas_usb->vbus_irq, NULL, palmas_vbus_irq_handler,
- IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
+ IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
+ IRQF_ONESHOT | IRQF_EARLY_RESUME,
"palmas_usb_vbus", palmas_usb);
if (status < 0) {
dev_err(&pdev->dev, "can't get IRQ %d, err %d\n",
@@ -201,7 +203,7 @@ static int palmas_usb_probe(struct platform_device *pdev)
}
palmas_enable_irq(palmas_usb);
-
+ device_set_wakeup_capable(&pdev->dev, true);
return 0;
fail_extcon:
@@ -219,6 +221,35 @@ static int palmas_usb_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM_SLEEP
+static int palmas_usb_suspend(struct device *dev)
+{
+ struct palmas_usb *palmas_usb = dev_get_drvdata(dev);
+
+ if (device_may_wakeup(dev)) {
+ enable_irq_wake(palmas_usb->vbus_irq);
+ enable_irq_wake(palmas_usb->id_irq);
+ }
+ return 0;
+}
+
+static int palmas_usb_resume(struct device *dev)
+{
+ struct palmas_usb *palmas_usb = dev_get_drvdata(dev);
+
+ if (device_may_wakeup(dev)) {
+ disable_irq_wake(palmas_usb->vbus_irq);
+ disable_irq_wake(palmas_usb->id_irq);
+ }
+ return 0;
+};
+#endif
+
+static const struct dev_pm_ops palmas_pm_ops = {
+ SET_SYSTEM_SLEEP_PM_OPS(palmas_usb_suspend,
+ palmas_usb_resume)
+};
+
static struct of_device_id of_palmas_match_tbl[] = {
{ .compatible = "ti,palmas-usb", },
{ .compatible = "ti,twl6035-usb", },
@@ -232,6 +263,7 @@ static struct platform_driver palmas_usb_driver = {
.name = "palmas-usb",
.of_match_table = of_palmas_match_tbl,
.owner = THIS_MODULE,
+ .pm = &palmas_pm_ops,
},
};
--
1.7.1.1
next prev parent reply other threads:[~2013-07-10 6:15 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-10 6:15 [PATCH V2 0/4] extcon: palmas: clean-up/fixes and suspend/resume susupport Laxman Dewangan
[not found] ` <1373436959-32444-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-07-10 6:15 ` [PATCH V2 1/4] extcon: palmas: remove unused member from palams_usb structure Laxman Dewangan
2013-07-10 6:15 ` [PATCH V2 2/4] extcon: palmas: enable ID_GND and ID_FLOAT detection always Laxman Dewangan
2013-07-10 7:02 ` Chanwoo Choi
2013-07-10 7:16 ` Laxman Dewangan
2013-07-10 6:15 ` Laxman Dewangan [this message]
2013-07-10 6:15 ` [PATCH V2 4/4] extcon: palmas: Option to disable ID/VBUS detection based on platform Laxman Dewangan
2013-07-10 6:55 ` Chanwoo Choi
2013-07-10 7:13 ` Laxman Dewangan
2013-07-10 7:34 ` Chanwoo Choi
2013-07-10 8:42 ` Laxman Dewangan
2013-07-10 6:57 ` [PATCH V2 0/4] extcon: palmas: clean-up/fixes and suspend/resume susupport Chanwoo Choi
2013-07-10 7:14 ` Laxman Dewangan
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=1373436959-32444-4-git-send-email-ldewangan@nvidia.com \
--to=ldewangan@nvidia.com \
--cc=cw00.choi@samsung.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=gg@slimlogic.co.uk \
--cc=kishon@ti.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
--cc=rob@landley.net \
/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).