summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorHarry Hong <hhong@nvidia.com>2013-08-28 16:32:42 +0900
committerPeter Kim <pekim@nvidia.com>2013-10-10 18:23:44 -0700
commit2e435e64a7f0a4f432f674ce93b3c62b75ab0e4d (patch)
treed266708af40d6a7f45661435c6fe08941b5378ea /drivers/misc
parentddff98871fbd7964e2d4174ae475897a68230bd4 (diff)
misc: ti-st: enable wakeup device
- enable st_host_wake device as wakeup device - set device_wakeup_enabe by default - don't freq irq if irq is not registered in this driver bug 1347948 Change-Id: Id8467cadc21270f73154e32711818111b8eb10c0 Signed-off-by: Harry Hong <hhong@nvidia.com> Reviewed-on: http://git-master/r/267128 (cherry picked from commit a6477db2ef36ac1662b539492e1f654858ee60ed) Reviewed-on: http://git-master/r/288820 Reviewed-by: Peter Kim <pekim@nvidia.com> Tested-by: Peter Kim <pekim@nvidia.com>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/ti-st/st_host_wake.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/misc/ti-st/st_host_wake.c b/drivers/misc/ti-st/st_host_wake.c
index 2568a044813e..588e1e490680 100644
--- a/drivers/misc/ti-st/st_host_wake.c
+++ b/drivers/misc/ti-st/st_host_wake.c
@@ -44,6 +44,7 @@ struct st_host_wake_info {
struct regulator *vdd_3v3;
struct regulator *vdd_1v8;
unsigned int supp_proto_reg;
+ bool is_request_irq;
};
static unsigned long flags;
@@ -159,6 +160,7 @@ static int st_host_wake_probe(struct platform_device *pdev)
pr_warn("%s: regulator vddio_st_1v8 not available\n", __func__);
bsi->vdd_1v8 = NULL;
}
+ bsi->is_request_irq = 0;
res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
"host_wake");
@@ -186,6 +188,7 @@ static int st_host_wake_probe(struct platform_device *pdev)
ret = request_irq(bsi->host_wake_irq, st_host_wake_isr,
IRQF_DISABLED | IRQF_TRIGGER_RISING,
"bluetooth hostwake", dev_id);
+ bsi->is_request_irq = 1;
}
if (ret < 0) {
pr_err("Couldn't acquire HOST_WAKE IRQ");
@@ -195,6 +198,8 @@ static int st_host_wake_probe(struct platform_device *pdev)
clear_bit(HOST_WAKE, &flags);
bsi->supp_proto_reg = 0;
+ device_init_wakeup(&pdev->dev, 1);
+
goto finish;
free_bsi:
@@ -207,7 +212,8 @@ static int st_host_wake_remove(struct platform_device *pdev)
{
pr_debug("%s", __func__);
- free_irq(bsi->host_wake_irq, dev_id);
+ if (bsi->is_request_irq)
+ free_irq(bsi->host_wake_irq, dev_id);
if (bsi->vdd_3v3)
regulator_put(bsi->vdd_3v3);
@@ -223,7 +229,8 @@ static int st_host_wake_resume(struct platform_device *pdev)
{
pr_info("%s", __func__);
- if (test_bit(HOST_WAKE, &flags) && test_bit(IRQ_WAKE, &flags)) {
+ if (test_bit(HOST_WAKE, &flags) && test_bit(IRQ_WAKE, &flags)
+ && device_may_wakeup(&pdev->dev)) {
pr_info("disable the host_wake irq");
disable_irq_wake(bsi->host_wake_irq);
clear_bit(IRQ_WAKE, &flags);
@@ -232,13 +239,15 @@ static int st_host_wake_resume(struct platform_device *pdev)
return 0;
}
-static int st_host_wake_suspend(struct platform_device *p, pm_message_t s)
+static int st_host_wake_suspend(struct platform_device *pdev,
+ pm_message_t state)
{
int retval = 0;
pr_info("%s", __func__);
- if (test_bit(HOST_WAKE, &flags) && (!test_bit(IRQ_WAKE, &flags))) {
+ if (test_bit(HOST_WAKE, &flags) && (!test_bit(IRQ_WAKE, &flags))
+ && device_may_wakeup(&pdev->dev)) {
retval = enable_irq_wake(bsi->host_wake_irq);
if (retval < 0) {
pr_err("Failed to enable HOST_WAKE irq (%d)", retval);